Hibernate Profiler is not showing JDBC parameter values for JPA

366 views
Skip to first unread message

Eli Richmond

unread,
Apr 6, 2012, 7:21:05 PM4/6/12
to Hibernate Profiler
I just downloaded the trial version today. I got the Hibernate
Profiler working, but it is not showing the JDBC parameters. I tried

Here are my settings:
java 1.6
Spring 3.1.0.RELEASE
JPA (Hibernate 4.1.0.Final)

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaProperties">
<props>
<prop
key="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</
prop>
<prop key="hibernate.connection.url">jdbc:oracle:thin:@ldap://xx</
prop>
<prop key="hibernate.connection.username">xx</prop>
<prop key="hibernate.connection.password">**</prop>
<prop
key="hibernate.connection.driver_class">net.sf.log4jdbc.hibernateprofiler.jdbc4.DriverSpy</
prop>
<prop
key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<hprof:profiler useSpy="true" />
</bean>

I tried it without the "useSpy="true"" and without the
hibernate.connection.driver_class.

For testing I'm just running a entityManager.find() from a unit test.
The test passes but, I can't see the JDBC parameters. Is there
something I'm missing?
Thanks,
Eli

Eric Hauser

unread,
Apr 9, 2012, 3:48:37 PM4/9/12
to hibernate...@googlegroups.com
Eli,

I assume you are getting output to the profiler for everything except the JDBC parameters?  I don't believe we've ever had anyone use Spring+JPA before.  You might try manually force it to use the spy:

jdbc:log4jdbc:oracle:thin:@ldap://xx

If that doesn't work, can you turn on the internal tracing via a call to:

HibernateProfilerTrace.setTraceEnabled(true);

And send the output from standard out?  You'll need to make this call prior to initializing Spring.

Eli Richmond

unread,
Apr 10, 2012, 2:33:01 PM4/10/12
to hibernate...@googlegroups.com
Hi Eric,
Thank you for getting back to me. The profiler "Details" tab is showing the SQL statement (eg select ... from ... where code=?) but the "Session factory Statistics" and "Param Value" panel on the right are both empty.

I tried adding jdbc:log4jdbc:oracle:thin:@ldap://xx but it generated the following error

Caused by: java.sql.SQLException: No suitable driver found for jdbc:log4jdbc:oracle:thin:@ldap://xx


Here is the output from HibernateProfilerTrace.setTraceEnabled(true);

...
HibernateProfilerTrace:: DEBUG ::: SocketProfileGateway ::: initialize ::: 127.0.0.1 22897
Error accessing statistics
org.hibernate.impl.SessionFactoryObjectFactory
java.lang.ClassNotFoundException: org.hibernate.impl.SessionFactoryObjectFactory
...
at java.lang.Class.forName(Class.java:186)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.initialize(HibernateStatisticsProvider.java:37)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.<init>(HibernateStatisticsProvider.java:31)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.initializeAppenderOnBackground(HibernateProfilerAppender.java:202)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.access$000(HibernateProfilerAppender.java:33)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender$1.run(HibernateProfilerAppender.java:175)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
ERROR ::: ApplicationNameHelper ::: Error accessing request Application Name
null
java.lang.NullPointerException
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:601)
at hibernatingrhinos.hibernate.profiler.appender.ApplicationNameHelper.getApplicationName(ApplicationNameHelper.java:53)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfiler.initialize(HibernateProfiler.java:141)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfiler.initialize(HibernateProfiler.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:601)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
at org.springframework.beans.factory.config.MethodInvokingFactoryBean.doInvoke(MethodInvokingFactoryBean.java:162)
at org.springframework.beans.factory.config.MethodInvokingFactoryBean.afterPropertiesSet(MethodInvokingFactoryBean.java:152)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1355)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:710)
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:519)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:319)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:298)
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:142)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:526)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:495)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:656)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:629)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Error accessing statistics
org.hibernate.impl.SessionFactoryObjectFactory
java.lang.ClassNotFoundException: org.hibernate.impl.SessionFactoryObjectFactory
...
at java.lang.Class.forName(Class.java:186)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.initialize(HibernateStatisticsProvider.java:37)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.getStatistics(HibernateStatisticsProvider.java:82)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.sendStatisticInformation(HibernateProfilerAppender.java:255)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.sendMessagesToProfiler(HibernateProfilerAppender.java:272)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.access$100(HibernateProfilerAppender.java:33)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender$2.run(HibernateProfilerAppender.java:208)
at java.lang.Thread.run(Thread.java:722)
HibernateProfilerTrace:: DEBUG ::: SocketProfilerGateway ::: Writing message to socket ::: hibernatingrhinos.hibernate.profiler.messages.ApplicationAttached@22016455
Hibernate: select ... from ... where CODE=?
Error accessing statistics
org.hibernate.impl.SessionFactoryObjectFactory
java.lang.ClassNotFoundException: org.hibernate.impl.SessionFactoryObjectFactory
...
at java.lang.Class.forName(Class.java:186)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.initialize(HibernateStatisticsProvider.java:37)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.getStatistics(HibernateStatisticsProvider.java:82)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.sendStatisticInformation(HibernateProfilerAppender.java:255)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.sendMessagesToProfiler(HibernateProfilerAppender.java:272)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender.access$100(HibernateProfilerAppender.java:33)
at hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender$2.run(HibernateProfilerAppender.java:208)
at java.lang.Thread.run(Thread.java:722)
HibernateProfilerTrace:: DEBUG ::: SocketProfilerGateway ::: Writing message to socket ::: <LoggingEventInfo><Message><![CDATA[Fetching entity: [ ...

Eric Hauser

unread,
Apr 11, 2012, 3:11:16 PM4/11/12
to hibernate...@googlegroups.com
Thanks for that.  Can you provide me a list of JAR files in your application?  You can leave out your specific JARs.  

Eli Richmond

unread,
Apr 11, 2012, 7:33:58 PM4/11/12
to hibernate...@googlegroups.com
spring-context-3.1.0.RELEASE.jar
spring-aop-3.1.0.RELEASE.jar
aopalliance-1.0.jar
spring-beans-3.1.0.RELEASE.jar
spring-core-3.1.0.RELEASE.jar
spring-expression-3.1.0.RELEASE.jar
spring-asm-3.1.0.RELEASE.jar
spring-webmvc-3.1.0.RELEASE.jar
spring-context-support-3.1.0.RELEASE.jar
spring-web-3.1.0.RELEASE.jar
spring-security-core-3.0.7.RELEASE.jar
spring-tx-3.0.6.RELEASE.jar
aspectjrt-1.6.8.jar
aspectjweaver-1.6.8.jar
spring-security-config-3.0.7.RELEASE.jar
spring-security-cas-client-3.0.7.RELEASE.jar
spring-security-web-3.0.7.RELEASE.jar
cas-client-core-3.1.10.jar
commons-logging-1.1.jar
spring-security-taglibs-3.1.0.RELEASE.jar
spring-security-acl-3.1.0.RELEASE.jar
spring-jdbc-3.0.6.RELEASE.jar
spring-test-3.1.0.RELEASE.jar
spring-test-mvc-1.0.0.BUILD-20120410.153449-47.jar
hamcrest-library-1.2.1.jar
hamcrest-core-1.2.1.jar
spring-data-jpa-1.0.3.RELEASE.jar
spring-data-commons-core-1.1.0.RELEASE.jar
spring-orm-3.0.5.RELEASE.jar
ojdbc6-11.2.0.3.jar
hibernate-entitymanager-4.1.0.Final.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
dom4j-1.6.1.jar
xml-apis-1.0.b2.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
jboss-logging-3.1.0.CR2.jar
hibernate-core-4.1.0.Final.jar
commons-collections-3.2.1.jar
antlr-2.7.7.jar
javassist-3.15.0-GA.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-c3p0-4.1.0.Final.jar
c3p0-0.9.1.jar
hibernate-envers-4.1.0.Final.jar
querydsl-apt-2.3.3.jar
commons-io-2.1.jar
querydsl-core-2.3.3.jar
collections-generic-4.01.jar
codegen-0.4.9.jar
mysema-commons-lang-0.2.2.jar
jsr305-1.3.2.jar
querydsl-jpa-2.3.3.jar
p6spy-1.3.jar
slf4j-api-1.6.2.jar
jcl-over-slf4j-1.6.2.jar
slf4j-log4j12-1.6.2.jar
log4j-1.2.15.jar
javax.inject-1.jar
servlet-api-2.5.jar
jsp-api-2.2.jar
jstl-1.2.jar
tiles-jsp-2.2.2.jar
tiles-servlet-2.2.2.jar
tiles-core-2.2.2.jar
commons-digester-2.0.jar
commons-beanutils-1.8.0.jar
tiles-template-2.2.2.jar
tiles-api-2.2.2.jar
jackson-jaxrs-1.9.5.jar
jackson-core-asl-1.9.5.jar
jackson-mapper-asl-1.9.5.jar
junit-4.7.jar
mockito-all-1.9.0.jar
hamcrest-all-1.1.jar
json-path-0.5.6.jar
json-smart-1.0.9-1.jar
commons-lang-2.5.jar
guava-10.0.1.jar
jsr305-1.3.9.jar
commons-lang3-3.1.jar
cglib-2.2.2.jar
asm-3.3.1.jar
joda-time-2.0.jar
joda-time-jsptags-1.1.1.jar
usertype.core-3.0.0.CR1.jar
joda-money-0.6.jar
usertype.spi-3.0.0.CR1.jar

Eric Hauser

unread,
Apr 11, 2012, 9:30:09 PM4/11/12
to hibernate...@googlegroups.com
Eli,

I'm working on a getting a build put together for you.  You're using Hibernate 4, which is why the SessionFactory issue is happening.  I'm still looking into the JDBC parameters issue.  Just to make sure - you are using Java 6 correct?

Eli Richmond

unread,
Apr 11, 2012, 9:36:06 PM4/11/12
to hibernate...@googlegroups.com

Yes. Should I try 7?

Eric Hauser

unread,
Apr 11, 2012, 9:38:54 PM4/11/12
to hibernate...@googlegroups.com
No, Java 6 is just fine.  It doesn't work with Java 5 which is why I asked.

Daniel Tabuenca

unread,
Apr 20, 2012, 10:13:55 PM4/20/12
to hibernate...@googlegroups.com
Is there any update on hibernate 4 support? Is a custom build necessary will this be part of the standard download?

Oren Eini (Ayende Rahien)

unread,
Apr 21, 2012, 4:19:43 AM4/21/12
to hibernate...@googlegroups.com, Eric Hauser
No, it will be part of the std download.

Ananthababu A

unread,
Aug 20, 2012, 2:40:47 AM8/20/12
to hibernate...@googlegroups.com
can anyone help me to install hibernate profiler, because if i install hibernate profiler, it says failed to initialize application.

Oren Eini (Ayende Rahien)

unread,
Aug 20, 2012, 5:40:41 AM8/20/12
to hibernate...@googlegroups.com
What is the full error?

Oren Eini (Ayende Rahien)

unread,
Aug 20, 2012, 5:40:55 AM8/20/12
to hibernate...@googlegroups.com
What steps did you take? What is your environment?
Reply all
Reply to author
Forward
0 new messages