8 Replies Latest reply on Jan 28, 2013 9:06 AM by Stephen Coy

    javax.ejb.EJBException: Error occured while creating an Initial Context comp/version/NewEJB -- service jboss.naming.context.java.comp.version.NewEJB

    Vivek Mittal Newbie

      Hi All,

       

      My ejb-jar.xml looks like this:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

      <ejb-jar id="ejb-jar_ID">

      <display-name>TestSessionEJB</display-name>

      <enterprise-beans>

        <session id="NewEJB">

         <ejb-name>NewEJB</ejb-name>

         <home>web.ejbPkg.NewEJBHome</home>

         <remote>web.ejbPkg.NewEJB</remote>

         <ejb-class>web.ejbPkg.NewEJBBean</ejb-class>

         <session-type>Stateless</session-type>

         <transaction-type>Container</transaction-type>

        </session>

      </enterprise-beans>

      <assembly-descriptor id="AssemblyDescriptor_ID">

        <container-transaction>

         <method>

          <ejb-name>NewEJB</ejb-name>

          <method-name>*</method-name>

         </method>

         <trans-attribute>Required</trans-attribute>

        </container-transaction>

      </assembly-descriptor>

      </ejb-jar>

       

       

      When I try and look up my ejb from code, it throws the following message:

       

      [Mon Jan 28 11:00:57 IST 2013]  javax.ejb.EJBException: Error occured while creating an Initial Context comp/version/NewEJB -- service jboss.naming.context.java.comp.version.NewEJB

      at web.ejbPkg.framework.ejb.HomeFactory.lookupHome(HomeFactory.java:239)

      at web.ejbPkg.ordermanager.OdMgrAdp.<init>(OdMgrAdp.java:128)

      at web.ejbPkg.sessionobserver.impl.CustomSessionObserver.<init>(CustomSessionObserver.java:85)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

      at java.lang.Class.newInstance0(Class.java:355)

      at java.lang.Class.newInstance(Class.java:308)

      at web.ejbPkg.sessionobserver.SessionListener.initializeSessionObserverList(SessionListener.java:69)

      at web.ejbPkg.sessionobserver.SessionListener.<init>(SessionListener.java:39)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

      at org.jboss.msc.value.ConstructedValue.getValue(ConstructedValue.java:61)

      at org.jboss.as.naming.ValueManagedReferenceFactory.getReference(ValueManagedReferenceFactory.java:50)

      at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:90)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)

      at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85)

      at org.jboss.as.web.deployment.component.WebComponentInstantiator$1.<init>(WebComponentInstantiator.java:57)

      at org.jboss.as.web.deployment.component.WebComponentInstantiator.getReference(WebComponentInstantiator.java:55)

      at org.jboss.as.web.deployment.WebInjectionContainer.instantiate(WebInjectionContainer.java:101)

      at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80)

      at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:74)

      at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3294)

      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777)

      at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156)

      at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60)

      at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93)

      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

      at java.util.concurrent.FutureTask.run(FutureTask.java:138)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

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

      at org.jboss.threads.JBossThread.run(JBossThread.java:122)

       

      My ejbproperties.xml:

      <?xml version="1.0"?>

      <ejbproperties>

        <default-jndi-prefix>java:/comp/version/</default-jndi-prefix>

        <default-jndi-property>javax.naming.Context.INITIAL_CONTEXT_FACTORY=org.jboss.as.naming.InitialContextFactory</default-jndi-property>

      </ejbproperties>

       

      Please help me getting over this error.

       

      Thanks

      Vivek