8 Replies Latest reply on Jun 24, 2006 8:58 PM by logankiefer

    ejb-jar.xml Schema verification fails

    logankiefer

      This probably isn't a JBoss issue, but I wanted to see if someone from this site had this problem since a lot of people here are developing ejb 3 apps.

      In my ejb.xml file I put in the following xsd definitions:

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
      version="3.0">
      LTMS Controllers
      <display-name>LTMS Controllers</display-name>
      <enterprise-beans>

      ...

      </ejb-jar>

      This was an ejb2.0 deployment descriptor and I just modifed the added the schema information above. When I deploy I get the following warning:

      15:57:25,910 WARN [JBossEntityResolver] Trying to resolve systemId as a non-file URL: http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_2.xsd
      15:58:07,863 WARN [SaxJBossXBParser] schema_reference.4: Failed to read schema document 'javaee_web_services_client_1_2.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. @ http://java.sun.com/xml/ns/javaee/javaee_5.xsd[78,69]
      15:58:07,988 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=LTMS_Controllers.jar
      org.jboss.xb.binding.JBossXBException: Failed to parse source: src-resolve: Cannot resolve the name 'javaee:service-refGroup' to a(n) 'group' component. @ http://java.sun.com/xml/ns/javaee/javaee_5.xsd[798,49]
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:141)

      It seems that the ejb-jar_3_0.xsd included javaee_5.xsd which includes javaee_web_services_client_1_2.xsd which is having the problem.

      Any ideas if I'm doing something wrong or if this is some sort of bug?

        • 1. Re: ejb-jar.xml Schema verification fails
          logankiefer

          Is the issue I'm having related to Jira Ticket JBAS-2282 - JBossEntityResolver is not using schemaLocation URIs that are valid non-file URLs?

          http://jira.jboss.com/jira/browse/JBAS-2282

          • 2. Re: ejb-jar.xml Schema verification fails
            logankiefer

            I still have a problem with updating the xsd in the deployment but have gotten further. It seems I was compiling in JDK 1.4. Once I compiled my code in JDK 1.5 I can deploy successfully. But now I get a ClassCastException when attempting to lookup the EJB home interface. The exception occurs during a PortableRemote.narrow in the jdk code itself. Debugging it shows that the Proxy being casted is not the EJB Home interface that I'm expecting. It doesn't look like anything I'm expecting. Of course when I revert the jboss.xml and the ejb-jar.xml file to the previous state DTD and XSD then all works well. I'll post the details when I test it again.

            • 3. Re: ejb-jar.xml Schema verification fails
              logankiefer

              In my ejb-jar.xml I change this:

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

              to this:

              <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
              http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
              version="3.0">

              When I deploy I get a viloation error saying that

              <res-auth>CONTAINER</res-auth> needs to be either 'Container' or 'Application'. It seems it did not like CONTAINER being in all caps.


              org.jboss.xb.binding.JBossXBException: Failed to parse source: cvc-enumeration-valid: Value 'CONTAINER' is not facet-valid with respect to enumeration '[Application, Container]'. It must be a value from the enumeration.

              So, I change this to 'Container' and it deploys successfully.

              The next error I get makes no sense it says:


              org.jboss.xb.binding.JBossXBException: Failed to parse source: The content of element type "resource-ref" must match "(res-ref-name,resource-name)". @ *unknown*[11,25]

              I believe this is referring to the jboss.xml file. I'm using a jndi-name instead of a resource-name which is legal.

              <resource-ref>
              <res-ref-name>jdbc/DS</res-ref-name>
              <jndi-name>java:/DS</jndi-name>
              </resource-ref>

              Any ideas?

              • 4. Re: ejb-jar.xml Schema verification fails
                bill.burke

                use ejb-jar.xml's

                <resource-ref>
                 <res-ref-name>...
                 <mapped-name>java:/DS</mapped-name>
                




                • 5. Re: ejb-jar.xml Schema verification fails
                  logankiefer

                  I tried putting the mapped-name tag in like so in my ejb-jar.xml file


                  <resource-ref>
                  database reference
                  <res-ref-name>jdbc/DS</res-ref-name>
                  <mapped-name>java:/DS</mapped-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <res-auth>Container</res-auth>
                  </resource-ref>

                  and removed all the resource-ref tags from the jboss.xml file and got this message:

                  Failed to parse source: cvc-complex-type.2.4.a: Invalid content was found starting with element 'res-type'. One of '{"http://java.sun.com/xml/ns/javaee":injection-target}' is expected. @ *unknown*[39,27]

                  It seems like it is complaining about the line right after I put the <mapped-name> tag in.

                  • 6. Re: ejb-jar.xml Schema verification fails
                    logankiefer

                    What's interesting is that when I upgrade the jboss.xml file to use the xsd for jboss_5.0.xsd deployment seems to be all good:

                    <jboss
                    xmlns="http://java.sun.com/xml/ns/javaee"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                    http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
                    version="3.0">

                    However at runtime I get a ClassCastException doing a JNDI lookup on the Home interface.

                    Below is the call


                    EJBHome home = (EJBHome)PortableRemoteObject.narrow(
                    context.lookup(sJNDIName),narrowTo);


                    The sJNDIName has the correct name in it however when I inspect the value of 'context.lookup(sJNDIName)' it has the value:


                    jboss.j2ee:ear=treetop.ear,jar=TreeTop_Controllers.jar,name=ManageSubassetController,service=EJB3:a2a2-yd8fkv-eorsjc28-1-eoruc8m5-17

                    instead of the ejb/HelloWorldHome value.

                    this causes a ClassCastException in the narrowing part of the code in the PortableRemoteObject's narrow method.

                    And all I changed was the ejb-jar.xml and jboss.xml to the latest xsd versions and changed the CONTAINER value to be lowercase.

                    • 7. Re: ejb-jar.xml Schema verification fails
                      logankiefer

                      Refresher. I'm using JBoss 4.0.4GA with EJB RC7. My current ejbs are all 2.0 ejbs and I want to keep using the deployment descriptors.

                      When I change the ejb-jar.xml to use ejb-jar_3.0.xsd the context.lookup(jndiName) is returning a proxy that does not extend the EJBHome interface. If I change back to the ejb-jar_2.0.dtd the EJBHome does extend javax.ejb.EJBHome.

                      Does this mean in order for my EJB 2.0 beans to be EJB 3.0 compliant (i.e. use ejb-jar_3.0.xsd) I must now remove all occurances of casting the Proxy object, returned from a context.lookup, to EJBHome???

                      • 8. Re: ejb-jar.xml Schema verification fails
                        logankiefer

                        The schema verfication works for me now. The solution for me was to just use the correct version of the schema:

                        ejb-jar_3_0.xsd for the ejb.jar.xml
                        jboss_4_0.dtd for the jboss.xml

                        Then I needed to change CONTAINER to Container in the ejb-jar.xml file.

                        I also had to ensure that the jboss.xml file was correct. I did eventually get the mapped_name to work in the ejb-jar.xml file.

                        I don't have any more verification errors but I still have the classCastException.

                        I'm going to start a different thread for that since it longer falls under this thread of verification failure.