I am getting following error when generating POJO classes using xsd:
Exception in thread "main" java.lang.Error: java.lang.reflect.InvocationTargetException
at com.sun.tools.xjc.reader.Ring.get(Ring.java:113)
at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.<init>(BGMBuilder.java:147)
at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:117)
at com.sun.tools.xjc.ModelLoader.annotateXMLSchema(ModelLoader.java:425)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:174)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:119)
at com.sun.tools.xjc.Driver.run(Driver.java:333)
at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:316)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
at com.sun.tools.xjc.reader.Ring.get(Ring.java:102)
... 30 more
Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException
at com.sun.tools.xjc.reader.Ring.get(Ring.java:113)
at com.sun.tools.xjc.reader.xmlschema.BindingComponent.getClassSelector(BindingComponent.java:65)
at com.sun.tools.xjc.reader.xmlschema.ColorBinder.<init>(ColorBinder.java:62)
at com.sun.tools.xjc.reader.xmlschema.BindGreen.<init>(BindGreen.java:63)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
... 33 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
at com.sun.tools.xjc.reader.Ring.get(Ring.java:102)
... 37 more
Caused by: java.lang.NoClassDefFoundError: javax/activation/MimeTypeParseException
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3405)
at java.base/java.lang.Class.getConstructor0(Class.java:3610)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2786)
at com.sun.tools.xjc.reader.Ring.get(Ring.java:100)
at com.sun.tools.xjc.reader.xmlschema.DefaultClassBinder.<init>(DefaultClassBinder.java:98)
at com.sun.tools.xjc.reader.xmlschema.ClassSelector.<init>(ClassSelector.java:214)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
... 40 more
Caused by: java.lang.ClassNotFoundException: javax.activation.MimeTypeParseException
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 48 more
This is a springboot project, and I have already added jakarta.activation-api in pom. Below is part of pom.xml:
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>1.2.2</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
</plugins>
</build>
I have already looked into these solutions, but are not working:
SOAP Web Service - Can't generate classes from XSD
What is the replacement for javax.activation package in java 9?
I am using java 8, and following this tutorial:
https://www.baeldung.com/spring-boot-soap-web-service
Any help is appreciated.
Compilation is successful after adding in pom.xml. But, still Java POJO classes are not generated. Below is the path available in pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
So, I was able to fix the issue by following these 2 steps:
install Jakarta EE: Web Services (JAX-WS) plugin to Intellij.
follow this to generate the java classes:
https://www.jetbrains.com/help/idea/generate-java-from-xml-schema-using-jaxb-dialog.html
Related
I am trying to update my SpringBoot maven project to Java 17.
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
I had working maven-jaxb2-plugin plugin defined which created java classes successfully from XSD files.
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<id>my_schema</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/my/files</schemaDirectory>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<bindingDirectory>src/main/resources/my/files</bindingDirectory>
<bindingIncludes>
<include>bindings.xml</include>
</bindingIncludes>
<args>
<arg>-extension</arg>
<arg>-Xnamespace-prefix</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
But since the upgrade of java and the plugin I cannot do it.
I definied the necessary dependencies for the plugin:
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
But I still receive an unknown error during maven build:
Oct 19, 2021 10:07:06 PM com.sun.xml.bind.v2.runtime.reflect.opt.Injector <clinit>
SEVERE: null
java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:573)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.<clinit>(Injector.java:197)
at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:81)
at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:179)
at com.sun.xml.bind.v2.runtime.reflect.Accessor$FieldReflection.optimize(Accessor.java:285)
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.<init>(TransducedAccessor.java:235)
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:175)
at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.calcTransducer(RuntimeClassInfoImpl.java:245)
at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getTransducer(RuntimeClassInfoImpl.java:219)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTransducer(RuntimeModelBuilder.java:145)
at com.sun.xml.bind.v2.model.impl.SingleTypePropertyInfoImpl.getTransducer(SingleTypePropertyInfoImpl.java:140)
at com.sun.xml.bind.v2.model.impl.RuntimeAttributePropertyInfoImpl.link(RuntimeAttributePropertyInfoImpl.java:78)
at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.link(ClassInfoImpl.java:1272)
at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.link(RuntimeClassInfoImpl.java:197)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.link(ModelBuilder.java:454)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.link(RuntimeModelBuilder.java:133)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:469)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:303)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1156)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:297)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:286)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:409)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
at com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getCustomizationContext(BindInfo.java:336)
at com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getCustomizationUnmarshaller(BindInfo.java:362)
at com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl$1.<init>(AnnotationParserFactoryImpl.java:85)
at com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl.create(AnnotationParserFactoryImpl.java:84)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.createAnnotationParser(NGCCRuntimeEx.java:401)
at com.sun.xml.xsom.impl.parser.state.annotation.action0(annotation.java:89)
at com.sun.xml.xsom.impl.parser.state.annotation.enterElement(annotation.java:114)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement(NGCCHandler.java:114)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:317)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromEnterElement(NGCCHandler.java:151)
at com.sun.xml.xsom.impl.parser.state.foreignAttributes.enterElement(foreignAttributes.java:91)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement(NGCCHandler.java:114)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:229)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:273)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:309)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:293)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:221)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:257)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.startElement(NGCCRuntime.java:263)
at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
at com.sun.tools.xjc.util.SubtreeCutter.startElement(SubtreeCutter.java:108)
at com.sun.tools.xjc.reader.ExtensionBindingChecker.startElement(ExtensionBindingChecker.java:150)
at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
at com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker.startElement(IncorrectNamespaceURIChecker.java:128)
at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
at com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.startElement(CustomizationContextChecker.java:193)
at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.startElement(DOMForestScanner.java:147)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:244)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:127)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:92)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:100)
at com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:104)
at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:251)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:381)
at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:128)
at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:171)
at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:160)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:516)
at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:360)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:162)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:117)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.loadModel(XJC23Mojo.java:50)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute(XJC23Mojo.java:40)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute(XJC23Mojo.java:28)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:478)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:320)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at java.base/java.lang.Class.getMethod(Class.java:2227)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector$3.run(Injector.java:201)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector$3.run(Injector.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
... 109 more
And I cannot find any useful tipp on the web. Can anyone help me how to fix this issue?
It compiles, when you'll add jaxb-runtime dependency, as below:
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<dependencies>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Notice, that I didn't close all open tags, because those are irrelevant to the question. Those are just open for clarity of where to put jaxb-runtime dependency.
I used 2.3.1 version, and it compiled.
I had a similar error message when migrating my projects and libraries from java 16 to java 17. I was using the -illegal-access=permit option and it was removed in java 17. The above answer didn't solve my problem. My situation was like this. I have a library (let's say x) and an application (let's say y). Application y uses the library x. I added the following dependency to the library x and the problem was solved.
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
But if I add this dependency directly to application y instead of library x, the problem would not be solved.
Upgrading to a newer version helped me.
<version>0.15.1</version>
I am getting an illegal argument exception when running the jmeter-analysis plugin. I have validated all the output .jtl files and it doesn't appear that the xml files are malformed. Below I have posted the maven command I am using to run the performance test suite (which runs fine), as well as my project structure, pom and output. I can't quite figure out what is going on, as everything was actually working before I updated the JMeter test plan in the .jmx. The suite runs fine in the JMeter GUI and runs fine before it gets to the analyze step. Has anyone encountered this before? What can I do to solve this?
Maven
mvn -pl performance-tests clean verify -U -X
Project Structure
Project
Performance Test Module
src
test
jmeter
performance-tests.jmx
resources
properties
artifact_headers.properties
artifact_users.properties
index.html
POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>artifact-id</artifactId>
<groupId>com.group.id</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>performance-tests</artifactId>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<threads>1</threads>
<loops>1</loops>
<ramp>1</ramp>
<delay>1</delay>
<account></account>
<password></password>
</properties>
</profile>
</profiles>
<properties>
<com.artifact.jmeter.test>${project.basedir}/src/test/jmeter/*.jmx</com.artifact.jmeter.test>
<com.artifact.target.environment>https://dev-dot-api-dot-labs-horizon-1.appspot.com</com.artifact.target.environment>
<com.artifact.jmeter.loops>${loops}</com.artifact.jmeter.loops>
<com.artifact.jmeter.threads>${threads}</com.artifact.jmeter.threads>
<com.artifact.jmeter.ramp>${ramp}</com.artifact.jmeter.ramp>
<com.artifact.jmeter.startup.delay>${delay}</com.artifact.jmeter.startup.delay>
<com.artifact.jmeter.account>${account}</com.artifact.jmeter.account>
<com.artifact.jmeter.password>${password}</com.artifact.jmeter.password>
<reportdirectory>${project.build.directory}/results</reportdirectory>
<kg.apc.version>1.4.0</kg.apc.version>
<commons.lang.version>2.6</commons.lang.version>
<net.minidev.version>2.3</net.minidev.version>
<surefire.version>2.19.1</surefire.version>
</properties>
<dependencies>
<dependency>
<groupId>com.vault</groupId>
<artifactId>vault-lib</artifactId>
<version>2.13</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire.version}</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>${net.minidev.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons.lang.version}</version>
</dependency>
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-standard</artifactId>
<version>${kg.apc.version}</version>
</dependency>
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-extras</artifactId>
<version>${kg.apc.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<customPropertiesFiles>
<file>${project.build.directory}/jmeter/bin/properties/artifact_headers.properties</file>
<file>${project.build.directory}/jmeter/bin/properties/artifact_users.properties</file>
</customPropertiesFiles>
<propertiesFilesDirectory>${project.build.directory}/jmeter/bin/properties</propertiesFilesDirectory>
<jmeterExtensions>
<extension>commons-lang:commons-lang:2.6</extension>
<extension>net.minidev:json-smart:2.3</extension>
<artifact>kg.apc:jmeter-plugins-standard:1.4.0</artifact>
<artifact>kg.apc:jmeter-plugins-extras:1.4.0</artifact>
<artifact>kg.apc:jmeter-plugins-extras-libs:1.4.0</artifact>
<artifact>org.apache.jmeter:jorphan:3.0</artifact>
</jmeterExtensions>
<propertiesUser>
<jmeter.loops>${com.artifact.jmeter.loops}</jmeter.loops>
<jmeter.threads>${com.artifact.jmeter.threads}</jmeter.threads>
<jmeter.ramp>${com.artifact.jmeter.ramp}</jmeter.ramp>
<jmeter.account>${com.artifact.jmeter.account}</jmeter.account>
<jmeter.password>${com.artifact.jmeter.password}</jmeter.password>
<RESULTS_PATH>${reportdirectory}</RESULTS_PATH>
</propertiesUser>
<propertiesJMeter>
<aggregate_rpt_pct1>80</aggregate_rpt_pct1>
<aggregate_rpt_pct2>90</aggregate_rpt_pct2>
<aggregate_rpt_pct3>99</aggregate_rpt_pct3>
</propertiesJMeter>
<overrideRootLogLevel>warning</overrideRootLogLevel>
<testResultsTimestamp>false</testResultsTimestamp>
<!--<resultsFileFormat>csv</resultsFileFormat>-->
<resultsDirectory>${reportdirectory}</resultsDirectory>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<version>1.0.6</version>
<executions>
<execution>
<phase>verify</phase>
<id>thread</id>
<goals>
<goal>analyze</goal>
</goals>
<configuration>
<!--<source>${project.build.directory}/**/*.jtl</source>-->
<source>${reportdirectory}/performance-tests.jtl</source>
<targetDirectory>${reportdirectory}/generatedreport</targetDirectory>
<sourceDirFailed>false</sourceDirFailed>
<checkResult>
<throughput>
<threshold>-1</threshold>
<toleranceDirection>UPPER_LOWER_TOLERANCE</toleranceDirection>
<tolerance>5</tolerance>
</throughput>
<errors>
<threshold>-1</threshold>
<toleranceDirection>UPPER_LOWER_TOLERANCE</toleranceDirection>
<tolerance>5</tolerance>
</errors>
</checkResult>
<configurationCharts>
<width>950</width>
<height>500</height>
</configurationCharts>
<maxSamples>50000</maxSamples>
<preserveDirectories>false</preserveDirectories>
<sampleNames>
<sampleName>sample</sampleName>
<sampleName>httpSample</sampleName>
</sampleNames>
<processAllFilesFound>true</processAllFilesFound>
<remoteResourcesFromUntilDateFormat>HH:mm_yyyyMMdd</remoteResourcesFromUntilDateFormat>
<writers>
<!--<com.lazerycode.jmeter.analyzer.writer.SummaryTextToStdOutWriter/>-->
<!--<com.lazerycode.jmeter.analyzer.writer.SummaryTextToFileWriter/>-->
<!--<com.lazerycode.jmeter.analyzer.writer.HtmlWriter/>-->
<!--<com.lazerycode.jmeter.analyzer.writer.DetailsToCsvWriter/>-->
<com.lazerycode.jmeter.analyzer.writer.DetailsToHtmlWriter/>
<com.lazerycode.jmeter.analyzer.writer.ChartWriter/>
</writers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jmeter/bin</outputDirectory>
<resources>
<resource>
<directory>${pom.basedir}/src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Stack Trace
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-analysis-maven-plugin:1.0.6:analyze (thread) on project performance-tests: Error analysing: Null or zero length 'values' argument. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.lazerycode.jmeter:jmeter-analysis-maven-plugin:1.0.6:analyze (thread) on project performance-tests: Error analysing
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error analysing
at com.lazerycode.jmeter.analyzer.AnalyzeMojo.execute(AnalyzeMojo.java:233)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 21 more
Caused by: java.lang.IllegalArgumentException: Null or zero length 'values' argument.
at org.jfree.data.statistics.HistogramDataset.getMinimum(HistogramDataset.java:221)
at org.jfree.data.statistics.HistogramDataset.addSeries(HistogramDataset.java:136)
at com.lazerycode.jmeter.analyzer.writer.ChartWriter.createResponseTimesPlot(ChartWriter.java:188)
at com.lazerycode.jmeter.analyzer.writer.ChartWriter.writeCharts(ChartWriter.java:95)
at com.lazerycode.jmeter.analyzer.writer.ChartWriter.write(ChartWriter.java:65)
at com.lazerycode.jmeter.analyzer.ResultAnalyzer.analyze(ResultAnalyzer.java:47)
at com.lazerycode.jmeter.analyzer.AnalyzeMojo.analyze(AnalyzeMojo.java:318)
at com.lazerycode.jmeter.analyzer.AnalyzeMojo.execute(AnalyzeMojo.java:217)
... 23 more
I have downloaded the plugin and see the exception is happening with ChartWriter component when it doesn't have 'values' to generate charts (I think).
To by-pass it without changing code, you can disable ChartWriter (if you not really need it) by changing in pom as below.
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<version>1.0.6</version>
<executions>
<execution>
<id>create-html-report</id>
<phase>test</phase>
<configuration>
<processAllFilesFound>true</processAllFilesFound>
<source>${project.build.directory}/**/*.jtl</source>
<writers>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToStdOutWriter/>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToFileWriter/>
<com.lazerycode.jmeter.analyzer.writer.HtmlWriter/>
<com.lazerycode.jmeter.analyzer.writer.DetailsToCsvWriter/>
<com.lazerycode.jmeter.analyzer.writer.DetailsToHtmlWriter/>
**<!--<com.lazerycode.jmeter.analyzer.writer.ChartWriter/>-->**
</writers>
</configuration>
<goals>
<goal>analyze</goal>
</goals>
</execution>
</executions>
</plugin>
I've been struggled with this issue for while, finally figured it out.
I installed JMeter-3.2, but copied a jmx file created during version-3.1. After I created a new jmx file under new version, it works.
Not sure you had same experience. Hope it helps.
Remark: This is not an direct answer to the question, but a possible solution to the given exception of jmeter-analysis-maven-plugin.
In my case all tests fail because of server errors (unauthorized). So you first should check the jtl file (here performance-tests.jtl) for valid entries:
<httpSample t="329" lt="329" ts="1551219503246" s="false" lb="/" rc="401" rm="Unauthorized" tn="performancetest 1-6" dt="text" by="932" ng="9" na="9"/>
I get the following error when I run mvn integration-test -e com.example.mymodule:
[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:3.9.5:run-stories-as-embeddables (embeddable-stories) on project com.example.mymodule: Failed to run stories as embeddables: Failure in running embeddable: com.example.mymodule.TheStories: Could not initialize class freemarker.ext.beans.BeansWrapper -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jbehave:jbehave-maven-plugin:3.9.5:run-stories-as-embeddables (embeddable-stories) on project com.example.mymodule: Failed to run stories as embeddables
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
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.apache.maven.plugin.MojoFailureException: Failed to run stories as embeddables
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:20)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.jbehave.core.embedder.Embedder$RunningEmbeddablesFailed: Failure in running embeddable: com.example.mymodule.TheStories
at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:130)
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:18)
... 21 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class freemarker.ext.beans.BeansWrapper
at freemarker.template.ObjectWrapper.<clinit>(ObjectWrapper.java:69)
at freemarker.core.Configurable.<init>(Configurable.java:139)
at freemarker.template.Configuration.<init>(Configuration.java:142)
at freemarker.template.Configuration.<clinit>(Configuration.java:127)
at org.jbehave.core.reporters.FreemarkerProcessor.configuration(FreemarkerProcessor.java:30)
at org.jbehave.core.reporters.FreemarkerProcessor.process(FreemarkerProcessor.java:21)
at org.jbehave.core.reporters.TemplateableViewGenerator.write(TemplateableViewGenerator.java:267)
at org.jbehave.core.reporters.TemplateableViewGenerator.createReports(TemplateableViewGenerator.java:219)
at org.jbehave.core.reporters.TemplateableViewGenerator.generateReportsView(TemplateableViewGenerator.java:110)
at org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:249)
at org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:237)
at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:213)
at org.jbehave.core.junit.JUnitStories.run(JUnitStories.java:20)
at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:121)
... 22 more
When I run mvn dependency:tree -pl com.example.mymodule | grep freemarker I get
[INFO] | +- org.freemarker:freemarker:jar:2.3.19:compile
I used javap to confirm that the class freemarker.ext.beans.BeansWrapper exists in this jar:
javap -classpath C:\Users\CONOR2\.m2\repository\org\freemarker\freemarker\2.3.19\freemarker-2.3.19.jar freemarker.ext.beans.BeansWrapper
Here's the relevant portion of my depdendencies from my pom.xml:
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>3.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>3.9.5</version>
<classifier>resources</classifier>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.jbehave.site</groupId>
<artifactId>jbehave-site-resources</artifactId>
<version>3.2</version>
<type>zip</type>
</dependency>
Here's my plugin section:
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>3.9.5</version>
<executions>
<execution>
<id>unpack-view-resources</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-view-resources</goal>
</goals>
</execution>
<execution>
<id>embeddable-stories</id>
<phase>integration-test</phase>
<configuration>
<includes>
<include>com/example/mymodule/TheStories.java</include>
</includes>
<excludes />
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
<scope>test</scope>
<threads>1</threads>
<metaFilters>
<metaFilter></metaFilter>
</metaFilters>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
I tried this with versions 3.9.5 and 4.0.3, but I get the same error with both versions.
It turns out that the jbehave-maven-plugin was having trouble with log4j. Adding log4j:log4j and org.slf4j:slf4j-log4j as dependencies for the plugin fixed the issue.
I'm writing a client (library) to consume a REST service in order to give users of the library simple get and set methods to work with, hiding complexities of REST APIs.
I'm using jackson 2.4.0 and jersey 2.6 to consume the REST service.
The goal is to create a uber.jar which will be a self-contained jar file with all the dependencies resolved. To achieve this, I'm using Maven shade plugin.
i'm also relocating all the dependent classes using the shade plugin.
My pom file is as below :
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.4.0</jackson.version>
<jersey.version>2.6</jersey.version>
</properties>
<build>
<plugins>
<!-- Shade plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>org</pattern>
<shadedPattern>shaded.org</shadedPattern>
</relocation>
<relocation>
<pattern>com</pattern>
<shadedPattern>shaded.com</shadedPattern>
<excludes>
<exclude>com.example.*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax</pattern>
<shadedPattern>shaded.javax</shadedPattern>
<excludes>
<exclude>javax.xml.*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>jersey</pattern>
<shadedPattern>shaded.jersey</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>shaded.javassist</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/.*</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!-- Shade plugin -->
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
If i write a test class within the same project in which this library is, everything works fine. But, if i when i use this shaded library in a separate standalone project (which is what the goal is), i get following exception :
Feb 06, 2015 5:28:07 PM shaded.org.glassfish.hk2.internal.ServiceLocatorFactoryImpl getGenerator
WARNING: Cannot find a default implementation of the HK2 ServiceLocatorGenerator
Feb 06, 2015 5:28:08 PM shaded.org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: HK2 service reification failed for [shaded.org.glassfish.jersey.message.internal.DataSourceProvider] with an exception:
MultiException stack 1 of 2
java.lang.NoClassDefFoundError: shaded/javax/activation/DataSource
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at shaded.org.jvnet.hk2.internal.Utilities$7.run(Utilities.java:1316)
at shaded.org.jvnet.hk2.internal.Utilities$7.run(Utilities.java:1312)
at java.security.AccessController.doPrivileged(Native Method)
at shaded.org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1312)
at shaded.org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1233)
at shaded.org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:78)
at shaded.org.glassfish.jersey.internal.inject.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:143)
at shaded.org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:203)
at shaded.org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:147)
at shaded.org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:200)
at shaded.org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:649)
........
........
Caused by: java.lang.ClassNotFoundException: shaded.javax.activation.DataSource
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 65 more
MultiException stack 2 of 2
java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
implementation=shaded.org.glassfish.jersey.message.internal.DataSourceProvider
contracts={shaded.javax.ws.rs.ext.MessageBodyWriter,shaded.javax.ws.rs.ext.MessageBodyReader}
scope=shaded.javax.inject.Singleton
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=
rank=0
loader=shaded.org.glassfish.hk2.utilities.binding.AbstractBinder$2#4fb64261
proxiable=null
proxyForSameScope=null
analysisName=null
id=10
locatorId=1
identityHashCode=1113619023
reified=false)
at shaded.org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:615)
at shaded.org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:405)
at shaded.org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2046)
at shaded.org.jvnet.hk2.internal.ServiceLocatorImpl.access$700(ServiceLocatorImpl.java:116)
at shaded.org.jvnet.hk2.internal.ServiceLocatorImpl$8.compute(ServiceLocatorImpl.java:1207)
at shaded.org.jvnet.hk2.internal.ServiceLocatorImpl$8.compute(ServiceLocatorImpl.java:1202)
Any help will be appreciated.
Thanks.
We're using Maven 3.0.3 and using the Maven Selenium plugin to attempt to start a Selenium server. We have this dependency in our pom ...
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.19.0</version>
<classifier>noexe</classifier>
</dependency>
Then in the pre-integration phase we try and start Selenium server ...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
<logOutput>true</logOutput>
</configuration>
</execution>
</executions>
</plugin>
But the server fails to start with the error ...
java.lang.NoClassDefFoundError: org/openqa/selenium/server/SeleniumServer
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.server.SeleniumServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.openqa.selenium.server.SeleniumServer. Program will exit.
Exception in thread "main"
I have verified that the dependency above contains the missing class. How else can I troubleshoot this classpath problem or can you tell what is wrong with the setup I've listed here?
Thanks, - Dave