3 Replies Latest reply on Feb 14, 2011 6:15 AM by kniffte

    Problems when deploying @Local-only beans

    kniffte

      Hello,

       

      this post is related to issue https://issues.jboss.org/browse/JBPAPP-1221 . The issue complained about a NPE when deploying a bean with no local, but remote interfaces.

       

      My problem is different:

      I'm deploying a bean, that has one @Local interface only (no remote flavor of any kind). The exact same .ear file can be deployed on my local (not-upgradable) JBoss 4.2.3 installation, but not on another (the target) JBoss 4.2.3 installation.

      The target installation fails with the following error shown below.

       

      Even more surprisingly, deployment of another 3 beans with the exact same set up (implementing one @Local-only interface) succeeds.

       

      Any ideas?

       

      Thanks.

      kniffte

       

      And here's my error message:

       

      java.lang.NullPointerException

      at java.util.Arrays$ArrayList.<init>(Arrays.java:2370)

      at java.util.Arrays.asList(Arrays.java:2356)

      at org.jboss.ejb3.stateless.StatelessClusterProxyFactory.getInterfaces(StatelessClusterProxyFactory.java:98)

      at org.jboss.ejb3.stateless.BaseStatelessProxyFactory.init(BaseStatelessProxyFactory.java:163)

      at org.jboss.ejb3.stateless.BaseStatelessProxyFactory.start(BaseStatelessProxyFactory.java:212)

      at org.jboss.ejb3.stateless.StatelessClusterProxyFactory.start(StatelessClusterProxyFactory.java:159)

      at org.jboss.ejb3.ProxyDeployer.start(ProxyDeployer.java:83)

      at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:157)

      at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:96)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)

      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)

      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)

      at $Proxy0.start(Unknown Source)

      at org.jboss.system.ServiceController.start(ServiceController.java:417)

      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

      at $Proxy57.start(Unknown Source)

      at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)

      at org.jboss.ejb3.Ejb3Deployment.registerEJBContainer(Ejb3Deployment.java:302)

      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:363)

      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:99)

      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)

      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)

      at $Proxy0.start(Unknown Source)

      at org.jboss.system.ServiceController.start(ServiceController.java:417)

      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

      at $Proxy30.start(Unknown Source)

      at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:536)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)

      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)

      at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)

      at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)

      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)

      at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

      at $Proxy31.start(Unknown Source)

      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)

      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)

      at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

      at $Proxy9.deploy(Unknown Source)

      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)

      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:266)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:344)

      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)

      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)

      at $Proxy0.start(Unknown Source)

      at org.jboss.system.ServiceController.start(ServiceController.java:417)

      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

      at $Proxy4.start(Unknown Source)

      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)

      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:618)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

      at $Proxy5.deploy(Unknown Source)

      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)

      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)

      at org.jboss.Main.boot(Main.java:200)

      at org.jboss.Main$1.run(Main.java:513)

      at java.lang.Thread.run(Thread.java:810)

        • 1. Re: Problems when deploying @Local-only beans
          kniffte

          Hello again,

           

          things have evolved a little.

           

          I found out, that the target environment (the one, that produces the error above) is version: 4.3 EAP CP07 running a clustered configuration.

           

          It also turns out, that the bean can be deployed, if it implements a @Remote annotated interface. Surprisingly, this is not needed for any other bean deployed through this .ear / .jar, which are also Stateful / Stateless and @Local (whereas the @Local annotation is not necessarily required for any other interface (not implemented by my failing class) or class.

           

          Does anybody have any clue, why a class -seamingly- needs to implement a @Remote interface, while this is not needed for any other (fairly similar) bean?

           

          BEGIN EDIT

           

          Note: during our evaluation, we added the following META-INF/jboss.xml:

           

          <jboss>

              <enterprise-beans>

                  <session>

                      <ejb-name>package.Bean</ejb-name>

                      <jndi-name>ServiceName/package.Bean/local</jndi-name>

                      <clustered>False</clustered>

                 </session>

                  <session>

                      <ejb-name>package.Bean</ejb-name>

                      <jndi-name>ServiceName/package.Interface/local</jndi-name>

                      <clustered>False</clustered>

                 </session>

              </enterprise-beans>

          </jboss>

           

          Removing this file lead to yet another bean not being able to deploy (one of the beans that were working before). But adding the file (and therefore disabling clustering) only (= no @Remote interface) did not help.

           

          Any clues?

           

          END EDIT

           

          Thanks for your help.

           

          Regards,

           

          kniffte

          • 2. Problems when deploying @Local-only beans
            jaikiran

            To be honest, I am too confused on what the real problem is There are way too many changes/configs that you tried out. Let's just get back to the original issue where you are running into that NPE. Can you explain a bit more about the bean which is failing? Please post the exact code of that bean and if you have a jboss.xml, then please post its contents too.

            • 3. Problems when deploying @Local-only beans
              kniffte

              Hello,

               

              thanks for your answer, I hope the following will make things clearer to you.

               

              1) I have two environments, dev and test:

               

              - dev: JBoss 4.2.3, stand-alone installation

              - test: JBoss 4.3 EAP CP07, clustered installation.

               

              2) I have two versions of my applications, version 0.4.3 and version 0.5.0:

               

              - version 0.4.3: uses Stateless beans only, can be deployed on both systems w/o any trouble

              - version 0.5.0: adds two Stateful and several Stateless beans, can be deployed on dev, but not on test

               

              3) each bean implements its own interface, which are annotated as @Local (no @Remote).

               

              @Local

              public interface BeanAIf {

                  public void test();

              }

               

              @Stateless(name = "package.BeanA")

              public class BeanA implements BeanAIF {

               

                  @EJB

                  private BeanBIf beanB;

                 

                  public void test(){

                      beanB.doSomething();

                  }

              }

               

              @Local

              public interface BeanAIf {

                  public void hello();

              }

               

              @Stateless(name = "package.BeanC")

              public class BeanA implements BeanCIF {

               

                  @EJB

                  private BeanBIf beanB;

                 

                  public void hello(){

                      beanB.doSomething();

                  }

              }

               

              @Local

              public interface BeanBIf {

                  public void doSomething();

              }

               

              @Stateful(name = "package.BeanB")

              public class BeanB implements BeanBIF {

               

                  public void doSomething(){

                  }

              }

               

              ---- the following cares about version 0.5.0 and test environment only, unless stated differently ----

               

              4) deploying the application without any changes, fails with the following NPE (see the original message for the complete stack trace):

               

              java.lang.NullPointerException

              at java.util.Arrays$ArrayList.<init>(Arrays.java:2370)

              at java.util.Arrays.asList(Arrays.java:2356)

              at org.jboss.ejb3.stateless.StatelessClusterProxyFactory.getInterfaces(StatelessClusterProxyFactory.java:98)

              at org.jboss.ejb3.stateless.BaseStatelessProxyFactory.init(BaseStatelessProxyFactory.java:163)

               

              5) we found out, that we had to change BeanA to import two interfaces, one being @Local (as it used to be) and one being @Remote. BeanA is Stateless, but uses the @EJB annotation to get one of the Stateful (@Local) beans injected. We do not have to change any other bean (e.g. BeanC), even if it refers to the exact same Stateful beans, or is Stateful or Stateless ifself.

               

              ...this changed the source to the following:

               

              @Local

              public interface BeanAIf {

                  public void test();

              }

               

              @Remote

              public interface BeanAIfRemote {

                  /* nothing in here */

              }

               

              @Stateless(name = "package.BeanA")

              public class BeanA implements BeanAIF, BeanAIfRemote {

               

                  @EJB

                  private BeanBIf beanB;

                 

                  public void test(){

                      beanB.doSomething();

                  }

              }

               

              6) we also found out, that we have to add the following META-INF/jboss.xml in order to get the application deployed:

               

              <jboss>

                  <enterprise-beans>

                      <session>

                          <ejb-name>application.BeanA</ejb-name>

                          <jndi-name>service/application.BeanA/local</jndi-name>

                          <clustered>False</clustered>

                     </session>

                      <session>

                          <ejb-name>application.BeanA</ejb-name>

                          <jndi-name>service/application.BeanAIf/local</jndi-name>

                          <clustered>False</clustered>

                     </session>

                  </enterprise-beans>

              </jboss>

               

              ... here, we're basically disabling the clustering support for BeanA, but not for any other bean.

               

              Please note, that there is no change to any other bean (e.g. provided example bean BeanC), even if it is (or least seems to be) comparable.

               

              Sorry, I'm not allowed to provide you with the 'real' source, but the source of BeanA, BeanB and BeanC is definitely comparable to the my source here.

               

              7) my questions are now:

              - do I have (in a JBoss environment) to provide an empty @Remote interface, if the application is supposed to run in a clustered environment?

              - why do I have to add an -empty- @Remote interface and configure the jboss.xml to one bean only, even if there are more beans that would qualify for this change?

               

              I hope, I could clarify the problem at hand a little. Please do not hesitate to request any further information you may need.

               

              Thanks.

              kniffte