9 Replies Latest reply on Sep 21, 2011 10:56 AM by Sam W

    Error with running EJB3 + WAR example in AS7

    Sam W Expert

      Hi,

       

      I downloaded an ejb3 example and deployed to AS7 successfully.

      When I navigate to the page and hit the Submit button, it throws the following error:

       

       

      13:33:17,617 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "example.ear"

      13:33:17,737 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "example.jar"

      13:33:17,737 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "example.war"

      13:33:17,799 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to example.ear

      13:33:17,800 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to example.war

      13:33:17,800 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) added javax.persistence.api dependency to example.jar

      13:33:17,836 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named CalculatorBean in deployment unit subdeployment "example.jar" of deployment "example.ear" are as follows:

       

       

              java:global/example/example.jar/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

              java:app/example.jar/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

              java:module/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

              java:global/example/example.jar/CalculatorBean

              java:app/example.jar/CalculatorBean

              java:module/CalculatorBean

       

       

      13:33:17,836 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CalculatorBean in deployment unit subdeployment "example.war" of deployment "example.ear" are as follows:

       

       

              java:global/example/example.war/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

              java:app/example.war/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

              java:module/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

              java:global/example/example.war/CalculatorBean

              java:app/example.war/CalculatorBean

              java:module/CalculatorBean

       

       

      13:33:18,061 WARN  [org.jboss.as.ejb3.timerservice.mk2.TimerServiceFactoryImpl] (MSC service thread 1-2) Unregistered an already registered Timerservice with id CalculatorBean and a new instance will be registered

      13:33:18,141 INFO  [org.jboss.web] (MSC service thread 1-2) registering web context: /example

      13:33:18,189 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "example.ear"

      13:34:32,207 INFO  [stdout] (http-sam-PC-10.166.111.247-8080-1) Error:example/CalculatorBean/remote -- service jboss.naming.context.java.example.CalculatorBean.remote

      13:34:32,209 INFO  [stdout] (http-sam-PC-10.166.111.247-8080-1) div

      13:34:32,209 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1) java.lang.NullPointerException

      13:34:32,209 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.jsp.ejb3.WebClient_jsp._jspService(WebClient_jsp.java:114)

      13:34:32,209 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

      13:34:32,209 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      13:34:32,210 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

      13:34:32,210 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)

      13:34:32,210 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)

      13:34:32,210 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      13:34:32,210 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      13:34:32,210 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      13:34:32,211 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      13:34:32,212 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)

      13:34:32,212 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      13:34:32,212 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)

      13:34:32,212 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)

      13:34:32,212 ERROR [stderr] (http-sam-PC-10.166.111.247-8080-1)         at java.lang.Thread.run(Thread.java:662)

       

       

      PLease refer to attached EAR file for details.

       

      Thanks

      Sam

        • 1. Re: Error with running EJB3 + WAR example in AS7
          robert.geisler Newbie

          hi sam,

           

          i dont know much about JSP, so my considerations may be wrong O: )

           

          1) why did you pack your CalculatorBean into an ejb-module AND into the web-module? i guess its enough to deploy it in the ejb-module. you may use it within your web-module through its business interface (remote or even local).
          your log says that there is a conflict, because you are deploying this EJB twice. i guess, you cant deploy multiple EJBs with the same names ; )

           

          2) your WebClient.jsp does a JNDI lookup on "example/CalculatorBean/remote". as far as i know, JBoss 7.0.1 does not support remote business interfaces yet. so try to configure a local business interface und look it up from your JSP: "java:global/example/example/Calculator!com.javajazzup.examples.ejb3.stateless.CalculatorLocal" (java:global/[name of ear]/[name of ejb-module]/[name of bean]![qualified classname of the local business interface]).

           

          please let me know if this helps.

           

          greets

          robert

          • 2. Re: Error with running EJB3 + WAR example in AS7
            Sam W Expert

            Hi, Thank you for the suggestion.

            After followed your suggestion, I created another simple EAR project, consist of ejb and war modules.

            The war module calls an ejb3 bean from EAR module. But it thrown the following exception:

             

             

            21:20:18,901 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "EARCalculator-ear.ear"

            21:20:19,010 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "EARCalculator-ejb.jar"

            21:20:19,010 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "EARCalculator-web.war"

            21:20:19,798 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to EARCalculator-ear.ear

            21:20:19,799 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) added javax.persistence.api dependency to EARCalculator-ejb.jar

            21:20:19,799 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to EARCalculator-web.war

            21:20:19,858 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named CalculatorBean in deployment unit subdeployment "EARCalculator-ejb.jar" of deployment "EARCalculator-ear.ear" are as follows:

             

             

                    java:global/EARCalculator-ear/EARCalculator-ejb/CalculatorBean!ix.calculator.CalculatorLocal

                    java:app/EARCalculator-ejb/CalculatorBean!ix.calculator.CalculatorLocal

                    java:module/CalculatorBean!ix.calculator.CalculatorLocal

                    java:global/EARCalculator-ear/EARCalculator-ejb/CalculatorBean

                    java:app/EARCalculator-ejb/CalculatorBean

                    java:module/CalculatorBean

             

             

            21:20:19,858 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named CallerBean in deployment unit subdeployment "EARCalculator-ejb.jar" of deployment "EARCalculator-ear.ear" are as follows:

             

             

                    java:global/EARCalculator-ear/EARCalculator-ejb/CallerBean!ix.caller.CallerRemote

                    java:app/EARCalculator-ejb/CallerBean!ix.caller.CallerRemote

                    java:module/CallerBean!ix.caller.CallerRemote

                    java:global/EARCalculator-ear/EARCalculator-ejb/CallerBean

                    java:app/EARCalculator-ejb/CallerBean

                    java:module/CallerBean

             

             

            21:20:19,858 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named CallerName in deployment unit subdeployment "EARCalculator-ejb.jar" of deployment "EARCalculator-ear.ear" are as follows:

             

             

                    java:global/EARCalculator-ear/EARCalculator-ejb/CallerName!ix.caller.CallerRemote

                    java:app/EARCalculator-ejb/CallerName!ix.caller.CallerRemote

                    java:module/CallerName!ix.caller.CallerRemote

                    java:global/EARCalculator-ear/EARCalculator-ejb/CallerName

                    java:app/EARCalculator-ejb/CallerName

                    java:module/CallerName

             

            21:20:19,971 WARN  [org.jboss.as.ejb3.timerservice.mk2.TimerServiceFactoryImpl] (MSC service thread 1-4) Unregistered an already registered Timerservice with id CalculatorBean and a new instance will be registered

            21:20:20,330 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/EARCalculator-web]] (MSC service thread 1-1) Initializing Spring root WebApplicationContext

            21:20:20,776 INFO  [stdout] (MSC service thread 1-1)

            21:20:20,777 INFO  [stdout] (MSC service thread 1-1)

            21:20:20,777 INFO  [stdout] (MSC service thread 1-1)     Hello ...

            21:20:20,778 ERROR [stderr] (MSC service thread 1-1) javax.naming.NameNotFoundException: env -- service jboss.naming.context.java.module.EARCalculator-ear.EARCalculator-web.env

            21:20:20,778 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:73)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:57)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at javax.naming.InitialContext.lookup(InitialContext.java:392)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at ix.calculator.web.CalculatorFinderController.<init>(CalculatorFinderController.java:71)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

            21:20:20,779 ERROR [stderr] (MSC service thread 1-1)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)

            21:20:20,780 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)

            21:20:20,781 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821)

            21:20:20,782 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70)

            21:20:20,783 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

            21:20:20,783 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

            21:20:20,783 ERROR [stderr] (MSC service thread 1-1)    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

            21:20:20,783 ERROR [stderr] (MSC service thread 1-1)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

            21:20:20,784 ERROR [stderr] (MSC service thread 1-1)    at java.lang.Thread.run(Thread.java:662)

            21:20:20,784 INFO  [stdout] (MSC service thread 1-1) ONE----result =

            21:20:20,838 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/EARCalculator-web]] (MSC service thread 1-1) Initializing Spring FrameworkServlet 'mvc-dispatcher'

            21:20:20,900 INFO  [stdout] (MSC service thread 1-1)

            21:20:20,900 INFO  [stdout] (MSC service thread 1-1)

            21:20:20,901 INFO  [stdout] (MSC service thread 1-1)     Hello ...

            21:20:20,901 ERROR [stderr] (MSC service thread 1-1) javax.naming.NameNotFoundException: env -- service jboss.naming.context.java.module.EARCalculator-ear.EARCalculator-web.env

            21:20:20,901 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:73)

            21:20:20,901 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)

            21:20:20,901 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:57)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at javax.naming.InitialContext.lookup(InitialContext.java:392)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at ix.calculator.web.CalculatorFinderController.<init>(CalculatorFinderController.java:71)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

            21:20:20,902 ERROR [stderr] (MSC service thread 1-1)    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

            21:20:20,903 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)

            21:20:20,903 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)

            21:20:20,903 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)

            21:20:20,903 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)

            21:20:20,903 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

            21:20:20,903 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

            21:20:20,904 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at javax.servlet.GenericServlet.init(GenericServlet.java:242)

            21:20:20,905 ERROR [stderr] (MSC service thread 1-1)    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202)

            21:20:20,906 ERROR [stderr] (MSC service thread 1-1)    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102)

            21:20:20,906 ERROR [stderr] (MSC service thread 1-1)    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631)

            21:20:20,906 ERROR [stderr] (MSC service thread 1-1)    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844)

            21:20:20,906 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70)

            21:20:20,906 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

            21:20:20,906 ERROR [stderr] (MSC service thread 1-1)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

            21:20:20,907 ERROR [stderr] (MSC service thread 1-1)    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

            21:20:20,907 ERROR [stderr] (MSC service thread 1-1)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

            21:20:20,908 ERROR [stderr] (MSC service thread 1-1)    at java.lang.Thread.run(Thread.java:662)

            21:20:20,908 INFO  [stdout] (MSC service thread 1-1) ONE----result =

            21:20:21,356 INFO  [org.jboss.web] (MSC service thread 1-1) registering web context: /EARCalculator-web

            21:20:21,393 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "EARCalculator-ear.ear"

             

             

            Here I enclosed my sample ear file for reference.

             

            Thanks

            Sam

            • 3. Re: Error with running EJB3 + WAR example in AS7
              robert.geisler Newbie

              21:20:20,778 ERROR [stderr] (MSC service thread 1-1) javax.naming.NameNotFoundException: env -- service jboss.naming.context.java.module.EARCalculator-ear.EARCalculator-web.env

              ...

              21:20:20,779 ERROR [stderr] (MSC service thread 1-1) at ix.calculator.web.CalculatorFinderController.<init>(CalculatorFinderController.java:71)

              NameNotFoundException means that you specified an invalid JNDI name to look for!

               

              did you remember java:global/[name of ear]/[name of ejb-module]/[name of bean]![qualified classname of the local business interface] and look up for java:global/EARCalculator-ear/EARCalculator-ejb/CalculatorBean!ix.calculator.CalculatorLocal ?

               

              please post code of CalculatorFinderController!

               

               

              another hint:

              21:20:19,971 WARN  [org.jboss.as.ejb3.timerservice.mk2.TimerServiceFactoryImpl] (MSC service thread 1-4) Unregistered an already registered Timerservice with id CalculatorBean and a new instance will be registered

              this warning seems to me as you deploy your CalculatorBean twice. dont know if its just because of redeploying. but i found EARCalculator-ear.ear/EARCalculator-web.war/WEB-INF/classes/META-INF/ejb-jar.xml . remove /META-INF from /classes!

              • 4. Re: Error with running EJB3 + WAR example in AS7
                Sam W Expert

                Hi, thank you very much for further explained.

                I have removed all ejb-jar.xml file, the same error still shown during deployment.

                 

                Here is the CalculatorFinderController.java file:

                 

                 

                @Controller

                //@SessionAttributes("categoryFinder")

                @RequestMapping("/category")

                @Transactional

                public class CalculatorFinderController {

                 

                 

                    private static final Logger logger = Logger.getLogger(CalculatorFinderController.class);

                 

                 

                //          @Autowired

                //          private ProductFinderBeanValidator productFinderBeanValidator;

                 

                 

                    public CalculatorFinderController() {

                        String result = "";

                        System.out.println("\n\n\t Hello ...");

                        logger.info("calling CalculatorFinderController");

                        try {

                //            Properties pr = new Properties();

                //            pr.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

                //            pr.put(Context.PROVIDER_URL, "t3://localhost:7001");

                //            pr.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

                //            pr.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");

                 

                 

                           

                            InitialContext ic = new InitialContext();

                            // Obtain the application component's ENC

                            Context envCtx = (Context) ic.lookup("java:comp/env");

                            CallerRemote remote = (CallerRemote) envCtx.lookup("CallerRemote");

                //            Float taxRate = (Float) envCtx.lookup("taxRate");

                //            CallerRemote remote = (CallerRemote) ic.lookup("CallerMappedName#ix.caller.CallerRemote");

                            result = remote.callEJBOne(1000, 2000);

                        } catch (Exception e) {

                            e.printStackTrace();

                        }

                        System.out.println("ONE----result = " + result);

                    }

                 

                 

                Thanks

                Sam

                • 5. Re: Error with running EJB3 + WAR example in AS7
                  robert.geisler Newbie

                  why do you use envCtx? just try

                  CallerRemote remote = (CallerRemote) ic.lookup("java:global/EARCalculator-ear/EARCalculator-ejb/CallerBean!ix.caller.CallerRemote");

                   

                  that probably wont work, because JBoss doesnt support Remote Business Interfaces yet. if so, create CallerLocal interface use @Local on CallerBean und use JNDI name java:global/EARCalculator-ear/EARCalculator-ejb/CallerBean!ix.caller.CallerLocal instead of the one above.

                   

                  greets

                  robert

                  • 6. Re: Error with running EJB3 + WAR example in AS7
                    Sam W Expert

                    Thanks for the answer.

                     

                    How to link the newly created interface CallerBean (with @Local) in WAR layer to the CallerBean object in EJB layer?

                     

                    Thanks

                    Sam

                    • 7. Re: Error with running EJB3 + WAR example in AS7
                      Sam W Expert

                      Please refer to my attached project source code.

                      • 8. Re: Error with running EJB3 + WAR example in AS7
                        robert.geisler Newbie

                        you do not have to "link" CallerLocal, just use JNDI!?

                         

                        to use Local Business Interface from WAR just create interface ix.caller.CallerLocal (as CalculatorLocal) and modify CallerBean to

                        @Stateless(name = "CallerName")

                        @Local(value = CallerLocal.class)

                        public class CallerBean implements CallerLocal {

                        after that do

                        new InitialContext().lookup("java:global/EARCalculator-ear/EARCalculator-ejb/CallerName!ix.caller.CallerLocal")

                        within your WAR.

                        • 9. Re: Error with running EJB3 + WAR example in AS7
                          Sam W Expert

                          That works perfectly.

                           

                          Thanks so much.

                          Sam.