1 Reply Latest reply on Jan 6, 2016 7:14 AM by Matous Jobanek

    Arquiilian + How do I copy and modify application.xml?

    Raghunath Kale Newbie

      I am doing like below code, this code is not working on linux:

       

      Node applicationXmlNode = targetEar.get(ArchiveDescriptors.APPLICATION_XML.fullPath());

              InputStream applicationXmlNodeInputStream = applicationXmlNode.getAsset().openStream();

              ApplicationDescriptor appDescriptor = Descriptors.importAs(ApplicationDescriptor.class).fromStream(applicationXmlNodeInputStream);

       

       

              if (targetModuleTypeConfig instanceof JavaArchiveConfig) {

                  appDescriptor.createModule().ejb(moduleName);

              } else if (targetModuleTypeConfig instanceof WebArchiveConfig) {

                  appDescriptor.createModule().getOrCreateWeb().contextRoot(moduleName.replaceAll(".war", "")).webUri(moduleName);

              }

              this.descriptorUtils.deleteIfExists(targetEar, ArchiveDescriptors.APPLICATION_XML.fullPath());

              targetEar.addAsManifestResource(new StringAsset(appDescriptor.exportAsString()), EnricherConstants.APPLICATION_XML_FILE_NAME);

              try {

                  applicationXmlNodeInputStream.close();

              } catch (IOException ioe) {

                  throw new RuntimeException(ioe);

              }

       

       

      Getting below exception:

      org.jboss.shrinkwrap.descriptor.api.DescriptorImportException: Could not import XML from stream

        at org.jboss.shrinkwrap.descriptor.spi.node.dom.XmlDomNodeImporterImpl.importAsNode(XmlDomNodeImporterImpl.java:80)

        at org.jboss.shrinkwrap.descriptor.spi.node.dom.XmlDomNodeImporter.importAsNode(XmlDomNodeImporter.java:46)

        at org.jboss.shrinkwrap.descriptor.spi.node.NodeDescriptorImporterBase.fromStream(NodeDescriptorImporterBase.java:72)

        at org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.fromStream(DescriptorImporterBase.java:155)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.EnterpriseArchiveEnricherImpl.addOrReplaceApplicationXmlDescriptorForEjbModule(EnterpriseArchiveEnricherImpl.java:206)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.EnterpriseArchiveEnricherImpl.syncDescriptorsForJavaArchives(EnterpriseArchiveEnricherImpl.java:196)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.EnterpriseArchiveEnricherImpl.configureJavaArchives(EnterpriseArchiveEnricherImpl.java:135)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.EnterpriseArchiveEnricherImpl.enrichThis(EnterpriseArchiveEnricherImpl.java:106)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.EnterpriseArchiveEnricherImpl.enrichNew(EnterpriseArchiveEnricherImpl.java:99)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.EnterpriseArchiveEnricherImpl.enrich(EnterpriseArchiveEnricherImpl.java:49)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.impl.dsl.grammar.EnterpriseArchiveConfigBuilderGrammarImpl.enrich(EnterpriseArchiveConfigBuilderGrammarImpl.java:143)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.builders.cdi.alternatives.AlternativesBuilder.buildEnrichedEarBerriesWithSpecializationsEjbJar(AlternativesBuilder.java:83)

        at com.ericsson.oss.pmic.mediation.test.addons.enrichers.tryouts.cdi.alternatives.CdiAlternativesTest.testEnrichedEarBerriesWithSpecializationsEjbJar(CdiAlternativesTest.java:55)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)

        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)

        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

        at org.junit.runners.Suite.runChild(Suite.java:128)

        at org.junit.runners.Suite.runChild(Suite.java:24)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

        at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

        at org.junit.runner.JUnitCore.run(JUnitCore.java:136)

        at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:62)

        at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:139)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)

        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

      Caused by: java.net.ConnectException: Connection timed out

        at java.net.PlainSocketImpl.socketConnect(Native Method)

        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)

        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)

        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)

        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

        at java.net.Socket.connect(Socket.java:579)