The descriptor is being validated against the dtd and its not valid. The
correct doctype with the correct dtd location is:
<!DOCTYPE ejb-jar
PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
The elements in this descriptor are not ordered correctly. Currently the
parser is rejecting these.
Caused by: org.xml.sax.SAXException: The content of element type
"session" must match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home?,remote?,local-home?,local?,ejb-class,session-type,transaction-type,env-entry*,ejb-ref*,ejb-local-ref*,security-role-ref*,security-identity?,resource-ref*,resource-env-ref*)".
@
Richard Achmatowicz wrote:
Dear All
I am encountering a parsing problem when trying to deploy a jar containing some EJBs. The
deployments is part of a test case in the AS testsuite, which has been there for some
time. It appears as though the offending file parses correctly under Eclipse (thanks,
Clebert).
Have there been changes which may account for this problem?
output from AS console:
-----------------------
10:55:20,140 ERROR [EjbParsingDeployer] Error during deployment:
jar:file:/home/rachmatowicz/jms-trunk/testsuite/output/lib/jmsra.jar!/
org.jboss.deployers.spi.DeploymentException: Error parsing meta data
META-INF/ejb-jar.xml
Caused by: org.xml.sax.SAXException: The content of element type "session" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home?,remote?,local-home?,local?,ejb-class,session-type,transaction-type,env-entry*,ejb-ref*,ejb-local-ref*,security-role-ref*,security-identity?,resource-ref*,resource-env-ref*)".
@
jar:file:/home/rachmatowicz/jms-trunk/testsuite/output/lib/jmsra.jar!/META-INF/ejb-jar.xml[44,18]
at
org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.error(SaxJBossXBParser.java:348)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at
org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:160)
... 57 more
the ejb-jar.xml file:
---------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-ja\r_2_0.dtd">
<ejb-jar>
<description>Queue Publisher</description>
<display-name>PublisherBean</display-name>
<enterprise-beans>
<session>
<ejb-name>JMSSession</ejb-name>
<home>org.jboss.test.jmsra.bean.JMSSessionHome</home>
<remote>org.jboss.test.jmsra.bean.JMSSession</remote>
<ejb-class>org.jboss.test.jmsra.bean.JMSSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<display-name>Publisher</display-name>
<ejb-name>QueuePublisher</ejb-name>
<home>org.jboss.test.jmsra.bean.PublisherHome</home>
<remote>org.jboss.test.jmsra.bean.Publisher</remote>
<ejb-class>org.jboss.test.jmsra.bean.PublisherBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>A Queue ConnectionFactory</description>
<res-ref-name>jms/MyQueueConnection</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>A Queue </description>
<res-ref-name>jms/QueueName</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<ejb-ref>
<ejb-ref-name>ejb/PublisherCMP</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>org.jboss.test.jmsra.bean.PublisherCMPHome</home>
<remote>org.jboss.test.jmsra.bean.PublisherCMP</remote>
<ejb-link>PublisherCMP</ejb-link>
</ejb-ref>
</session>
<session>
<display-name>TopicPublisher</display-name>
<ejb-name>TopicPublisher</ejb-name>
<home>org.jboss.test.jmsra.bean.PublisherHome</home>
<remote>org.jboss.test.jmsra.bean.Publisher</remote>
<ejb-class>org.jboss.test.jmsra.bean.TopicPublisherBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>A Topic ConnectionFactory</description>
<res-ref-name>jms/MyTopicConnection</res-ref-name>
<res-type>javax.jms.TopicConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>A Topic </description>
<res-ref-name>jms/TopicName</res-ref-name>
<res-type>javax.jms.Topic</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<ejb-ref>
<ejb-ref-name>ejb/PublisherCMP</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>org.jboss.test.jmsra.bean.PublisherCMPHome</home>
<remote>org.jboss.test.jmsra.bean.PublisherCMP</remote>
<ejb-link>PublisherCMP</ejb-link>
</ejb-ref>
</session>
<session>
<display-name>QueueRec</display-name>
<ejb-name>QueueRec</ejb-name>
<home>org.jboss.test.jmsra.bean.QueueRecHome</home>
<remote>org.jboss.test.jmsra.bean.QueueRec</remote>
<ejb-class>org.jboss.test.jmsra.bean.QueueRecBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>A Queue ConnectionFactory</description>
<res-ref-name>jms/MyQueueConnection</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>A Queue </description>
<res-ref-name>jms/QueueName</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
<entity>
<display-name>Publisher Entity</display-name>
<ejb-name>PublisherCMP</ejb-name>
<home>org.jboss.test.jmsra.bean.PublisherCMPHome</home>
<remote>org.jboss.test.jmsra.bean.PublisherCMP</remote>
<ejb-class>org.jboss.test.jmsra.bean.PublisherCMPBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>True</reentrant>
<cmp-version>1.x</cmp-version>
<cmp-field>
<description>Nr</description>
<field-name>nr</field-name>
</cmp-field>
<primkey-field>nr</primkey-field>
</entity>
<message-driven>
<ejb-name>TopicAdapter</ejb-name>
<ejb-class>org.jboss.test.jmsra.bean.TopicAdapter</ejb-class>
<message-selector></message-selector>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
<resource-ref>
<description>A Queue ConnectionFactory</description>
<res-ref-name>jms/MyQueueConnection</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>A Queue </description>
<res-ref-name>jms/QueueName</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>TopicAdapter</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>