1
votes

When trying to deploy a mavenized entreprise application (including both war and jar projects) in glassfish 4.0, (using netbeans 7.3.1),i got the similar problem as in this question saying that the jar is invalid as it contains zero ejb (which is not true because my application jar contains 4 entity classes with their correspondent session beans and local interfaces). As the solution in that post was to add the ejb-jar.xml then i did the same by adding my deployement descriptor written as the following :

<?xml version="1.0" encoding="UTF-8"?>
   <ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" 
         version = "3.1"
         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_1.xsd">


    <enterprise-beans>

        <session>
            <ejb-name>EnginDao</ejb-name>
            <ejb-class>com.crystaleez.dao.EnginDao</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>

        <session>
            <ejb-name>AdresseDao</ejb-name>
            <ejb-class>com.crystaleez.dao.AdresseDao</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>

        <session>
            <ejb-name>AutomobilisteDao</ejb-name>
            <ejb-class>com.crystaleez.dao.AutomobilisteDao</ejb-class>
            <transaction-type>Container</transaction-type>
            <session-type>Stateless</session-type>
        </session>

        <session>
            <ejb-name>GaragisteDao</ejb-name>
            <ejb-class>com.crystaleez.dao.GaragisteDao</ejb-class>
            <transaction-type>Container</transaction-type>
            <session-type>Stateless</session-type>
        </session>


    </enterprise-beans>


</ejb-jar>

So i got the following exception saying that this exception occuring when deploying the application, the ejb-jar.xml has an invalid content and that one of the values '{"http://java.sun.com/xml/ns/javaee":interceptors, "http://java.sun.com/xml/ns/javaee":relationships, "http://java.sun.com/xml/ns/javaee":assembly-descriptor, "http://java.sun.com/xml/ns/javaee":ejb-client-jar}' is expected (for me it's in french, i coudn't find a way to change the glassfish logging in netbeans)

Grave: Exception lors du déploiement de l'application [tunmecanique-ear-1.0-SNAPSHOT] : org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 24; Fichier de descripteur de déploiement META-INF/ejb-jar.xml dans l'archive [tunmecanique-ejb-1.0-SNAPSHOT_jar]. cvc-complex-type.2.4.a : Contenu non valide trouvé à partir de l'élément 'enterprise-beans'. L'une des valeurs '{"http://java.sun.com/xml/ns/javaee":interceptors, "http://java.sun.com/xml/ns/javaee":relationships, "http://java.sun.com/xml/ns/javaee":assembly-descriptor, "http://java.sun.com/xml/ns/javaee":ejb-client-jar}' est attendue. org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 24; Fichier de descripteur de déploiement META-INF/ejb-jar.xml dans l'archive [tunmecanique-ejb-1.0-SNAPSHOT_jar]. cvc-complex-type.2.4.a : Contenu non valide trouvé à partir de l'élément 'enterprise-beans'. L'une des valeurs '{"http://java.sun.com/xml/ns/javaee":interceptors, "http://java.sun.com/xml/ns/javaee":relationships, "http://java.sun.com/xml/ns/javaee":assembly-descriptor, "http://java.sun.com/xml/ns/javaee":ejb-client-jar}' est attendue. at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:324) at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:245) at com.sun.enterprise.deployment.archivist.Archivist.readStandardDeploymentDescriptor(Archivist.java:665) at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:391) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280) at com.sun.enterprise.deployment.archivist.ApplicationArchivist.readModulesDescriptors(ApplicationArchivist.java:611) at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:229) at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:232) at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:188) at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:222) at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96) at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:878) at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:818) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:374) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)

I don't have any of these values on my project(actually i don't know what is an interceptor neither other required values said by the exception) (i don't know why ejb-jar.xml is mandatory and why there is no way to generate it automatically) i just need to make my project being deployed sucessfully.

Thanks for help !

1

1 Answers

0
votes

The problem may be that you have a different order for session-type and transaction-type in the last two declarations. Try the following:

    <session>
        <ejb-name>AutomobilisteDao</ejb-name>
        <ejb-class>com.crystaleez.dao.AutomobilisteDao</ejb-class>
        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>
    </session>

    <session>
        <ejb-name>GaragisteDao</ejb-name>
        <ejb-class>com.crystaleez.dao.GaragisteDao</ejb-class>
        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>
    </session>