0 Replies Latest reply on Sep 12, 2003 4:41 PM by Leung Kam Lung

    naming exception due to no ejb-local-ref in jboss-web

    Leung Kam Lung Newbie

      Hi.

      Can someone help with jboss-web configuration problem.
      I am using jboss-3.2.1_tomcat-4.1.24 version of Jboss.
      I have an Entity bean UserEJB that is defined as local and is packaged in a jar file named InfraEntityBeansProfilesModule.jar.
      I also have a web application TestInfraEntityBeansModule.war that I used to test the UserBean bean. Both of the InfraEntityBeansProfilesModule.jar and TestInfraEntityBeansModule.war are packaged in an application unit named myApplication.ear

      *** The application.xml ****
      <!DOCTYPE application PUBLIC
      "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
      "http://java.sun.com/dtd/application_1_3.dtd">



      <display-name>Alert Application</display-name>


      <web-uri>TestInfraEntityBeansModule.war</web-uri>
      <context-root>/TestInfraEntityBeansModule</context-root>



      InfraEntityBeansProfilesModule.jar




      *** The ejb-jar.xml in InfraEntityBeansProfilesModule.jar ***

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC
      "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      <display-name>Application</display-name>
      <enterprise-beans>

      <display-name>User Entity Bean</display-name>
      <ejb-name>UserBean</ejb-name>
      <local-home> UserLocalHome </local-home>
      UserLocal
      <ejb-class> UserEJB </ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      True
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>UserBean</abstract-schema-name>

      <cmp-field><field-name>primaryKey</field-name></cmp-field>
      <cmp-field><field-name>accountType</field-name></cmp-field>
      <cmp-field><field-name>dateOfBirth</field-name></cmp-field>
      <cmp-field><field-name>iD</field-name></cmp-field>
      <cmp-field><field-name>subID</field-name></cmp-field>
      <cmp-field><field-name>lastName</field-name></cmp-field>
      <cmp-field><field-name>middleName</field-name></cmp-field>
      <cmp-field><field-name>firstName</field-name></cmp-field>
      <cmp-field><field-name>password</field-name></cmp-field>
      <cmp-field><field-name>sSN</field-name></cmp-field>
      <cmp-field><field-name>emailAddress</field-name></cmp-field>
      <primkey-field>primaryKey</primkey-field>

      </enterprise-beans>
      </ejb-jar>


      *** Jboss.xml in InfraEntityBeansProfilesModule.jar ****
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC
      "-//JBoss//DTD JBOSS 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

      <enterprise-beans>

      <ejb-name>UserBean</ejb-name>
      <local-jndi-name>local/UserBeanJNDI</local-jndi-name>

      </enterprise-beans>


      **** The web.xml In TestInfraEntityBeansModule.war ****
      <web-app>

      <servlet-name>
      CreateUser
      </servlet-name>
      <servlet-class>
      User.Java.CreateUser
      </servlet-class>


      <servlet-mapping>
      <servlet-name>
      CreateUser
      </servlet-name>
      <url-pattern>
      /Profiles/User/CreateUser
      </url-pattern>
      </servlet-mapping>

      <ejb-local-ref>
      Ref 2 UserLocal Bean
      <ejb-ref-name>ejb/refToUserLocalBean</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>UserLocalHome</local-home>
      UserLocal
      <ejb-link>UserBean</ejb-link>
      </ejb-local-ref>
      </web-app>

      **** The jboss-web.xml In TestInfraEntityBeansModule.war ****
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtds/jboss-web_3_0.dtd">

      <jboss-web>

      </jboss-web>


      Jboss throw NamingException when the following code was executed inside a servlet (jndiName=ejb/refToUserLocalBean).
      try {
      if(anEJBHome == null) {
      anEJBHome = (EJBHome) ctx.lookup("java:comp/env/"+jndiName);
      ejbHomes.put(aHomeClass, anEJBHome);
      }
      } catch (ClassCastException classCastEx) {
      subLog.fatal(exceptonPrintingUtil.PrintStackTraceElements(classCastEx.getStackTrace()));
      throw new EJBHomeFactoryException(classCastEx);
      } catch (NamingException namingEx) {
      subLog.fatal(exceptonPrintingUtil.PrintStackTraceElements(namingEx.getStackTrace()));
      throw new EJBHomeFactoryException(namingEx);
      }


      *** server.log *****
      2003-09-12 14:35:34,139 DEBUG [root] Begin PrintStackTraceElements
      2003-09-12 14:35:34,142 DEBUG [root] End PrintStackTraceElements
      2003-09-12 14:35:34,142 FATAL [root]
      com.wlwa.Infra.CommomJavaSources.Utilities.Ejb.EJBHomeLocalFactory.lookUpHome(EJBHomeLocalFactory.java:105)
      com.wlwa.TestInfra.BusinessLogic.EntityBeans.Profiles.User.Java.CreateUser.doPost(CreateUser.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      java.lang.Thread.run(Thread.java:536)
      2003-09-12 14:35:34,147 ERROR [org.jboss.web.localhost.Engine] Exception
      java.lang.Throwable: com.wlwa.Infra.CommomJavaSources.Utilities.Ejb.EJBHomeFactoryException
      at com.wlwa.TestInfra.BusinessLogic.EntityBeans.Profiles.User.Java.CreateUser.doPost(CreateUser.java:114)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)
      2003-09-12 14:35:34,152 INFO [root] End doPost