8 Replies Latest reply on Jan 27, 2003 6:23 PM by bongos

    ejbSelect generates NPE

    sbm5c2j8 Newbie

      ejbSelect method generates NullPointerException. The same logic for finder method appears working OK.

      Environment:
      JBOSS 3.0 (from CVS a few days ago)
      Windows 2000

      in ejb-jar.xml

      <query-method>
      <method-name>ejbSelectValuesBetween</method-name>
      <method-params>
      <method-param>java.lang.Integer</method-param>
      <method-param>java.lang.Integer</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(o)
      FROM TestA1 AS o
      WHERE o.id BETWEEN ?1 AND ?2
      ]]>
      </ejb-ql>


      In EntityBean implementation
      abstract public Collection ejbSelectValuesBetween(Integer id1, Integer id2)
      throws FinderException;

      public void myMethod(...)
      {
      Collection c = ejbSelectValuesBetween(id1, id2)
      ..
      }

      StackTrace:
      2002-01-25 21:32:23,081 ERROR [mytest.entity.TestA1EJB] ejbHomeGetValuesBetwen failed

      java.lang.NullPointerException

      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:103)

      at org.jboss.proxy.compiler.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:89)

      at mytest.entity.TestA1EJB$Proxy.ejbSelectValuesBetween(Unknown Source)

      at mytest.entity.TestA1EJB.ejbHomeGetValuesBetween(Unknown Source)

      at java.lang.reflect.Method.invoke(Native Method)

      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:957)

      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)

      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:221)

      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)

      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)

      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)

      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:158)

      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:55)

      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)

      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)

      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:429)

      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:281)

      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker$HomeProxy.invoke(BaseLocalContainerInvoker.java:432)

      at $Proxy52.getValuesBetween(Unknown Source)

      at myunit.ejb.SimpleTest.testSimple(Unknown Source)

      at java.lang.reflect.Method.invoke(Native Method)

      at org.apache.cactus.AbstractTestCase.runServerTest(AbstractTestCase.java:491)

      at org.apache.cactus.AbstractTestCase.runBareServerTest(AbstractTestCase.java:456)

        • 1. Re: ejbSelect generates NPE
          Jason Carroll Newbie

          It looks like you're trying to call the select method from a home method. If so this currently doesn't work correctly in 3.0alpha (at least as of 1/10/02). Select methods work and home methods work, but you can't call a select method from within the home method. I talked to Dain about it and he said he would fix it. I You can check out the bug report on sourceforge.

          • 2. Re: ejbSelect generates NPE
            sbm5c2j8 Newbie

            Thank you, I was calling ejbSelect from EJB home method.

            • 3. Re: ejbSelect generates NPE
              Jason Carroll Newbie

              Dain closed the bug report last night so you might try getting the latest cvs code and seeing if your stuff works now.

              Dain thanks again for your help.

              • 4. Re: ejbSelect generates NPE
                sbm5c2j8 Newbie

                Thank you for your reply. I tried from CVS today (Jan 31) and now I am getting the following error.
                This worked in the earlier version except NPE from Home method.

                Thanks

                mytest.ear consists of

                META-INF/application.xml
                lib/mylib.jar -> this is utility class
                myentity.jar -> entity beans with CMR
                mytest.jar -> session beans
                mytest.war -> web application

                MANIFEST.MF for myentity.jar and mytest.jar contains
                Manifest-Version: 1.0
                Class-Path: lib/mylib.jar

                +++
                2002-02-01 01:13:18,143 INFO [org.jboss.deployment.MainDeployer] Auto deploying: file:/C:/opt/jboss/deploy/mytest.ear
                2002-02-01 01:13:18,153 DEBUG [org.jboss.system.UnifiedClassLoader] New UCL with url file:/C:/opt/jboss/tmp/deploy/57.mytest.ear
                2002-02-01 01:13:18,153 TRACE [org.jboss.system.ServiceLibraries] Libraries adding UnifiedClassLoader -1486975558 key URL file:/C:/opt/jboss/tmp/deploy/57.mytest.ear
                2002-02-01 01:13:18,153 DEBUG [org.jboss.deployment.MainDeployer] NO DEPLOYER for url file:/C:/opt/jboss/deploy/mytest.ear
                2002-02-01 01:13:18,163 ERROR [org.jboss.deployment.MainDeployer] Error in subDeployment
                java.io.FileNotFoundException: C:\opt\jboss\tmp\deploy\lib\mylib.jar (The system cannot find the path specified)
                at java.io.FileOutputStream.open(Native Method)
                at java.io.FileOutputStream.(Unknown Source)
                at java.io.FileOutputStream.(Unknown Source)
                at java.io.FileOutputStream.(Unknown Source)
                at org.jboss.deployment.MainDeployer.deploySubPackages(MainDeployer.java:578)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:373)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:348)
                at org.jboss.deployment.MainDeployer.scan(MainDeployer.java:254)
                at org.jboss.deployment.MainDeployer.run(MainDeployer.java:238)
                at java.lang.Thread.run(Unknown Source)
                2002-02-01 01:13:18,183 ERROR [org.jboss.deployment.MainDeployer] Could not open the jar file
                org.jboss.deployment.DeploymentException: Could not deploy sub deployment lib/mylib.jar of deployment file:/C:/opt/jboss/deploy/mytest.ear
                at org.jboss.deployment.MainDeployer.deploySubPackages(MainDeployer.java:596)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:373)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:348)
                at org.jboss.deployment.MainDeployer.scan(MainDeployer.java:254)
                at org.jboss.deployment.MainDeployer.run(MainDeployer.java:238)
                at java.lang.Thread.run(Unknown Source)
                2002-02-01 01:13:18,183 ERROR [org.jboss.deployment.MainDeployer] Deployment failed: file:/C:/opt/jboss/deploy/mytest.ear
                org.jboss.deployment.DeploymentException: Could not open jar file file:/C:/opt/jboss/deploy/mytest.ear
                at org.jboss.deployment.MainDeployer.deploySubPackages(MainDeployer.java:604)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:373)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:348)
                at org.jboss.deployment.MainDeployer.scan(MainDeployer.java:254)
                at org.jboss.deployment.MainDeployer.run(MainDeployer.java:238)
                at java.lang.Thread.run(Unknown Source)
                2002-02-01 01:13:18,193 INFO [org.jboss.deployment.MainDeployer] could not delete directory file:/C:/opt/jboss/tmp/deploy/57.mytest.ear restart will delete it
                2002-02-01 01:13:18,193 TRACE [org.jboss.system.ServiceLibraries] removing classloader JBoss UnifiedClassloader: keyURL : file:/C:/opt/jboss/tmp/deploy/57.mytest.ear]

                • 5. Re: ejbSelect generates NPE
                  sbm5c2j8 Newbie

                  It works fine from today's CVS (Feb 4).

                  Thanks.

                  • 6. Re: ejbSelect generates NPE
                    sbm5c2j8 Newbie

                    WOW!!! I didn't realize jbosscmp-jdbc_3_0.dtd was changed. Once I revised jbosscmp-jdbc.xml for the change, all my test case seems working now. Excellent work. Thanks lot.

                    • 7. Re: ejbSelect generates NPE
                      bongos Newbie

                      can you show me what files needs to get from pvcs to fix this problems?

                      • 8. Re: ejbSelect generates NPE
                        bongos Newbie

                        Do you have a bug id? I do not know how to query bug database and figure out what files I need to get to have this bug fixes? Does this fix in 3.0.6, 3.2.0? 4.0?

                        I need to call ejbselect from my home. pls help.