[opencms-dev] Duplicate Entry Exception While CmsObject.LoginUser() - Please Help urgent

Govind R rocks2984 at gmail.com
Wed May 20 09:04:29 CEST 2009


Hello All.

I am using OpenCms 7.0.3 with  jboss-4.2.0.GA

org.opencms.db.CmsDbSqlException: An SQL error occurred when executing the
following query: com.mysql.jdbc.ServerPreparedStatement[23] - INSERT INTO
CMS_USERDATA (USER_ID,DATA_KEY,DATA_VALUE,DATA_TYPE) VALUES
('c300ba5c-01e8-3727-b305-5dcc9ccae1ee', 'USER_DESCRIPTION', x'',
'java.lang.String').
at
org.opencms.db.generic.CmsUserDriver.writeUserInfo(CmsUserDriver.java:1912)
at
org.opencms.db.generic.CmsUserDriver.internalWriteUserInfos(CmsUserDriver.java:2606)
at org.opencms.db.generic.CmsUserDriver.writeUser(CmsUserDriver.java:1891)
at org.opencms.db.CmsDriverManager.loginUser(CmsDriverManager.java:4623)
at org.opencms.db.CmsSecurityManager.loginUser(CmsSecurityManager.java:2849)
at org.opencms.file.CmsObject.loginUser(CmsObject.java:2222)
at org.opencms.file.CmsObject.loginUser(CmsObject.java:2205)
at com.abc.XXXService.<init>(XXXService.java:80)
at com.abc.XXXXTest.<init>(XXXXTest.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at junit.framework.TestSuite.createTest(TestSuite.java:131)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Duplicate entry
'c300ba5c-01e8-3727-b305-5dcc9ccae1ee-USER_DESCRIPTION' for key 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)
at
com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1129)
at
com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:681)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1368)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1283)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1268)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at
org.opencms.db.generic.CmsUserDriver.writeUserInfo(CmsUserDriver.java:1910)
... 22 more

My Test case is like Two Application Trying to login into Opencms(Different
JVM ) simultaneously.

public XXXService() {
try {
final XXXXShell cmsShell=new XXXXShell ("TOMCAT_WEB_INF"));
cmsObject = OpenCms.initCmsObject("GUEST_NAME"));
synchronized (cmsObject) {
cmsObject.loginUser("Admin","admin");
cmsObject.getRequestContext().setCurrentProject(cmsObject.readProject(
"PROJECT_NAME"));
path =  "RESOURCE_PATH";
}

} catch (Exception e) {
e.printStackTrace();
}
}

1. XXXXTest     accessing XXXService service = new XXXService();

2. XXXXTest2   accessing XXXService service = new XXXService();

Please help

Regards
Govind R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090520/52b9dea5/attachment.htm>


More information about the opencms-dev mailing list