Bug #57503 | JpaCluster on Glassfish using persistence.xml: Can not connect to 192.168.56.101 | ||
---|---|---|---|
Submitted: | 17 Oct 2010 12:53 | Modified: | 19 Aug 2013 19:16 |
Reporter: | Nicolas Seyvet | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Cluster: Cluster/J | Severity: | S3 (Non-critical) |
Version: | mysql-5.1-telco-7.1 | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | OpenJPA Cluster mysql-cluster 7.1.8 |
[17 Oct 2010 12:53]
Nicolas Seyvet
[17 Oct 2010 12:54]
Nicolas Seyvet
glassfish logs
Attachment: server_2.rar (application/octet-stream, text), 20.70 KiB.
[17 Oct 2010 12:56]
Nicolas Seyvet
Some comments on my setup: - Main machine using windows 7 64 bits running Glassfish - Virtual machine running Ubuntu Maverick 32 bits + Mysql cluster
[17 Oct 2010 17:00]
Nicolas Seyvet
Tried the exact same thing but with everything collocated on windows and I seem to get a link towards the DB: Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Can't create table 'bm.bigcompany' (errno: 157) {stmnt 202688481 CREATE TABLE BIGCOMPANY (id BIGINT NOT NULL AUTO_INCREMENT, name VARCHAR(255), PRIMARY KEY (id)) TYPE = ndbcluster} [code=1005, state=HY000] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:57) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762) at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114) at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1191) at org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:949) at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:526) at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344) at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321) at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501) ... 82 more It is still not good but at least it appears to connect to the NDB API. So there is some sort of bug going to an external NDB API (not localhost)?
[17 Oct 2010 18:20]
Nicolas Seyvet
OK this is not the right place to put this. I should have logged it in the forums. Sorry /Nicolas
[17 Oct 2010 20:55]
Nicolas Seyvet
OK did some additional tests using my LINUX VM only. I do think there is a bug. Using the exact same configuration for GlassFish (except that when setting the connection pool I use localhost, and the following persistence.xml: <persistence-unit name="BM" transaction-type="JTA"> <provider> org.apache.openjpa.persistence.PersistenceProviderImpl </provider> <jta-data-source>jdbc/bm</jta-data-source> <class>persist.BigCompany</class> <class>persist.SmallEmployee</class> <properties> <property name="openjpa.BrokerFactory" value="ndb"/> <property name="openjpa.ndb.connectString" value="localhost:1186"/> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add')"/> <!--property name="openjpa.jdbc.DBDictionary" value="mysql(DriverVendor=mysql)"/--> <property name="openjpa.jdbc.DBDictionary" value="TableType=ndbcluster" /> <property name="openjpa.ConnectionRetainMode" value="transaction"/> <property name="openjpa.ndb.database" value="bm"/> <property name="openjpa.ndb.connectVerbose" value="1"/> <property name="openjpa.DataCache" value="false"/> <property name="openjpa.ConnectionPassword" value=""/--> </properties> </persistence-unit> Then I get this error Caused by: <openjpa-1.2.2-r422266:898935 fatal general error> org.apache.openjpa.persistence.PersistenceException: This operation failed for some instances. See the nested exceptions array for details. at org.apache.openjpa.kernel.BrokerImpl.throwNestedExceptions(BrokerImpl.java:2375) at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2069) at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1927) at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1698) at org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:524) at org.apache.openjpa.kernel.StateManagerImpl.assignField(StateManagerImpl.java:609) at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1495) at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1478) at persist.BigCompany.pcGetid(BigCompany.java) at persist.BigCompany.getId(BigCompany.java:51) at loader.MyLoader.createCompany(MyLoader.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011) at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2929) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4020) at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:190) ... 63 more Caused by: <openjpa-1.2.2-r422266:898935 fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred. at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2187) at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2029) ... 81 more Caused by: com.mysql.clusterj.ClusterJException: Error executing getInsertOperation on table SMALLEMPLOYEE. Caused by java.lang.RuntimeException:NdbOpenJPADomainTypeHandlerImpl.operationSetNonPKValues caught exception at com.mysql.clusterj.core.SessionImpl.insert(SessionImpl.java:291) at com.mysql.clusterj.openjpa.NdbOpenJPAStoreManager.flush(NdbOpenJPAStoreManager.java:367) at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130) ... 82 more Caused by: java.lang.RuntimeException: NdbOpenJPADomainTypeHandlerImpl.operationSetNonPKValues caught exception at com.mysql.clusterj.openjpa.NdbOpenJPADomainTypeHandlerImpl.operationSetNonPKValues(NdbOpenJPADomainTypeHandlerImpl.java:713) at com.mysql.clusterj.core.SessionImpl.insert(SessionImpl.java:277) ... 84 more Caused by: java.lang.NullPointerException at com.mysql.clusterj.openjpa.NdbOpenJPADomainFieldHandlerImpl$ObjectOperationHandlerRelationField.getLong(NdbOpenJPADomainFieldHandlerImpl.java:894) at com.mysql.clusterj.openjpa.NdbOpenJPADomainFieldHandlerImpl$5.operationSetValue(NdbOpenJPADomainFieldHandlerImpl.java:1000) at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.operationSetValue(AbstractDomainFieldHandlerImpl.java:299) at com.mysql.clusterj.openjpa.NdbOpenJPADomainTypeHandlerImpl.operationSetNonPKValues(NdbOpenJPADomainTypeHandlerImpl.java:708) ... 85 more |#] Both tables are created though... The entities are defined as such: @Entity @Table(name="SMALLEMPLOYEE") public class SmallEmployee implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id = null; private String name = null; @ManyToOne @JoinColumn(name = "COMP_ID", nullable = false) private BigCompany company = null; public SmallEmployee() { } // getter and setters // [...] } And the BigCompany @Entity @Table(name="BIGCOMPANY") public class BigCompany implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id = null; private String name = null; @OneToMany(cascade = CascadeType.ALL, mappedBy = "company", fetch = FetchType.EAGER) private Set<SmallEmployee> employees = new HashSet<SmallEmployee>(); public BigCompany() { } // getter and setters // [...] } It seems there is one problem in how the different parameters are exchanged between the persistence.xml and the connection pool setup (data source) in glassfish. Additionally, there might be a problem with the @GeneratedValue(strategy = GenerationType.IDENTITY)... As this works fine without NDB.
[23 Jul 2013 18:45]
Sveta Smirnova
Thank you for the report. Can you repeat same issue without Sailfin 2?
[14 Aug 2013 16:57]
Nicolas Seyvet
Not using GlassFish anymore... No environment to reproduce.
[19 Aug 2013 19:16]
Sveta Smirnova
Thank you for the feedback. Closed as "Can't repeat" according to last comment. Although I asked to repeat *without* Glassfish.