13 Replies Latest reply on Dec 16, 2014 7:30 AM by valsaraj007

    Issue with migrating jboss.xml to jboss-ejb3.xml

    valsaraj007

      Hi,

      I am getting following error when I migrate jboss.xml to jboss-ejb3.xml to deploy in JBoss-AS-7.1.2.

      2014-12-05 14:55:25,570 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."app.ear"."appEJB.jar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."app.ear"."appEJB.jar".PARSE: JBAS018733: Failed to process phase PARSE of subdeployment "appEJB.jar" of deployment "app.ear"

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

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

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

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014185: Exception while parsing jboss-ejb3.xml: /D:/jboss-as-7.1.2.Final/bin/content/app.ear/appEJB.jar/META-INF/jboss-ejb3.xml

        at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.parseJBossEjb3Xml(EjbJarParsingDeploymentUnitProcessor.java:291)

        at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.deploy(EjbJarParsingDeploymentUnitProcessor.java:123)

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116)

        ... 5 more

      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[79,4]

      Message: Unexpected element '{http://java.sun.com/xml/ns/javaee}destination-jndi-name' encountered

       

      jboss.xml:

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

      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 6.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_6_0.dtd">

      <jboss>

        <security-domain>java:/jaas/appLDAP</security-domain>

        <enterprise-beans>

        <session>

        <ejb-name>InvitationBean</ejb-name>

        <resource-ref>

        <res-ref-name>jms/JmsXA</res-ref-name>

        <jndi-name>java:/JmsXA</jndi-name>

        </resource-ref>

        <message-destination-ref>

        <message-destination-ref-name>queue/invitation</message-destination-ref-name>

        <jndi-name>/queue/invitation</jndi-name>

        </message-destination-ref>

        </session>

        <message-driven>

        <ejb-name>InvitationSender</ejb-name>

        <destination-jndi-name>java:/queue/invitation</destination-jndi-name>

        </message-driven>

        <message-driven>

        <ejb-name>ExportMdb</ejb-name>

        <destination-jndi-name>java:/queue/export</destination-jndi-name>

        <resource-ref>

        <res-ref-name>jms/JmsXA</res-ref-name>

        <jndi-name>java:/JmsXA</jndi-name>

        </resource-ref>

        </message-driven>

        </enterprise-beans>

      </jboss>

       

      jboss-ejb3.xml:

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

      <jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"

                     xmlns="http://java.sun.com/xml/ns/javaee"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xmlns:s="urn:security:1.1"

                     xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"

                     version="3.1"

                     impl-version="2.0">

        <enterprise-beans>

        <session>

        <ejb-name>InvitationBean</ejb-name>

        <resource-ref>

        <res-ref-name>jms/JmsXA</res-ref-name>

        <jndi-name>java:/JmsXA</jndi-name>

        </resource-ref>

        <message-destination-ref>

        <message-destination-ref-name>queue/invitation</message-destination-ref-name>

        <jndi-name>/queue/invitation</jndi-name>

        </message-destination-ref>

        </session>

        <message-driven>

        <ejb-name>InvitationSender</ejb-name>

      <destination-jndi-name>java:/queue/invitation</destination-jndi-name>

        </message-driven>

        <message-driven>

        <ejb-name>ExportMdb</ejb-name>

      <destination-jndi-name>java:/queue/export</destination-jndi-name>

        <resource-ref>

      <res-ref-name>jms/JmsXA</res-ref-name>

        <jndi-name>java:/JmsXA</jndi-name>

        </resource-ref>

        </message-driven>

        </enterprise-beans>

        <assembly-descriptor>

        <s:security>

                 <s:security-domain>java:/jaas/appLDAP</s:security-domain>

              </s:security>

          </assembly-descriptor>

      </jboss:ejb-jar>

       

      what change will fix this issue?

        • 1. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
          jaysensharma

          I did not check other tags deeply but at a glance... i do not see any closing tag of <jboss:ejb-jar

           

          Your jboss-ejb3.xml file is ending with tag </jboss>  which should be </jboss:ejb-jar>

          • 2. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
            valsaraj007

            Hi Jay,

             

            I have updated the snippet in question as </jboss:ejb-jar>. The error is due to other element Message: Unexpected element '{http://java.sun.com/xml/ns/javaee}destination-jndi-name' encountered

            • 3. Re: Re: Issue with migrating jboss.xml to jboss-ejb3.xml
              jaysensharma

              In your jboss-ejb3.xml  rather than using the  "destination-jndi-name" try using "jndi-name"  something like what i  tested as following:

               

              
              <?xml version="1.0"?> 
              <jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
                                xmlns="http://java.sun.com/xml/ns/javaee"
                                xmlns:s="urn:security"
                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
                                http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
                                version="3.1"
                                impl-version="2.0">
              
                  <enterprise-beans>
                      <session>
                          <ejb-name>CallerBean</ejb-name>
                          <ejb-class>remote.CallerBean</ejb-class>
                          <message-destination-ref>
                            <message-destination-ref-name>jms/TestQueue</message-destination-ref-name>
                            <jndi-name>java:/jms/queue/TestQ</jndi-name>
                          </message-destination-ref>
                      </session>
                  </enterprise-beans>
              
              </jboss:ejb-jar>
              

               

               

              I was able to look it up from my session bean like following later:

               

              package remote; 
              import javax.ejb.*; 
              import javax.naming.*; 
              import java.util.*; 
              @Stateless   
              @Remote(CallerRemote.class) 
              public class CallerBean implements CallerRemote { 
                   public String commonMethod(String name) {
                               try{
                                 InitialContext ic = new InitialContext();
                                 Object o = ic.lookup("java:comp/env/jms/TestQueue");
                                 System.out.println("\n\n\n\t******** GOT  java:comp/env/jms/TestQueue   = "+ o);
                                } catch(Exception e) {
                                  e.printStackTrace();
                                }
                             return "Hello, "+name; 
                      } 
               }
              
              • 4. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                valsaraj007

                How can we migrate the following configuration from jboss.xml:

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

                <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 6.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_6_0.dtd">

                <jboss>

                  <security-domain>java:/jaas/appLDAP</security-domain>

                  <enterprise-beans>

                .....

                .....

                • 5. Re: Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                  jaysensharma

                  see [1]

                   

                  
                  
                  
                  
                  
                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <jboss:jboss
                          xmlns="http://java.sun.com/xml/ns/javaee"
                          xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xmlns:s="urn:security:1.1"
                          version="3.1" impl-version="2.0">
                  
                      <assembly-descriptor>
                          <s:security>
                             <ejb-name>MyBean</ejb-name>
                              <!-- Name of the security domain which is configured in the EJB3 subsystem -->
                              <s:security-domain>appLDAP</s:security-domain>
                          </s:security>
                      </assembly-descriptor>
                  </jboss:jboss>
                  
                  
                  
                  
                  
                  

                   

                  [1] Securing EJBs - JBoss AS 7.2 - Project Documentation Editor

                  1 of 1 people found this helpful
                  • 6. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                    valsaraj007

                    <ejb-name>MyBean</ejb-name> is for a single bean, right?

                    <security-domain>java:/jaas/appLDAP</security-domain> was in global scope. I t was not tied to a specific bean. How can we make it work like this?

                    Use wildcards? Eg: <ejb-name>*</ejb-name>

                    1 of 1 people found this helpful
                    • 7. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                      jaysensharma

                      Yes, Wildcard is allowed in the <ejb-name>  of your jboss-ejb3.xml

                      • 8. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                        valsaraj007

                        Also got the following error:

                        Caused by: java.lang.IllegalStateException: No parser found for urn:security:1.1

                        • 9. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                          valsaraj007

                          Issue fixed when I replaced  xmlns:s="urn:security:1.1" with xmlns:s="urn:security".

                          • 10. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                            ctomc

                            valsaraj viswanathan wrote:

                             

                            Issue fixed when I replaced  xmlns:s="urn:security:1.1" with xmlns:s="urn:security".

                            That was added in 7.2 as Jay pointed out.

                             

                            use urn:security:1.0 in 7.1.x

                            1.1 got support for missing-method-permissions-deny-access element in configuration.

                             

                            in any case i would strongly encourage you to go with wildfly 8.2, as it much newer and has less known bugs

                            WildFly is just renamed "JBoss AS" project.

                            • 11. Re: Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                              jaysensharma

                              in your jboss-ejb3.xml  try changing the following line:

                               

                                      xmlns:s="urn:security:1.1"  
                              
                              

                               

                              TO

                              
                              
                              
                              
                              xmlns:s="urn:security:1.0" 
                              
                              
                              
                              
                              
                              

                               

                               

                               

                              EDIT: Just noticed Tomaz's update.      Tomaz Cerar point is valid. WildFly is much improved and is a better choice compared to JBossAS7

                              • 12. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                                valsaraj007

                                Exception disappeared when used the following jboss-ejb3.xml:

                                 

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

                                <jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"

                                    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:s="urn:security"

                                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd

                                                     http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"

                                    version="3.1" impl-version="2.0">

                                  <enterprise-beans>

                                <session>

                                  <ejb-name>InvitationBean</ejb-name>

                                  <resource-ref>

                                  <res-ref-name>jms/JmsXA</res-ref-name>

                                  <jndi-name>java:/JmsXA</jndi-name>

                                  </resource-ref>

                                  <message-destination-ref>

                                  <message-destination-ref-name>queue/invitation</message-destination-ref-name>

                                  <jndi-name>java:/queue/invitation</jndi-name>

                                  </message-destination-ref>

                                  </session>

                                <message-driven>

                                  <ejb-name>InvitationSender</ejb-name>

                                  <activation-config>

                                                <activation-config-property>

                                                    <activation-config-property-name>destination</activation-config-property-name>

                                                    <activation-config-property-value>java:/queue/invitation</activation-config-property-value>

                                                </activation-config-property>

                                                <activation-config-property>

                                  <activation-config-property-name>destinationType</activation-config-property-name>

                                  <activation-config-property-value>javax.jms.Queue</activation-config-property-value>

                                  </activation-config-property>

                                            </activation-config>

                                  </message-driven>

                                <s:security>

                                  <ejb-name>*</ejb-name>

                                            <s:security-domain>java:/jaas/appLDAP</s:security-domain>

                                        </s:security>

                                    </assembly-descriptor>

                                </jboss:ejb-jar>

                                • 13. Re: Issue with migrating jboss.xml to jboss-ejb3.xml
                                  valsaraj007

                                  I will check WildFly.

                                   

                                  Jay, Thomaz,

                                  Thanks for your help.