3 Replies Latest reply on Nov 13, 2002 8:30 PM by Fang Sun

    Can't get Servlet to deploy--Naming Exception no ejb-link ma

    Marcia Hostetler Newbie

      I'm trying to get a simple servlet to run. It references one session bean. I created an ear file in J2EE deploytool and it ran fine under J2EE server. When I deploy the ear to JBoss I get the following error (I tried creating an EJB jar and war file and I get similar results). What am I doing wrong.

      2002-08-15 11:39:29,481 ERROR [org.jboss.deployment.MainDeployer] could not start deployment: njar:file:/C:/jboss-3.0.0_tomcat-4.0.3/server/default/tmp/deploy/server/default/deploy/ConverterApp.ear/77.ConverterApp.ear^/war-ic.war
      org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: ejb-ref: ejb/webtest/converter, no ejb-link match, use jndi-name in jboss-web.xml)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:309)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:678)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:671)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:513)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
      at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:586)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:465)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:237)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:340)
      at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy3.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:243)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:678)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:513)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:465)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:314)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:216)
      at org.jboss.Main.boot(Main.java:142)
      at org.jboss.Main$1.run(Main.java:375)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: javax.naming.NamingException: ejb-ref: ejb/webtest/converter, no ejb-link match, use jndi-name in jboss-web.xml
      at org.jboss.web.AbstractWebContainer.linkEjbRefs(AbstractWebContainer.java:633)
      at org.jboss.web.AbstractWebContainer.parseWebAppDescriptors(AbstractWebContainer.java:458)
      at org.jboss.web.AbstractWebContainer$DescriptorParser.parseWebAppDescriptors(AbstractWebContainer.java:944)
      at org.jboss.web.catalina.EmbeddedCatalinaServiceSX.initENC(EmbeddedCatalinaServiceSX.java:329)
      at org.jboss.web.catalina.EmbeddedCatalinaServiceSX.createWebContext(EmbeddedCatalinaServiceSX.java:316)
      at org.jboss.web.catalina.EmbeddedCatalinaServiceSX.performDeploy(EmbeddedCatalinaServiceSX.java:238)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
      ... 47 more

        • 1. Re: Can't get Servlet to deploy--Naming Exception no ejb-lin
          gernot Newbie

          you need a jboss-web.xml file in your WEB-INF directory of your war.
          something like this:

          <jboss-web>
          <ejb-ref>
          <ejb-ref-name>ejb/webtest/converter</ejb-ref-name>
          <jndi-name>jndi.name.you.bound.your.bean</jndi-name>
          </ejb-ref>
          </jboss-web>

          the bean should be deployed before you deploy your war file.

          c.u.
          gernot

          • 2. Re: Can't get Servlet to deploy--Naming Exception no ejb-lin
            Marcia Hostetler Newbie

            I think I did what you said. Here's copies of my pertinent files:

            Reference from index.java:
            InitialContext ic = new InitialContext();
            Object objRef = ic.lookup("java:comp/env/ejb/webtest/converter");

            web.xml file:
            <?xml version="1.0" encoding="UTF-8"?>
            <web-app>
            <display-name>Web Client</display-name>

            <servlet-name>index</servlet-name>
            <display-name>index</display-name>
            <servlet-class>index</servlet-class>

            <!-- The Welcome File List -->
            <welcome-file-list>
            <welcome-file>/servlet/index</welcome-file>
            </welcome-file-list>
            <ejb-ref>
            <ejb-ref-name>ejb/webtest/converter</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            converter.interfaces.ConverterHome
            converter.interfaces.Converter
            </ejb-ref>
            </web-app>

            ejb-jar.xml file (snippet):
            <ejb-jar >
            No Description.
            <display-name>Generated by XDoclet</display-name>
            <enterprise-beans>
            <!-- Session Beans -->

            <![CDATA[Session Bean Template ATTENTION: Some of the XDoclet tags are hidden from XDoclet by adding a "--" between @ and the namespace.]]>
            <display-name>ConverterEJB</display-name>
            <ejb-name>Converter</ejb-name>
            converter.interfaces.ConverterHome
            converter.interfaces.Converter
            <ejb-class>converter.session.ConverterBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>

            </ejb-jar>

            jboss.xml file:
            <?xml version="1.0" encoding="UTF-8"?>

            <enterprise-beans>

            <ejb-name>Converter</ejb-name>
            <jndi-name>ejb/marcias/converter</jndi-name>

            </enterprise-beans>...

            jboss-web.xml file:
            <?xml version="1.0" encoding="UTF-8"?>

            <enterprise-beans>

            <ejb-name>Converter</ejb-name>
            <jndi-name>ejb/marcias/converter</jndi-name>

            </enterprise-beans>
            <resource-managers>
            </resource-managers>

            • 3. Re: Can't get Servlet to deploy--Naming Exception no ejb-lin
              Fang Sun Newbie

              Hi, have you solved that problem till now?
              I got the same error, too. And I've spent quite a while to fix, but couldn't.
              So, if you know the answer now, please let me know.
              Thanks.