JPA monitoring with Eclipselink ?

407 views
Skip to first unread message

Tp Chan

unread,
Aug 30, 2016, 5:25:50 AM8/30/16
to javamelody
May I know if whether the monitoring of JPA under EclipseLink is supported by Java Melody ?

I have tried the following in order to monitor JPA with Java Melody 1.58.0

Update persistence.xml:

<persistence-unit name="XXXXXXJpa" transaction-type="JTA">
 <provider>net.bull.javamelody.JpaPersistence</provider>
  <properties>
                        <property name="net.bull.javamelody.jpa.provider" value="org.eclipse.persistence.jpa.PersistenceProvider" />
<property name="eclipselink.target-server" value="JBoss"/>
<property name="eclipselink.logging.logger" value="JavaLogger"/>
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
<property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
<property name="eclipselink.jdbc.batch-writing.size" value="2000"/>
  <property name="eclipselink.session.customizer" value=".....eclipselink.BaseSessionCustomizer"/>
 </properties>


When JBoss EAP 6.3, was started the following errors were reported:

2016-08-30-17:10:47,522 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 48) JBAS011402: Starting Persistence Unit Service 'XXXXXX.ear#XXXXXXJpa'
2016-08-30-17:10:47,834 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-2) JBAS018567: Deployment "deployment.XXXXXX.ear.XXXXXXWeb-0.0.1-SNAPSHOT.war" is using a private module ("com.sun.jsf-impl:main") which may be changed or removed in future versions without notice.
2016-08-30-17:10:49,947 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 49) HCANN000001: Hibernate Commons Annotations {4.0.1.Final-redhat-2}
2016-08-30-17:10:50,047 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 49) HHH000412: Hibernate Core {4.2.14.SP1-redhat-1}
2016-08-30-17:10:50,063 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 49) HHH000206: hibernate.properties not found
2016-08-30-17:10:50,100 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 49) HHH000021: Bytecode provider name : javassist
2016-08-30-17:10:50,622 INFO  [org.hibernate.ejb.Ejb3Configuration] (ServerService Thread Pool -- 48) HHH000204: Processing PersistenceUnitInfo [
name: XXXXXXJpa
...]
2016-08-30-17:10:52,072 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 49) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
2016-08-30-17:10:55,200 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 48) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
2016-08-30-17:10:57,158 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC000001: Failed to start service jboss.persistenceunit."XXXXXX.ear#XXXXXXJpa": org.jboss.msc.service.StartException in service jboss.persistenceunit."XXXXXX.ear#XXXXXXJpa": javax.persistence.PersistenceException: [PersistenceUnit: XXXXXXJpa] Unable to build EntityManagerFactory
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: XXXXXXJpa] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)
at net.bull.javamelody.JpaPersistence.createContainerEntityManagerFactory(JpaPersistence.java:131)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
... 4 more
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: XXXXXX.jpa.model.YYYYY column: TRANSACTION_ID (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:718)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:740)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:493)
at org.hibernate.mapping.RootClass.validate(RootClass.java:270)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1327)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1789)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
... 10 more


It seems that the hibernate provider in JBoss was used instead of eclipseLink.



Tp Chan

unread,
Sep 28, 2016, 5:46:36 AM9/28/16
to javamelody
I finally get the JPA statistics to appear.  Here are the findings.

1) The guessDelegate() function in Javamelody run under JBOSS EAP 6.3 always try to load the hibernate persistenceProvider.  I need to patch the loadOrGuessDelegate() function to force it to load the eclipselink persistenceProvider as the delegate.

2) The application is packaged in an ear.   I placed the javamelody.jar in the root directory of the ear.   But in this way, the application field in the JPACounter is null, thus the javamelody monitoring screens cannot show the JPA statistics for the web application.   Placing the javamelody.jar in the war resolves the problem.

Tp Chan

unread,
Oct 6, 2016, 2:33:00 AM10/6/16
to javamelody
Further test of JPA monitoring with Java Meloday 1.62.  It work flawlessly.

1) Place javamelody.jar and eclipselink.jar  in the \lib of ear file.
2) No need to change persistence.xml any more.

Thanks to the development team!
Reply all
Reply to author
Forward
0 new messages