1 Reply Latest reply on Sep 20, 2011 12:47 AM by Ashim Mishra

    running Junit tests on Eclipse with Embedded AS

    Ashim Mishra Newbie

      Hello Everyone,

       

      I am trying to run a simple EJB Junit test in Eclipse, I have put the following jars related to JBoss in the classpath for the project:

      javax.inject.jar

      jboss-bootstrap-api-as.jar

      jboss-bootstrap-api-mc.jar

      jboss-bootstrap-api.jar

      jboss-bootstrap-impl-as.jar

      jboss-bootstrap-impl-base.jar

      jboss-bootstrap-impl-mc.jar

      jboss-bootstrap-spi-as.jar

      jboss-bootstrap-spi-mc.jar

      jboss-bootstrap-spi.jar

      jboss-common-core.jar

      jboss-dependency.jar

      jboss-deployers-client-spi.jar

      jboss-deployers-core-spi.jar

      jboss-embedded-api.jar

      jboss-embedded-core.jar

      jboss-kernel.jar

      jboss-logging.jar

      jboss-logmanager.jar

      jboss-mdr.jar

      jboss-reflect.jar

      jbossxb.jar

      shrinkwrap-api-1.0.0-alpha-12.jar

      shrinkwrap-impl-base-1.0.0-alpha-12.jar

      shrinkwrap-spi-1.0.0-alpha-12.jar

       

      I have picked up these jars from JBoss 6.0 final release lib folders.

       

      I am using this code snippet to start the server:


      jbossServer = JBossASEmbeddedServerFactory.createServer();

      jbossServer.getConfiguration().serverName("junitTest").jbossHome("D://jboss6");

      jbossServer.start();

       

      The error I am getting is:

      java.lang.Exception: Encountered exception in server startup

                at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:325)

                at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.doStart(AbstractMCServerBase.java:257)

                at org.jboss.bootstrap.impl.as.server.AbstractJBossASServerBase.doStart(AbstractJBossASServerBase.java:381)

                at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:413)

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

      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: xml_stream@43,121

                at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:224)

                at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:193)

                at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:171)

                at org.jboss.bootstrap.impl.mc.deployer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:188)

                at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:310)

                ... 4 more

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:classloader:1.0}classloader cannot appear in this position. Expected content of {urn:jboss:bean-deployer:2.0}deployment is unordered_sequence: {urn:jboss:bean-deployer:2.0}stop? {urn:jboss:bean-deployer:2.0}destroy? {urn:jboss:bean-deployer:2.0}annotation* {urn:jboss:bean-deployer:2.0}alias* {urn:jboss:bean-deployer:2.0}start? {urn:jboss:bean-deployer:2.0}classloader? {urn:jboss:bean-deployer:2.0}create? {choice}*

                at org.jboss.xb.binding.sunday.unmarshalling.ElementPosition.nextPosition(ElementPosition.java:193)

                at org.jboss.xb.binding.sunday.unmarshalling.ElementPosition.startParticle(ElementPosition.java:475)

                at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:202)

                at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.startElement(SaxJBossXBParser.java:401)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)

                at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.startElement(XIncludeHandler.java:908)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)

                at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)

                at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:209)

                ... 8 more

       

       

      I figured out that the xml its trying to parse is classloader.xml from <server>/conf/bootstrap.

       

      Can someone please tell me what I am doing wrong here.

      Thanks a lot.