java - Hibernate UserType working in a testapplication but not on web service on tomcat -


i have set web service using hibernate 4.2.8 running on tomcat 7.0.41. use postgres 9.2 database it.

i created hibernate usertype use point datatype provided postgres. first tried small demo application test , play around with, working fine far.

when tried code on web service, reported following error when trying insert row custom type:

error (2014-03-10 15:58:49,226) der in sql für eine instanz von org.postgresql.geometric.pgpoint zu verwendende datentyp kann nicht abgeleitet werden. benutzen sie 'setobject()' mit einem expliziten typ, um ihn festzulegen. [sqlexceptionhelper.java:147]     org.hibernate.exception.sqlgrammarexception: not insert: [com.zhs.dbaccess.tableclasses.zhsjunk]     @ org.hibernate.exception.internal.sqlstateconversiondelegate.convert(sqlstateconversiondelegate.java:123)     @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:49)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:125)     @ org.hibernate.persister.entity.abstractentitypersister.insert(abstractentitypersister.java:3099)     @ org.hibernate.persister.entity.abstractentitypersister.insert(abstractentitypersister.java:3521)     @ org.hibernate.action.internal.entityinsertaction.execute(entityinsertaction.java:88)     @ org.hibernate.engine.spi.actionqueue.execute(actionqueue.java:393)     @ org.hibernate.engine.spi.actionqueue.executeactions(actionqueue.java:385)     @ org.hibernate.engine.spi.actionqueue.executeactions(actionqueue.java:301)     @ org.hibernate.event.internal.abstractflushingeventlistener.performexecutions(abstractflushingeventlistener.java:349)     @ org.hibernate.event.internal.defaultflusheventlistener.onflush(defaultflusheventlistener.java:56)     @ org.hibernate.internal.sessionimpl.flush(sessionimpl.java:1159)     @ org.hibernate.internal.sessionimpl.managedflush(sessionimpl.java:404)     @ org.hibernate.engine.transaction.internal.jdbc.jdbctransaction.beforetransactioncommit(jdbctransaction.java:101)     @ org.hibernate.engine.transaction.spi.abstracttransactionimpl.commit(abstracttransactionimpl.java:175)     @ com.zhs.servicebase.clienthandling.clientrequesthandler.inserttaps(clientrequesthandler.java:609)     @ com.zhs.zhsservice.zhsservice.tap(zhsservice.java:69)     @ org.apache.jsp.test.requestresult_jsp._jspservice(requestresult_jsp.java:391)     @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70)     @ javax.servlet.http.httpservlet.service(httpservlet.java:728)     @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432)     @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390)     @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334)     @ javax.servlet.http.httpservlet.service(httpservlet.java:728)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:305)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.netbeans.modules.web.monitor.server.monitorfilter.dofilter(monitorfilter.java:393)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:243)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:222)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:123)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:472)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:99)     @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:953)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408)     @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1023)     @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:589)     @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.run(aprendpoint.java:1852)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:722) caused by: org.postgresql.util.psqlexception: der in sql für eine instanz von org.postgresql.geometric.pgpoint zu verwendende datentyp kann nicht abgeleitet werden. benutzen sie 'setobject()' mit einem expliziten typ, um ihn festzulegen.     @ org.postgresql.jdbc2.abstractjdbc2statement.setobject(abstractjdbc2statement.java:1914)     @ org.postgresql.jdbc3g.abstractjdbc3gstatement.setobject(abstractjdbc3gstatement.java:36)     @ org.postgresql.jdbc4.abstractjdbc4statement.setobject(abstractjdbc4statement.java:47)     @ org.apache.tomcat.dbcp.dbcp.delegatingpreparedstatement.setobject(delegatingpreparedstatement.java:169)     @ org.apache.tomcat.dbcp.dbcp.delegatingpreparedstatement.setobject(delegatingpreparedstatement.java:169)     @ com.zhs.dbaccess.pgtypes.pointusertype.nullsafeset(pointusertype.java:281)     @ org.hibernate.type.customtype.nullsafeset(customtype.java:158)     @ org.hibernate.persister.entity.abstractentitypersister.dehydrate(abstractentitypersister.java:2798)     @ org.hibernate.persister.entity.abstractentitypersister.insert(abstractentitypersister.java:3076)     ... 39 more 

i using same dbs different database, both set utf-8 character encoding

since hibernate connected db through jndi ressource provided tomcat, thought maybe tomcat breaking insert statement. removed jndi ressource , connected db directly, following result:

org.hibernate.exception.dataexception: not execute statement     @ org.hibernate.exception.internal.sqlstateconversiondelegate.convert(sqlstateconversiondelegate.java:135)     @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:49)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:125)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:110)     @ org.hibernate.engine.jdbc.internal.resultsetreturnimpl.executeupdate(resultsetreturnimpl.java:189)     @ org.hibernate.engine.jdbc.batch.internal.nonbatchingbatch.addtobatch(nonbatchingbatch.java:58)     @ org.hibernate.persister.entity.abstractentitypersister.insert(abstractentitypersister.java:3079)     @ org.hibernate.persister.entity.abstractentitypersister.insert(abstractentitypersister.java:3521)     @ org.hibernate.action.internal.entityinsertaction.execute(entityinsertaction.java:88)     @ org.hibernate.engine.spi.actionqueue.execute(actionqueue.java:393)     @ org.hibernate.engine.spi.actionqueue.executeactions(actionqueue.java:385)     @ org.hibernate.engine.spi.actionqueue.executeactions(actionqueue.java:301)     @ org.hibernate.event.internal.abstractflushingeventlistener.performexecutions(abstractflushingeventlistener.java:349)     @ org.hibernate.event.internal.defaultflusheventlistener.onflush(defaultflusheventlistener.java:56)     @ org.hibernate.internal.sessionimpl.flush(sessionimpl.java:1159)     @ org.hibernate.internal.sessionimpl.managedflush(sessionimpl.java:404)     @ org.hibernate.engine.transaction.internal.jdbc.jdbctransaction.beforetransactioncommit(jdbctransaction.java:101)     @ org.hibernate.engine.transaction.spi.abstracttransactionimpl.commit(abstracttransactionimpl.java:175)     @ com.zhs.servicebase.clienthandling.clientrequesthandler.inserttaps(clientrequesthandler.java:609)     @ com.zhs.zhsservice.zhsservice.tap(zhsservice.java:69)     @ org.apache.jsp.test.requestresult_jsp._jspservice(requestresult_jsp.java:391)     @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70)     @ javax.servlet.http.httpservlet.service(httpservlet.java:728)     @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432)     @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390)     @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334)     @ javax.servlet.http.httpservlet.service(httpservlet.java:728)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:305)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.netbeans.modules.web.monitor.server.monitorfilter.dofilter(monitorfilter.java:393)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:243)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:222)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:123)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:472)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:99)     @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:953)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408)     @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1023)     @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:589)     @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.run(aprendpoint.java:1852)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:722) caused by: org.postgresql.util.psqlexception: error: invalid byte sequence encoding "utf8": 0x00     @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2161)     @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:1890)     @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:255)     @ org.postgresql.jdbc2.abstractjdbc2statement.execute(abstractjdbc2statement.java:559)     @ org.postgresql.jdbc2.abstractjdbc2statement.executewithflags(abstractjdbc2statement.java:417)     @ org.postgresql.jdbc2.abstractjdbc2statement.executeupdate(abstractjdbc2statement.java:363)     @ org.hibernate.engine.jdbc.internal.resultsetreturnimpl.executeupdate(resultsetreturnimpl.java:186)     ... 41 more 

does know might cause this? since error changes when reconfiguring db connection, guess might have tomcat messing it.

ok, switched tomcat 8.03 , first error gone, realiszed somehow had values in sql null, that's second error. null values should have been handled db, somehow didn't.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -