No Param Values shown, only '?'

60 views
Skip to first unread message

wabrit

unread,
Jan 4, 2013, 8:38:32 AM1/4/13
to hibernate...@googlegroups.com
Hi 

I'm running a trial of the Hibernate Profiler locally against my Java 1.6 Spring 3 web app running in Tomcat 7 against MS SQL 2008. 

I've followed the instructions in the getting started guide:

  • called HibernateProfiler.initialize() from my code
  • registered hibernatingrhinos.hibernate.profiler.web.HibernateProfilerListener as a listener in web.xml
  • declared <prop key="hibernate.generate_statistics">true</prop> in applicationContext.xml
  • Declared  <hprof:profiler/> in my session factory bean.
  • copied hibernate-profiler-1.0.jar to %TOMCAT_HOME%\lib
  • In the Hibernate Profiler, I've set the connection string to: Server=localhost;Database=myDB;User Id=myLogin;Password=myPassword;
 
However I'm running into a few problems when I open up the profiler:

  1. I can see the SQL statements rolling past in the session activity window
  2. I can't see any parameter values in the statements, just '?'. The Details pane doesn't show the parameter values either.
  3. In the Session Factory Statistics pane I see the message "Did you forget to enable statistics?".
  4. There is no information displayed in the RowCount or Duration columns of the session activity window.
  5. Attempting to use the "See row(s) resulting from this statement" or "Query plan from this statement" doesn't work. The profiler logs report
2013-01-04 13:16:00,841 [7] ERROR HibernatingRhinos.Profiler.Client.Services.QueryPlan.QueryPlanService [(null)] - Could not get query plan
System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near '?'.

It feels like it's almost there, but the lack of parameter values is stopping stuff from working. (I tried setting the jdbc class and URL explicitly to pick up the jdbc DriverSpy,
but that made no difference and my understanding was that I shouldn't need to do that in a Java 6 environment anyway).

Any suggestions or help gratefully received.

Thanks

Alan

Oren Eini (Ayende Rahien)

unread,
Jan 4, 2013, 8:46:14 AM1/4/13
to hibernate-profiler
Did you see the docs here?

In particular:


 <prop key="hibernate.connection.url">jdbc:log4jdbc:sqlserver://localhost;instanceName=SQLExpress;user=sa;password=pass</prop>

wabrit

unread,
Jan 4, 2013, 9:00:17 AM1/4/13
to hibernate...@googlegroups.com
Hi Ayende

Thanks for your reply; yes I did see that and modified my JDBC connection URL (and driver class) accordingly, but it made no difference. Not seeing
any other errors in the logs either.

Alan

P.S. For me, it wasn't quite clear from the gettingstarted page exactly how many things needed to be done explicitly if your app was Spring-based;
my assumption was that the section entitled "Hibernate" only applied when Spring was not being used.

The guide also says

To manually configure the driver spy, you need to modify your connection URL (this is done by both the programmatic configure method and Spring automatically) by appending 'jdbc:log4jdbc' to the front of your JDBC URL.  

which implies to me that if you're calling HibernateProfiler.initialize() from code and using Spring, you don't need to manually append the connection URL.

Oren Eini (Ayende Rahien)

unread,
Jan 4, 2013, 9:20:00 AM1/4/13
to hibernate-profiler, Tomasz Pik, Eric Hauser
The best scenario is you calling HibernateProfiler.initialize() , which does all the setup, yes.
There are some things that require special config, but HibernateProfiler.initialize()  should take care of most of them.

Tomas, Eric, 
Can you help Warbit with this issue?

wabrit

unread,
Jan 18, 2013, 11:01:19 AM1/18/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser
I'd really appreciate any further hints or assistance you can throw me folks - I've reached a dead-end evaluation wise here.

Thanks

Alan

Eric Hauser

unread,
Jan 18, 2013, 4:13:13 PM1/18/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser
Alan,

The easiest way for me to see what is going on is to set the following line prior to calling HibernateProfiler.initialize() -- HibernateProfilerTrace.setTraceEnabled(true).  This should output a bunch of tracing information to standard out and would help me assist you further.

Thanks.

wabrit

unread,
Jan 21, 2013, 4:08:57 AM1/21/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser
Hi Eric

Switched on the tracing and the first error that comes up is:

Error accessing statistics
org.hibernate.impl.SessionFactoryObjectFactory
java.lang.ClassNotFoundException: org.hibernate.impl.SessionFactoryObjectFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at hibernatingrhinos.hibernate.profiler.appender.HibernateStatisticsProvider.initialize(HibernateStatisticsProvider.java:37)

This looks like the profiler is expecting a Hibernate 3 environment, but I'm using Hibernate 4. 

Alan

Fitzchak Yitzchaki

unread,
Jan 21, 2013, 4:42:05 AM1/21/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser

wabrit

unread,
Jan 21, 2013, 11:35:01 AM1/21/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser
Hi Fitzchak, Eric

I was using build 2108 (I think this was selected automatically when I first installed from the website, but can't be sure). Anyway I have now installed
build 2116, which has the hibernate4-profiler-1.1.jar and that has cleared up the ClassNotFoundException.

However I'm still not getting JDBC query parameter values displayed in the output, nor do the "Query Plan / See the rows resulting from this statement"
options give anything but a blank screen.

I've switched on profiler tracing and it's generating lots of output. Is there anything I should be looking for to help pinpoint the problem?

Thanks

Alan

Oren Eini (Ayende Rahien)

unread,
Jan 22, 2013, 3:18:26 AM1/22/13
to hibernate-profiler, Tomasz Pik, Eric Hauser
Can you send us the tracing data?

wabrit

unread,
Jan 22, 2013, 3:39:46 AM1/22/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser
Absolutely - to where should I send it?

Thanks

Alan

Fitzchak Yitzchaki

unread,
Jan 23, 2013, 3:25:13 AM1/23/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser

wabrit

unread,
Jan 23, 2013, 4:39:10 AM1/23/13
to hibernate...@googlegroups.com, Tomasz Pik, Eric Hauser
Thanks - just sent the zipped up logfile there.
Reply all
Reply to author
Forward
0 new messages