8 Replies Latest reply on Apr 25, 2012 12:15 AM by sfcoy

    EJB-JAR.XML AND JBOSS.XML SETUP

    brucesanders63

      Does someone one have a simple explaination w/example showing how to setup the jboss.xml from an ejb-jar.xml?  I find nothing on JBOSS or Goggle?  Specifically I'm looking for the enterprise beans and resource section.  Below is the contents of my ejb-jar.xml.

       

       

      <enterprise-beans>

        <session>

        

            <description>Calculation Appeals Manager EJB</description>

            <display-name>CalculationAppealsPortalManagerBean</display-name>

            <ejb-name>CalculationAppealsPortalManagerBean</ejb-name>

            <home>com.spcs.intranet.calculationAppeals.business.ejb.CalculationAppealsManagerHome</home>

            <remote>com.spcs.intranet.calculationAppeals.business.ejb.CalculationAppealsManager</remote>

            <ejb-class>com.spcs.intranet.calculationAppeals.business.ejb.CalculationAppealsManagerBean</ejb-class>

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

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

         <env-entry>

          <env-entry-name>ejb.sessionTimeout</env-entry-name>

          <env-entry-type>java.lang.String</env-entry-type>

          <env-entry-value>600</env-entry-value>

         </env-entry>

      </session>

        • 1. Re: EJB-JAR.XML AND JBOSS.XML SETUP
          wdfink

          What version of EJB do you use? EJB2.x or EJB3.x?

           

          If you use EJB2 have a look into JBOSS_HOME/docs/dtd/jboss_?_?.dtd it might help.

          Also the JBoss part of the Xdoclet documentation (http://xdoclet.sourceforge.net/xdoclet/tags/jboss-tags.html)  might help

          • 2. Re: EJB-JAR.XML AND JBOSS.XML SETUP
            jaikiran

            There are some examples here http://www.jboss.org/ejb3/docs. For the resource reference ones see this http://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/Using_resource_references_in_EJB3.html. The source code is available on that docs page for reference.

            • 3. Re: EJB-JAR.XML AND JBOSS.XML SETUP
              brucesanders63

              In my ejb-jar.xml I have the following:

               

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

               

              Looks like 2 to me.

              • 4. Re: EJB-JAR.XML AND JBOSS.XML SETUP
                brucesanders63

                I have attached several files that I hope will provide someone with the insight to assist.  I'm trying to access an EJB in a jar file from MyEclipse(I believe I would have the same problem from eclipse).  The heart of the matter(I believe) can be found in the log from the server where the ejb-jar.xml and jboss.xml won't synch and therefore when I try to execute

                CalculationAppealsManager ejb = EJBFactory.getCalculationAppealsManager() it fails since JBOSS wasn't able to connect to the EJB.  I've tried many different things but to no avail.  I'm not ashamed to say that some of this is lack of EJB/JBOSS knowledge.  I'm a developer, not a systems guy and my Enterprise Java is extremely rusty(been in the c#.net world for several years).  Any assistance would be appreciated.

                • 5. Re: EJB-JAR.XML AND JBOSS.XML SETUP
                  wdfink

                  If I look to the logfiles the application deploy fails because of a wrong deploment descriptor:

                  14:37:06,340 ERROR [MainDeployer] Could not create deployment: file:/C:/JBoss4.0/jboss-4.0.5.GA/server/default/deploy/CalculationAppeals_ejb.jar

                  org.jboss.deployment.DeploymentException: Error in jboss.xml for Bean jmx/ejb/Adaptor: found in jboss.xml but not in ejb-jar.xml

                   

                  Your ejb-jar.xml declare other stuff than jboss.xml.

                  If I look into the weblogic-ejb.jar.xml this looks better.

                   

                  Correct the jboss.xml file that the application deploy is correct without any ERROR.

                  • 6. Re: EJB-JAR.XML AND JBOSS.XML SETUP
                    brucesanders63

                    Same problem.

                     

                    Here is what my jboss.xml looks like.  I also confirmed it to be the same in JBOSS deployment folder as I made the change in eclipse.

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                    <?

                     

                    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"

                    >

                     

                    <

                     

                    jboss

                    >

                     

                     

                    <enterprise-beans

                    >

                     

                     

                    <!--

                    To add beans that you have deployment descriptor info for, add

                    a file to your XDoclet merge directory called jboss-beans.xml that contains

                    the <session></session>, <entity></entity> and <message-driven></message-driven>

                    markup for those beans.

                    -->

                     

                     

                    <session

                    >

                     

                    <ejb-name>CalculationAppealsPortalManagerBean</ejb-name

                    >

                     

                    <jndi-name>CalculationAppealsPortalManagerBean</jndi-name

                    >

                     

                    <local-jndi-name>CalculationAppealsPortalManagerBean</local-jndi-name

                    >

                     

                     

                    </session

                    >

                     

                    <session

                    >

                     

                    <ejb-name>CalculationAppealsPortalManagerBean</ejb-name

                    >

                     

                    <jndi-name>ejb/CalculationAppealsPortalManagerBean</jndi-name

                    >

                     

                     

                    </session>

                    <!--

                     

                    <message-driven>

                    <ejb-name>MessageFileUpload</ejb-name>

                     

                    </message-driven>

                    --><!--

                    write a merge file jboss-webservices.ent for webservice-description

                    -->

                     

                     

                    </enterprise-beans

                    >

                     

                     

                    <resource-managers

                    >

                     

                    </resource-managers

                    >

                     

                     

                    <!--

                    | for container settings, you can merge in jboss-container.xml

                    | this can contain <invoker-proxy-bindings/> and <container-configurations/>

                    -->

                     

                    </

                     

                    jboss

                    >

                    • 7. Re: EJB-JAR.XML AND JBOSS.XML SETUP
                      brucesanders63

                      Been a while since I posted but I still have the same problem and find very little on the internet to assist.  If I create my own enterprise java bean from source code using Xdoclet to assist the jar does deploy.  I match the jboss.xml from the successful deploy

                       

                      with one in the ejb I still get the deploy error below.  See  below:

                       

                      jboss.xml

                      <?xml version="1.0" encoding="UTF-8"?>
                      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd">

                      <jboss>

                         <enterprise-beans>

                            <session>
                        
                               <ejb-name>CalculationAppealsManagerBean</ejb-name>
                               <jndi-name>ejb/CalculationAppealsManagerBean</jndi-name>
                            </session>

                         </enterprise-beans>

                         <resource-managers>
                         </resource-managers>

                      </jboss>

                       

                      ejb-jar.xml

                      <?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>

                       
                      <enterprise-beans>
                        <session>
                        
                            <description>Calculation Appeals Manager EJB</description>
                            <display-name>CalculationAppealsPortalManagerBean</display-name>
                            <ejb-name>CalculationAppealsManagerBean</ejb-name>
                            <home>com.spcs.intranet.calculationAppeals.business.ejb.CalculationAppealsManagerHome</home>
                            <remote>com.spcs.intranet.calculationAppeals.business.ejb.CalculationAppealsManager</remote>
                            <ejb-class>com.spcs.intranet.calculationAppeals.business.ejb.CalculationAppealsManagerBean</ejb-class>
                         <session-type>Stateless</session-type>
                         <transaction-type>Container</transaction-type>
                         <env-entry>
                          <env-entry-name>ejb.sessionTimeout</env-entry-name>
                          <env-entry-type>java.lang.String</env-entry-type>
                          <env-entry-value>600</env-entry-value>
                         </env-entry>
                      </session>
                       

                      </enterprise-beans>
                        
                        
                      <assembly-descriptor>
                        <security-role>
                         <role-name>all</role-name>
                        </security-role>
                        <method-permission>
                         <role-name>all</role-name>
                         <method>
                          <ejb-name>CalculationAppealsManagerBean</ejb-name>
                          <method-name>*</method-name>
                         </method>
                        </method-permission>
                        <container-transaction>
                         <method>
                          <ejb-name>CalculationAppealsManagerBean</ejb-name>
                          <method-name>*</method-name>
                         </method>
                         <trans-attribute>Required</trans-attribute>
                        </container-transaction>
                        
                      </assembly-descriptor>
                      </ejb-jar>

                       

                      The deployment result is this:

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                       

                      org.jboss.deployment.DeploymentException

                       

                       

                      : Error in jboss.xml for Bean jmx/ejb/Adaptor: found in jboss.xml but not in ejb-jar.xml

                      at org.jboss.metadata.ApplicationMetaData.importJbossXml(

                      ApplicationMetaData.java:956

                      )

                      at org.jboss.metadata.XmlFileLoader.load(

                      XmlFileLoader.java:200

                      )

                      at org.jboss.ejb.EJBDeployer.create(

                      EJBDeployer.java:541

                      )

                      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.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.ws.integration.jboss.DeployerInterceptor.create(

                      DeployerInterceptor.java:74

                      )

                      at org.jboss.ws.integration.jboss.DeployerInterceptorEJB.create(

                      DeployerInterceptorEJB.java:44

                      )

                      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(

                      SubDeployerInterceptorSupport.java:180

                      )

                      at org.jboss.deployment.SubDeployerInterceptor.invoke(

                      SubDeployerInterceptor.java:91

                      )

                      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 $Proxy26.create(Unknown Source)

                      at org.jboss.deployment.MainDeployer.create(

                      MainDeployer.java:969

                      )

                      at org.jboss.deployment.MainDeployer.deploy(

                      MainDeployer.java:818

                      )

                      at org.jboss.deployment.MainDeployer.deploy(

                      MainDeployer.java:782

                      )

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

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(

                      DelegatingMethodAccessorImpl.java:25

                      )

                      at java.lang.reflect.Method.invoke(

                      Method.java:324

                      )

                      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 $Proxy8.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:263

                      )

                      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(

                      AbstractDeploymentScanner.java:274

                      )

                      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(

                      AbstractDeploymentScanner.java:225

                      )

                      16:54:01,010 ERROR [MainDeployer] Could not create deployment: file:/C:/JBoss4.0/jboss-4.0.5.GA/server/default/deploy/CalculationAppeals_ejb.jar

                      org.jboss.deployment.DeploymentException

                       

                       

                      : Error in jboss.xml for Bean jmx/ejb/Adaptor: found in jboss.xml but not in ejb-jar.xml

                      at org.jboss.metadata.ApplicationMetaData.importJbossXml(

                      ApplicationMetaData.java:956

                      )

                      at org.jboss.metadata.XmlFileLoader.load(

                      XmlFileLoader.java:200

                      )

                      at org.jboss.ejb.EJBDeployer.create(

                      EJBDeployer.java:541

                      )

                      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.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.ws.integration.jboss.DeployerInterceptor.create(

                      DeployerInterceptor.java:74

                      )

                      at org.jboss.ws.integration.jboss.DeployerInterceptorEJB.create(

                      DeployerInterceptorEJB.java:44

                      )

                      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(

                      SubDeployerInterceptorSupport.java:180

                      )

                      at org.jboss.deployment.SubDeployerInterceptor.invoke(

                      SubDeployerInterceptor.java:91

                      )

                      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 $Proxy26.create(Unknown Source)

                      at org.jboss.deployment.MainDeployer.create(

                      MainDeployer.java:969

                      )

                      at org.jboss.deployment.MainDeployer.deploy(

                      MainDeployer.java:818

                      )

                      at org.jboss.deployment.MainDeployer.deploy(

                      MainDeployer.java:782

                      )

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

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(

                      DelegatingMethodAccessorImpl.java:25

                      )

                      at java.lang.reflect.Method.invoke(

                      Method.java:324

                      )

                      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 $Proxy8.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:263

                      )

                      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(

                      AbstractDeploymentScanner.java:274

                      )

                      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(

                      AbstractDeploymentScanner.java:225

                      )

                      • 8. Re: EJB-JAR.XML AND JBOSS.XML SETUP
                        sfcoy

                        I think part of your problem is that you have a build process that is generating a jboss.xml file from xdoclet tags and this is being deployed instead of your hand coded one.

                         

                        You need to fix your build.