I have a modular project in which, for every single module, I use jaxb2-maven-plugin to compile XSD files with xjc. Now, suppose the modules are compiled in the order A-->B. For A everything works fine (i.e. I get the *XsdImpl.java), but for B I get the following:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc (model) on project B: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc (model) on project B: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:352)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.xerces.impl.dv.DVFactoryException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
at org.apache.xerces.impl.dv.DTDDVFactory.getInstance(Unknown Source)
at org.apache.xerces.impl.dv.DTDDVFactory.getInstance(Unknown Source)
at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.<init>(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.<init>(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(Unknown Source)
at org.apache.xerces.jaxp.validation.XMLSchemaValidatorComponentManager.<init>(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.validation.AbstractXMLSchema.newValidatorHandler(Unknown Source)
at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:47)
at com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl$1$1.startElement(AnnotationParserFactoryImpl.java:136)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.startElement(NGCCRuntime.java:214)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at com.sun.tools.xjc.reader.ExtensionBindingChecker.startElement(ExtensionBindingChecker.java:271)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker.startElement(IncorrectNamespaceURIChecker.java:97)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.startElement(CustomizationContextChecker.java:172)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at com.sun.tools.xjc.ModelLoader$SpeculationChecker.startElement(ModelLoader.java:427)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at com.sun.tools.xjc.reader.internalizer.VersionChecker.startElement(VersionChecker.java:78)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
at com.sun.xml.xsom.parser.JAXPParser.parse(JAXPParser.java:79)
at com.sun.tools.xjc.ModelLoader$2.parse(ModelLoader.java:451)
at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:237)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:298)
at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:87)
at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:147)
at com.sun.tools.xjc.ModelLoader.createXSOMSpeculative(ModelLoader.java:468)
at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:338)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:145)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:91)
at com.sun.tools.xjc.Driver.run(Driver.java:287)
at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:301)
... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Both the modules use the same configuration for the plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<id>model</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<extension>true</extension>
<clearOutputDir>false</clearOutputDir>
<bindingDirectory>${basedir}/src/main/resources/xsd</bindingDirectory>
<outputDirectory>${basedir}/src/main/generated</outputDirectory>
<schemaDirectory>${basedir}/src/main/generated/xsd</schemaDirectory>
<schemaFiles>base.xsd</schemaFiles>
<staleFile>${project.build.directory}/generated-sources/jaxb/.staleFlag-model</staleFile>
</configuration>
</execution>
</executions>
</plugin>
The error comes always for the second module (it doesn't matter whether A or B).
I've spent a lot of time trying to figure out what happens behind the scenes but unfortunately without success...
For example, I would like to understand what happens upon the first execution here:
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
--->>> at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
I would guess another class is used instead of org.apache.xerces.jaxp.SAXParserImpl, but somehow org.apache.xerces.jaxp.SAXParserImpl is selected the 2nd time.. Do you know how could I proof this? Or did anybody experience the same issue already?
Thanks in advance a lot for any hint/help!
Bye
The issue is that you have inadvertently provided a JAXP implementation without the JAXP API, that is incompatible with the JAXP API that is bundled with the JRE.
To solve this issue, I added JAXP API + implementation dependencies to all jaxb2 plugins in my project:
</executions>
<dependencies>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.04</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
</dependencies>
</plugin>
Remember to update all jaxb2 plugins, not just the failing one. This is because plugin dependencies are resolved only once when the plugin is executed for the first time. This may or may not be the module where the failure occurs.
== EDIT ==
Keep in mind that since Java 1.6, all the necessary JAXP, JAXB, xerces, xalan, JAX-WS RI, SAAJ and related classes are bundled in the JRE library.
You do not need to include any of these deps in your project, unless you're building with an archaic JDK (1.5 or older).
So, if you remove JAXB dependencies from your POM (and maybe upgrade to the latest jaxb2-maven-plugin), your build will probably work fine.
I had the similar issue and by changing version number for below Maven compiler from 1.9 to 3.1 worked for me. In my POM i had made this change at 2 places under plugins...
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
Had a similar problem when including an old jar in my application. In my pom file I used exclusions to clear up the problem.
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
Related
I am trying to deploy my webapp to tomcat7 on Amazon AWS EC2 instance using maven from my local system, but I am continuously getting this error
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project EnrollItWeb: Cannot invoke Tomcat mana
ger: Connection reset by peer: socket write error -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) o
n project EnrollItWeb: Cannot invoke Tomcat manager
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:68)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
at org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:181)
at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
at org.apache.tomcat.maven.common.deployer.TomcatManager$RequestEntityImplementation.writeTo(TomcatManager.java:880)
at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:89)
at org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)
at org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:117)
at org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:265)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:203)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:236)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:682)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.tomcat.maven.common.deployer.TomcatManager.invoke(TomcatManager.java:742)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deployImpl(TomcatManager.java:705)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deploy(TomcatManager.java:388)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:82)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:132)
... 23 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
I have added the plugin in pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://{my-ip}:{my-port}/manager/html</url>
<server>{server-name}</server>
<path>/{context-path}</path>
</configuration>
</plugin>
and corresponding server setting in $MAVEN_HOME/conf/settings.xml
<server>
<id>{server-name}</id>
<username>{username}</username>
<password>{password}</password>
</server>
I am having Ubuntu instance at AWS with tomcat installed at root.
Try this:
<url>http://{my-ip}:{my-port}/manager/text</url> instead of <url>http://{my-ip}:{my-port}/manager/html</url>
Try to add in pom.xml this lines:
<username>YourUserName</username>
<password>YourPassword</password>
inside configuration block, like this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://{my-ip}:{my-port}/manager/html</url>
<server>{server-name}</server>
<path>/{context-path}</path>
<username>YourUserName</username>
<password>YourPassword</password>
</configuration>
</plugin>
I am running into problems using the features-maven-plugin with version ranges defined in my dependencies.
It works fine if I don't use version ranges.
Is this a known issue or am I doing something wrong?
It says :
-
[INFO] -- Start generating H:\WDP\workspace\com.company.ssb.pm.ilexamplebundle\target\classes\feature.xml --
[INFO] Generating feature org.osgi.core from org.osgi:org.osgi.core:jar:4.3.1:provided
[INFO] adding bundle org.osgi:org.osgi.core:jar:4.3.1:provided
[INFO] Generating feature api from com.company.ssb.nbda.cpm:api:jar:0.9.1:compile
[WARNING] Unable to retrieve metadata for com.company.ssb.cpm.common:pmcore:jar:[0.1,):compile, not including dependencies for it
Downloading: http://artifacts.ijk.company.se:8081/nexus/content/groups/public/com/company/ssb/cpm/common/pmcore/[0.1,)/pmcore-[0.1,).jar
[WARNING] Unable to determine if com.company.ssb.cpm.common:pmcore:jar:[0.1,):compile is a bundle; defaulting to false
org.apache.maven.artifact.resolver.ArtifactResolutionException: Could not transfer artifact com.company.ssb.cpm.common:pmcore:jar:[0.1,) from/to artifacts (http://artifacts.ijk.company.se:8081/nexus/content/groups/public/): Illegal character in path at index 102: http://artifacts.ijk.company.se:8081/nexus/content/groups/public/com/company/ssb/cpm/common/pmcore/[0.1,)/pmcore-[0.1,).jar
com.company.ssb.cpm.common:pmcore:jar:null
from the specified remote repositories:
artifacts (http://artifacts.ijk.company.se:8081/nexus/content/groups/public/, releases=true, snapshots=true)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:232)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:164)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:555)
at org.apache.karaf.tooling.features.GenerateFeaturesFileMojo.isBundle(GenerateFeaturesFileMojo.java:407)
at org.apache.karaf.tooling.features.GenerateFeaturesFileMojo.writeBundle(GenerateFeaturesFileMojo.java:300)
at org.apache.karaf.tooling.features.GenerateFeaturesFileMojo.writeBundle(GenerateFeaturesFileMojo.java:292)
at org.apache.karaf.tooling.features.GenerateFeaturesFileMojo.writeProjectDependencyFeatures(GenerateFeaturesFileMojo.java:256)
at org.apache.karaf.tooling.features.GenerateFeaturesFileMojo.populateProperties(GenerateFeaturesFileMojo.java:197)
at org.apache.karaf.tooling.features.GenerateFeaturesFileMojo.execute(GenerateFeaturesFileMojo.java:172)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.company.ssb.cpm.common:pmcore:jar:[0.1,) from/to artifacts (http://artifacts.ijk.company.se:8081/nexus/content/groups/public/): Illegal character in path at index 102: http://artifacts.ijk.company.se:8081/nexus/content/groups/public/com/company/ssb/cpm/common/pmcore/[0.1,)/pmcore-[0.1,).jar
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:222)
... 29 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.company.ssb.cpm.common:pmcore:jar:[0.1,) from/to artifacts (http://artifacts.ijk.company.se:8081/nexus/content/groups/public/): Illegal character in path at index 102: http://artifacts.ijk.company.se:8081/nexus/content/groups/public/com/company/ssb/cpm/common/pmcore/[0.1,)/pmcore-[0.1,).jar
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1016)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1004)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:725)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 102: http://artifacts.ijk.company.se:8081/nexus/content/groups/public/com/company/ssb/cpm/common/pmcore/[0.1,)/pmcore-[0.1,).jar
at java.net.URI.create(URI.java:859)
at org.apache.maven.wagon.providers.http.httpclient.client.methods.HttpGet.<init>(HttpGet.java:69)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:841)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:660)
... 4 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 102: http://artifacts.ijk.company.se:8081/nexus/content/groups/public/com/company/ssb/cpm/common/pmcore/[0.1,)/pmcore-[0.1,).jar
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:595)
at java.net.URI.create(URI.java:857)
... 10 more
[ERROR] unable to find suitable bundle for artifact 'com.company.ssb.cpm.common:pmcore:jar:[0.1,):compile'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Maven version is 3.2.2
There is a version 0.1.0 jar in the {user home}.m2\repository\com\company\ssb\pm\common\pmcore\0.1.0
My pom.xml is
...
<dependency>
<groupId>com.company.ssb.nbda.pm</groupId>
<artifactId>api</artifactId>
<version>0.9.1</version>
</dependency>
....
...
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>2.3.5</version>
<executions>
<execution>
<id>generate-features-file</id>
<goals>
<goal>generate-features-file</goal>
</goals>
<configuration>
<karafVersion>2.3.5</karafVersion>
</configuration>
</execution>
</executions>
</plugin>
...
The pom in com/company/ssb/nbda/pm/api/0.9.1/ is as follows:
...
<groupId>com.company.ssb.nbda.pm</groupId>
<artifactId>api</artifactId>
<version>0.9.1</version>
<dependencies>
<dependency>
<groupId>com.company.ssb.pm.common</groupId>
<artifactId>pmcore</artifactId>
<version>[0.1,)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.company.ssb.cil.client</groupId>
<artifactId>service</artifactId>
<version>[0.10,)</version>
<scope>compile</scope>
</dependency>
...
Its most likely a bug. I just dug into the code of Karaf and Maven, but couldn't find the correct place in the time frame I set myself for this, but some other interesting things, have a read:
I noticed that your Karaf 2.3.5 uses maven 3.0. alpha 2. So, most likely upgrading to Karaf 3.0.1 will help you but keep in mind that the commands for feature-maven-plugin have changed. If not, file a bug report with the data from this question here: https://issues.apache.org/jira/browse/KARAF
I took a look into the GenerateFeaturesFileMojo.java.
The method thats failing there (line 407) contains the code that searches the META-INF/MANIFEST.MF for bundle informations.
This invokes the DefaultArtifactResolver.java (as you can also see in your stack trace) on a deprecated method, where the url is constructed through the ArtifactRequest.java (that you can't see in stack trace)
From there it continues into the maven code of resolving Artifacts, this is code that works well in Maven, so I assumed it would do so here, given that the Artifact information is correct.
So I started poking around the Karef code to figure out how the Artifact Objects are build in the first place but couldn't understand it easily, so I tried to figure out where the Artifacts were build and came across comments (and code) that said things like "#TODO: That works for now but it should be fixed" at places where the version came into the artifacts.
So, while this unfortunately is not a definite answer, your approach should work, if it doesn't its a bug.
I am using maven to run JUnit Selenium tests as part of the build. I get the error shown in the stack trace below.
I looked at essentially all other relevant posts out there, but none address the issue of the latest version of Firefox and Selenium (2.4.0) and the issue still happening. Most past posts claim that this issue is fixed with the Selenium 1.0.3 and beyond.
Furthermore, I tried to go to the location of the parent.lock file to delete it as a work-around, but the .lock file was not visible. I tried specifying an alternate firefox profile, but this doesn't seem to matter either.
Why is it not allowing me to open Firefox when it is specifying a .lock file that does not exist? (I have "View hidden files/folders" turned on)
Also, here is my pom.xml's plugin XML:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<browser>*firefox</browser>
<suite>mywar/src/test/com/company/myapp/seleniumtest/GPATestSuite.java</suite>
<startURL>http://localhost:8080</startURL>
</configuration>
<executions>
<execution>
<id>run-selenium-tests</id>
<phase>integration-test</phase>
<goals>
<goal>selenese</goal>
</goals>
<configuration>
<firefoxProfileTemplate>selenium</firefoxProfileTemplate>
</configuration>
</execution>
</executions>
</plugin>
Stack trace:
Execution run-selenium-tests of goal org.codehaus.mojo:selenium-maven-plugin:2.3:selenese failed: Firefox refused shutdown while preparing a profile
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution run-selenium-tests of goal org.codehaus.mojo:selenium-maven-plugin:2.3:selenese failed: F irefox refused shutdown while preparing a profile
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more Caused by: java.lang.RuntimeException: Firefox refused shutdown while preparing a profile
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:367)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:120)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:90)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:405)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:110)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:132)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap.invoke(PojoMetaMethodSite.java:209)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.mojo.selenium.SeleneseMojo.execute(SeleneseMojo.groovy:156)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
... 20 more Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\Users\ratwood\AppData\Local\ Temp\customProfileDir850445\parent.lock
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:318)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:365)
... 36 more [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
My maven 3.0.3 build has a -Xmx1G and -XX:MaxPermSize=500M set in Jenkins. however, when I do a deploy, I always get
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:61)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:492)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:457)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:411)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:392)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:365)
at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:825)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:465)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:278)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:215)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:480)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:188)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Artifact to deploy is 283Mbig. what can I do to have it correctly deployed ?
This issue is caused by this bug. As suggested in the link, simply use webdav to deploy.
Consider doing the following:
<project>
[...]
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0</version>
</extension>
</extensions>
</plugin>
</build>
...
<distributionManagement>
<site>
<id>sample-project.website</id>
<url>dav:https://dav.sample.com/sites/sample-project</url>
</site>
</distributionManagement>
...
</project>
I've had this issue before. I believe it happens only with artifacts with a size of >= 256 MB.
After switching to the webdav deployment method, you can also reduce your memory settings. (if you've specifically modified them just due to the memory issue during the deployment).
This answer to say simply that #olamy was right : upgrading to maven 3.0.4 solved that issue.
I'm try to run a system my group made using Maven and Eclipse, but when I try to use mvn jetty:run, this error appears:
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:52)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:975)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:586)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:349)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:102)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:162)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
at org.eclipse.jetty.server.Server.doStart(Server.java:228)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:69)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:433)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:377)
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:546)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
2012-07-10 13:35:25.948:INFO::Started SelectChannelConnector#0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.
My teammate's systems can run it fine, and we basically have the same settings, repositories, and we are all using Maven2.
Any ideas as to why the error occurs?
Well, you appear to be needing the asm library. The java.lang.NoClassDefFoundError means you simply don't have the org.objectweb.asm.ClassVisitor class on your classpath. I don't know which version of the Jetty plugin you're using, (if you'd paste your pom.xml), I could be more precise.
Basically, you need one of these dependencies:
Either add this in your project's <dependencies/>:
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
Or add this as a <dependency> of your Jetty plugin:
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<version>8.1.0.RC4</version>
</dependency>
(Apparently, this dependency contains the ASM classes).
In the future, in order to resolve noclassdef-s, I'd recommend you look up the dependencies the class is part of via some site like:
http://www.mvnrepository.net/
http://www.jarvana.com/
http://search.maven.org/ (using 'Advanced Search')
http://www.findjar.com/
If it works for your colleagues but not for you, then it may be due to a corrupt local repository on your machine. Try renaming or deleting your local repository directory to force Maven to download your plugins and dependencies again.