openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject Re: How to find cause for PersistenceException?
Date Thu, 10 Jul 2008 22:10:25 GMT
What database are you using?  Be default, OpenJPA maps individual Character
fields to numbers (more efficient).  But, we have changed this default for
DB2, Derby and maybe a couple of other databases.  But, if you are using one
of the other databases (ie. SQL Server), then these Characters are being
processed as numbers.  To see if this is your problem, you could set the
following property:

<property name="openjpa.jdbc.DBDictionary"
value="StoreCharsAsNumbers=false"/>

Kevin

On Wed, Jul 9, 2008 at 6:54 PM, Hiran Chaudhuri <hiran.chaudhuri@web.de>
wrote:

> Hi, Pinaki.
>
> The effect occurred as soon as I used another entity. So here is the full
> stack trace.
> While there is a lot of lines that can be ignored, I want to mention two
> lines almost at the bottom (innermost wrapped exception):
> java.sql.SQLException: Invalid value for getInt() - '-'
> ...
>       at
> org.apache.openjpa.jdbc.sql.DBDictionary.getInt(DBDictionary.java:693)
>       at
> org.apache.openjpa.jdbc.sql.DBDictionary.getChar(DBDictionary.java:595)
> ...
>
> It seems that OpenJPA actually calls getChar but the DBDictionary replaces
> that call with a getInt call.
>
> Hiran
>
>
>
> ------------------------------------------------------------------------------------------------------
> EJB5018: An exception was thrown during an ejb invocation on
> [AdressenFacade]
> javax.ejb.EJBException
>       at
> com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3869)
>       at
> com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3769)
>       at
> com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
>       at
> com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354)
>       at
> com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
>       at
> com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:210)
>       at
> com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
>       at $Proxy575.findAll(Unknown Source)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at
> com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:233)
>       at
> com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
>       at
> com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
>       at
> beans.__AdressenFacadeRemote_Remote_DynamicStub.findAll(beans/__AdressenFacadeRemote_Remote_DynamicStub.java)
>       at
> beans._AdressenFacadeRemote_Wrapper.findAll(beans/_AdressenFacadeRemote_Wrapper.java)
>       at Adressverwaltung.readAdressenList(Adressverwaltung.java:102)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at com.sun.el.parser.AstValue.invoke(AstValue.java:187)
>       at
> com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
>       at
> javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
>       at
> com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
>       at
> com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
>       at javax.faces.component.UICommand.broadcast(UICommand.java:383)
>       at
> javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
>       at
> javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
>       at
> com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
>       at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
>       at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
>       at
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
>       at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
>       at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>       at
> com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:267)
>       at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
>       at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>       at
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
>       at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
>       at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>       at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
>       at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
>       at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
>       at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>       at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
>       at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
>       at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>       at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>       at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>       at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>       at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
>       at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>       at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>       at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>       at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>       at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
>       at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
>       at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
>       at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
>       at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
>       at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
>       at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
>       at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
>       at
> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
> Caused by: <openjpa-1.1.0-r422266:657916 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: Invalid value for
> getInt() - '-'
>       at
> org.apache.openjpa.jdbc.sql.SQLExceptions.narrow(SQLExceptions.java:146)
>       at
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4150)
>       at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
>       at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
>       at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:268)
>       at
> org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
>       at
> org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
>       at
> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:894)
>       at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:852)
>       at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:774)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:811)
>       at
> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:258)
>       at
> org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2228)
>       at
> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:252)
>       at
> org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
>       at
> org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
>       at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1222)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:989)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:804)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:774)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:770)
>       at
> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
>       at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:238)
>       at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
>       at beans.AdressenFacade.findAll(AdressenFacade.java:40)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at
> com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
>       at
> com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
>       at
> com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
>       at
> com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
>       at
> com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
>       ... 62 more
> Caused by: java.sql.SQLException: Invalid value for getInt() - '-'
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
>       at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2631)
>       at
> org.apache.openjpa.lib.jdbc.DelegatingResultSet.getInt(DelegatingResultSet.java:134)
>       at
> org.apache.openjpa.jdbc.sql.DBDictionary.getInt(DBDictionary.java:693)
>       at
> org.apache.openjpa.jdbc.sql.DBDictionary.getChar(DBDictionary.java:595)
>       at
> org.apache.openjpa.jdbc.sql.ResultSetResult.getCharInternal(ResultSetResult.java:300)
>       at
> org.apache.openjpa.jdbc.sql.AbstractResult.getChar(AbstractResult.java:456)
>       at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy.load(PrimitiveFieldStrategy.java:200)
>       at
> org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:796)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:868)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:820)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:342)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:263)
>       ... 91 more
>
>
>
> ----- Original Message ----- From: "Pinaki Poddar" <ppoddar@apache.org>
> To: <users@openjpa.apache.org>
> Sent: Monday, July 07, 2008 3:50 PM
> Subject: Re: How to find cause for PersistenceException?
>
>
>
>
> Please post the entire stack trace.
> PersistenceException often nests the root cause of the error and your
> application needs to recurse through those nested exception to pick the
> root
> cause.
> In this case, the context where the error has been detected is likely to be
> too narrow to provide enough information (whereas in most cases, OpenJPA
> exception provides adequate contextual information) -- but having the
> entire
> stack trace will help.
>
>
>
>
> Hiran Chaudhuri wrote:
>
>>
>> Hi there.
>>
>> On classes generated from a database with Netbeans 6.1 I get such an
>> exception at runtime:
>> <openjpa-1.1.0-r422266:657916 nonfatal general error>
>> org.apache.openjpa.persistence.PersistenceException: Invalid value for
>> getInt() - 'N'
>>
>> Now I can imagine that int is a wrong mapping for the regarding table
>> column and I know which table is accessed - but how do I find out which
>> column this message relates to?
>>
>> Hiran Chaudhuri
>> _______________________________________________________________________
>> Jetzt neu! Sch├╝tzen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage
>> kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220
>>
>>
>>
>>
> --
> View this message in context:
> http://n2.nabble.com/How-to-find-cause-for-PersistenceException--tp221194p363179.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message