It's not a secret anymore!
The moose likes Object Relational Mapping and the fly likes Getting strange message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Getting strange message" Watch "Getting strange message" New topic

Getting strange message

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1130
I have Hibernate code that works fine to get a user's data 'by property' (property=user login), but when trying to run it on the server, it crashes on the line:

List userList = dao.findByUsrLogin(userLogin);

The error is really strange (again since the same code is running locally in the dev environment fine -- same DB, etc.).

The userLogin value in the actual Dao class is correct...a regular String like: "test1234".

Any ideas why this might be happening?

I tried other methods to for the dao, but they didn't work either on the server. Looks like all the start up code is working fine (the getSession() method call generates lots of code, but no errors).

Thanks in advance for any suggestions.


SEVERE: find by property name failed
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
at org.hibernate.exception.SQLStateConverter.convert(
at org.hibernate.exception.JDBCExceptionHelper.convert(
at org.hibernate.loader.Loader.doList(
at org.hibernate.loader.Loader.listIgnoreQueryCache(
at org.hibernate.loader.Loader.list(
at org.hibernate.loader.hql.QueryLoader.list(
at org.hibernate.hql.ast.QueryTranslatorImpl.list(
at org.hibernate.engine.query.HQLQueryPlan.performList(
at org.hibernate.impl.SessionImpl.list(
at org.hibernate.impl.QueryImpl.list(
at TestProject.UsersDAO.findByProperty(
at TestProject.UsersDAO.findByUsrLogin(
at TestProject.ValidateLogin.validate(
at org.apache.jsp.login_jsp._jspService(org.apache.jsp.login_jsp:121)
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(
at org.apache.tomcat.util.threads.ThreadPool$
Caused by: java.sql.SQLException: Value '<little square box>'is out of range [-127,127]
at com.mysql.jdbc.ResultSet.getByteFromString(
at com.mysql.jdbc.ResultSet.getNativeByte(
at com.mysql.jdbc.ResultSet.getByte(
at com.mysql.jdbc.ResultSet.getByte(
at org.hibernate.type.ByteType.get(
at org.hibernate.type.NullableType.nullSafeGet(
at org.hibernate.type.NullableType.nullSafeGet(
at org.hibernate.type.AbstractType.hydrate(
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(
at org.hibernate.loader.Loader.loadFromResultSet(
at org.hibernate.loader.Loader.instanceNotYetLoaded(
at org.hibernate.loader.Loader.getRow(
at org.hibernate.loader.Loader.getRowFromResultSet(
at org.hibernate.loader.Loader.doQuery(
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
at org.hibernate.loader.Loader.doList(
... 31 more
Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
The root cause exception make it look like a database encoding issues.

Caused by: java.sql.SQLException: Value '<little square box>'is out of range [-127,127]

Looks like trying to pass unicode or similar to a database configured for ASCII/C/etc
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1130
Sounds reasonable, except that when I run this code within MyEclipse, it runs fine (I get back a Users object all populated in the List).

If I run the code in the browser, than I get the crash doing the query on the Dao call.

Same DB on the same local machine in both cases.

To run the code, I put all the JAR files from the latest version of Hibernate into my lib folder for the Tomcat project (that is, WEB-INF/lib).

This is strange...

Any other thoughts would be helpful.


Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1130
Found the problem!

The difference was the MyEclipse was using version 5+ of the JDBC driver and my Tomcat COMMON/lib folder only had mysql-connector-java-3.1.11-bin.jar.

I updated Tomcat to the latest JDBC driver and everything worked fine.


Thanks again.

I agree. Here's the link:
subject: Getting strange message
jQuery in Action, 3rd edition