1 Reply Latest reply on Mar 26, 2009 6:59 AM by Olivier Thierry

    "Context already exists" error when deploying EAR

    Olivier Thierry Apprentice

      Hi,

      I try to deploy an EAR on JBoss AS 5.0.1 but I have the following exception I can't understand :

      10:38:08,918 ERROR [ProfileServiceBootstrap] Failed to load profile:
      org.jboss.deployers.spi.DeploymentException: Exception determining structure: AbstractVFSDeployment(t4-ihm-self-ear-1.0-SNAPSHOT.ear)
       at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
       at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:85)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.determineStructure(MainDeployerImpl.java:1000)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.determineDeploymentContext(MainDeployerImpl.java:440)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:390)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:300)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:303)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
       at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
       at org.jboss.Main.boot(Main.java:209)
       at org.jboss.Main$1.run(Main.java:547)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.RuntimeException: Error determining structure: t4-ihm-self-ear-1.0-SNAPSHOT.ear
       at org.jboss.deployment.EARStructure.determineStructure(EARStructure.java:293)
       at org.jboss.deployers.vfs.plugins.structure.StructureDeployerWrapper.determineStructure(StructureDeployerWrapper.java:73)
       at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.doDetermineStructure(VFSStructuralDeployersImpl.java:196)
       at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.determineStructure(VFSStructuralDeployersImpl.java:221)
       at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:77)
       ... 10 more
      Caused by: java.lang.IllegalStateException: Context already exists with path 'lib/t4-core-all-1.0-SNAPSHOT.jar' contexts=[ContextInfoImpl{path= metaData=[META-INF] classPath=[ClassPathEntryImpl{path=lib/activation-1.1.jar}, ClassPathEntryImpl{path=lib/ant-1.7.0.jar}, ClassPathEntryImpl{path=lib/ant-launcher-1.7.0.jar}, ClassPathEntryImpl{path=lib/antlr-2.7.2.jar}, ClassPathEntryImpl{path=lib/antlr-runtime-3.1.2.jar}, ClassPathEntryImpl{path=lib/cglib-nodep-2.1_3.jar}, ClassPathEntryImpl{path=lib/commons-beanutils-1.8.0.jar}, ClassPathEntryImpl{path=lib/commons-codec-1.3.jar}, ClassPathEntryImpl{path=lib/commons-collections-3.2.1.jar}, ClassPathEntryImpl{path=lib/commons-digester-1.7.jar}, ClassPathEntryImpl{path=lib/commons-fileupload-1.2.1.jar}, ClassPathEntryImpl{path=lib/commons-io-1.4.jar}, ClassPathEntryImpl{path=lib/commons-lang-2.4.jar}, ClassPathEntryImpl{path=lib/commons-logging-1.1.1.jar}, ClassPathEntryImpl{path=lib/commons-validator-1.3.1.jar}, ClassPathEntryImpl{path=lib/dom4j-1.6.1.jar}, ClassPathEntryImpl{path=lib/ehcache-1.2.jar}, ClassPathEntryImpl{path=lib/ejb3-persistence-1.0.1.GA.jar}, ClassPathEntryImpl{path=lib/groovy-all-1.5.7.jar}, ClassPathEntryImpl{path=lib/hibernate-3.2.6.ga.jar}, ClassPathEntryImpl{path=lib/hibernate-annotations-3.3.1.GA.jar}, ClassPathEntryImpl{path=lib/hibernate-commons-annotations-3.0.0.ga.jar}, ClassPathEntryImpl{path=lib/hibernate-entitymanager-3.3.2.GA.jar}, ClassPathEntryImpl{path=lib/hibernate-validator-3.0.0.GA.jar}, ClassPathEntryImpl{path=lib/javassist-3.4.GA.jar}, ClassPathEntryImpl{path=lib/jaxb-api-2.1.jar}, ClassPathEntryImpl{path=lib/jaxws-api-2.1.jar}, ClassPathEntryImpl{path=lib/jaxws-rt-2.1.4.jar}, ClassPathEntryImpl{path=lib/jboss-el-2.0.2.CR1.jar}, ClassPathEntryImpl{path=lib/jboss-seam-ioc-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-jul-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-mail-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-remoting-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-ui-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jbpm-jpdl-3.2.3.jar}, ClassPathEntryImpl{path=lib/jline-0.9.94.jar}, ClassPathEntryImpl{path=lib/joda-time-1.6.jar}, ClassPathEntryImpl{path=lib/jsf-facelets-1.1.15.B1.jar}, ClassPathEntryImpl{path=lib/jta-1.0.1B.jar}, ClassPathEntryImpl{path=lib/log4j-1.2.14.jar}, ClassPathEntryImpl{path=lib/mimepull-1.2.jar}, ClassPathEntryImpl{path=lib/resolver-20050927.jar}, ClassPathEntryImpl{path=lib/saaj-api-1.3.jar}, ClassPathEntryImpl{path=lib/saaj-impl-1.3.1.jar}, ClassPathEntryImpl{path=lib/sjsxp-1.0.1.jar}, ClassPathEntryImpl{path=lib/stax-api-1.0.jar}, ClassPathEntryImpl{path=lib/stax-ex-1.2.jar}, ClassPathEntryImpl{path=lib/streambuffer-0.7.jar}, ClassPathEntryImpl{path=lib/stringtemplate-3.2.jar}, ClassPathEntryImpl{path=lib/t4-core-all-1.0-SNAPSHOT.jar}, ClassPathEntryImpl{path=lib/t4-ihm-commons-1.0-SNAPSHOT.jar}, ClassPathEntryImpl{path=lib/jboss-el-2.0.2.CR1.jar}, ClassPathEntryImpl{path=lib/jboss-seam-ioc-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-mail-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-ui-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/jboss-seam-jul-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/commons-beanutils-1.8.0.jar}, ClassPathEntryImpl{path=lib/jsf-facelets-1.1.15.B1.jar}, ClassPathEntryImpl{path=lib/jboss-seam-remoting-2.1.1.GA.jar}, ClassPathEntryImpl{path=lib/t4-utils-1.0-SNAPSHOT.jar}, ClassPathEntryImpl{path=}] comparator=org.jboss.system.deployers.LegacyDeploymentContextComparator}, ContextInfoImpl{path=lib/t4-core-all-1.0-SNAPSHOT.jar metaData=[META-INF] classPath=[ClassPathEntryImpl{path=lib/t4-core-all-1.0-SNAPSHOT.jar}]}]
       at org.jboss.deployers.plugins.structure.StructureMetaDataImpl.addContext(StructureMetaDataImpl.java:59)
       at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.determineStructure(VFSStructuralDeployersImpl.java:163)
       at org.jboss.deployers.vfs.spi.structure.StructureContext.determineChildStructure(StructureContext.java:294)
       at org.jboss.deployment.EARStructure.determineStructure(EARStructure.java:275)
       ... 14 more
      


      My EAR root directory has one WAR module and four EJB3 modules. I also have an EJB module in "lib" directory (t4-core-all-1.0-SNAPSHOT.jar) that contains EJB3 session beans (as Seam components), JPA entities and a persistence.xml file. I put this file in lib directory so that the persistence unit can be seen from other modules in the EAR.

      My application.xml file is as following :
      <?xml version="1.0" encoding="UTF-8"?>
      <application 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/application_5.xsd" version="5">
       <description>JBoss Seam Enterprise Application</description>
       <display-name>t4-ihm-self-ear</display-name>
       <module>
       <ejb>lib/t4-core-all-1.0-SNAPSHOT.jar</ejb>
       </module>
       <module>
       <ejb>t4-module-utils-core-1.0-SNAPSHOT.jar</ejb>
       </module>
       <module>
       <ejb>t4-module-commons-core-1.0-SNAPSHOT.jar</ejb>
       </module>
       <module>
       <ejb>t4-module-gt-core-1.0-SNAPSHOT.jar</ejb>
       </module>
       <module>
       <ejb>t4-ihm-self-ejb-1.0-SNAPSHOT.jar</ejb>
       </module>
       <module>
       <web>
       <web-uri>t4-ihm-self-web-1.0-SNAPSHOT.war</web-uri>
       <context-root>/t4-self</context-root>
       </web>
       </module>
       <module>
       <ejb>jboss-seam-2.1.1.GA.jar</ejb>
       </module>
       <library-directory>lib</library-directory>
      </application>


      Anyone has an idea what happens ?

      Regards,

      Olivier