3 Replies Latest reply on May 6, 2005 4:20 PM by Alireza Hosseini

    EJB CMP with mySQl and JBOSS

    Alireza Hosseini Newbie

      Hi,

      i set up a projekt in Jboss IDE with a servlet accessing a session bean which is calling an entity beans (CMP) findByPk method.

      i think i've done well everthing so far regarding the configuration
      of xdoclet and packaging parameters and data source definition.
      there no problem with deployment and starting jboss via Jboss Eclipse IDE. i'm also able to call my servlets. Even when i try to get a mysql datasource in a servlet and get some data from the DB (without invoking an EJB) there is no problem. So i think the data scource definition in jboss is done well also.

      but each time i try to access to DB via EJB CMP, the container tries to call mySQL-statements to execute the finder method and there apears a nullpointerexception ...

      any idea what i'm doing wrong?

      thanks

      Reza Hosseini

        • 1. Re: EJB CMP with mySQl and JBOSS
          Alireza Hosseini Newbie

          in addition

          i'm using jboss 4.0.1 and mySQLConnector/J 3.1


          thanks

          • 2. Re: EJB CMP with mySQl and JBOSS
            Alireza Hosseini Newbie

            and here is the exception thrown ...

            19:16:33,417 ERROR [Key#findByPrimaryKey] Find failed
            java.lang.NullPointerException
            at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:1845)
            at com.mysql.jdbc.PreparedStatement.toString(PreparedStatement.java:1770)
            at java.lang.String.valueOf(String.java:2131)
            at java.lang.StringBuffer.append(StringBuffer.java:370)
            at com.mysql.jdbc.trace.Tracer.printParameters(Tracer.aj:240)
            at com.mysql.jdbc.trace.Tracer.printEntering(Tracer.aj:167)
            at com.mysql.jdbc.trace.Tracer.entry(Tracer.aj:126)
            at com.mysql.jdbc.trace.Tracer.ajc$before$com_mysql_jdbc_trace_Tracer$1$f51c62b8(Tracer.aj:45)
            at com.mysql.jdbc.Connection.registerStatement(Connection.java)
            at com.mysql.jdbc.Statement.(Statement.java:171)
            at com.mysql.jdbc.PreparedStatement.(PreparedStatement.java:139)
            at com.mysql.jdbc.ServerPreparedStatement.toString(ServerPreparedStatement.java:851)
            at java.lang.String.valueOf(String.java:2131)
            at java.lang.StringBuffer.append(StringBuffer.java:370)
            at com.mysql.jdbc.trace.Tracer.printParameters(Tracer.aj:240)
            at com.mysql.jdbc.trace.Tracer.printEntering(Tracer.aj:167)
            at com.mysql.jdbc.trace.Tracer.entry(Tracer.aj:126)
            at com.mysql.jdbc.trace.Tracer.ajc$before$com_mysql_jdbc_trace_Tracer$1$f51c62b8(Tracer.aj:45)
            at com.mysql.jdbc.Connection.registerStatement(Connection.java)
            at com.mysql.jdbc.Statement.(Statement.java:171)
            at com.mysql.jdbc.PreparedStatement.(PreparedStatement.java:201)
            at com.mysql.jdbc.ServerPreparedStatement.(ServerPreparedStatement.java:133)
            at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1370)
            at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1335)
            at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:355)
            at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:205)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:190)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:128)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.execute(JDBCFindByPrimaryKeyQuery.java:128)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:47)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
            at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:298)
            at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
            at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
            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:324)
            at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
            at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
            at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
            at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:192)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:212)
            at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
            at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:117)
            at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
            at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
            at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:126)
            at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:99)
            at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
            at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
            at org.jboss.ejb.Container.invoke(Container.java:891)
            at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:342)
            at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
            at $Proxy61.findByPrimaryKey(Unknown Source)
            at test.ejb.TestMgrBean.determineKeyWords(TestMgrBean.java:122)
            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:324)
            at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
            at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
            at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
            at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
            at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
            at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
            at org.jboss.ejb.Container.invoke(Container.java:870)
            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:324)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
            at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
            at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
            at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:115)
            at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:101)
            at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
            at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
            at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
            at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
            at $Proxy66.determineKeyWords(Unknown Source)
            at test.servlet.ComputeRiskRating.performTask(ComputeRiskRating.java:85)
            at test.servlet.ComputeRiskRating.doGet(ComputeRiskRating.java:118)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.jboss.web.tomcat.tc5.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:80)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
            at java.lang.Thread.run(Thread.java:534)

            • 3. Re: EJB CMP with mySQl and JBOSS
              Alireza Hosseini Newbie

              i solved the problem by myself ...

              you have to use

              mysql-connector-java-3.1.8-bin.jar

              instead of

              mysql-connector-java-3.1.8-bin-g.jar

              which does not fit ...