M1 Mac: java.lang.ExceptionInInitializerError at cucumber.deps.com.thoughtworks.xstream.XStream.setupConverters(XStream.java:820) - selenium

I am trying to run an automation test by launching the Chrome browser using the chrome driver.
Setup:
Chip: Apple M1 Pro
OS: macOS Monterey
JDK: jdk-18.0.1.1.jdk
Maven: Apache Maven 3.8.5
IntelliJ IDEA 2022.1.1 (Community Edition)Build #IC-221.5591.52
When I run my code, I get the following errors:
Could you please suggest a solution? No idea something wrong with the setup, version, Pom or chromedriver path:
java.lang.ExceptionInInitializerError at cucumber.deps.com.thoughtworks.xstream.XStream.setupConverters(XStream.java:820) at cucumber.deps.com.thoughtworks.xstream.XStream.(XStream.java:574) at cucumber.deps.com.thoughtworks.xstream.XStream.(XStream.java:530) at cucumber.runtime.xstream.LocalizedXStreams$LocalizedXStream.(LocalizedXStreams.java:50) at cucumber.runtime.xstream.LocalizedXStreams.newXStream(LocalizedXStreams.java:37) at cucumber.runtime.xstream.LocalizedXStreams.get(LocalizedXStreams.java:29) at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37) at cucumber.runtime.Runtime.runStep(Runtime.java:300) at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165) at cucumber.runtime.Runtime.run(Runtime.java:122) at cucumber.api.cli.Main.run(Main.java:36) at cucumber.api.cli.Main.main(Main.java:18) at ?.Given I launch a browser(/Users/ravithapa/IdeaProjects/letstry/src/test/resources/Features/Homepagelogo_Login.feature:5) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module #179d3b25 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:180) at java.base/java.lang.reflect.Field.setAccessible(Field.java:174) at cucumber.deps.com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39) at cucumber.deps.com.thoughtworks.xstream.converters.collections.TreeMapConverter.(TreeMapConverter.java:50) at cucumber.deps.com.thoughtworks.xstream.XStream.setupConverters(XStream.java:820) at cucumber.deps.com.thoughtworks.xstream.XStream.(XStream.java:574) at cucumber.deps.com.thoughtworks.xstream.XStream.(XStream.java:530) at cucumber.runtime.xstream.LocalizedXStreams$LocalizedXStream.(LocalizedXStreams.java:50) at cucumber.runtime.xstream.LocalizedXStreams.newXStream(LocalizedXStreams.java:37) at cucumber.runtime.xstream.LocalizedXStreams.get(LocalizedXStreams.java:29) at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37) at cucumber.runtime.Runtime.runStep(Runtime.java:300) at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165) at cucumber.runtime.Runtime.run(Runtime.java:122) at cucumber.api.cli.Main.run(Main.java:36) at cucumber.api.cli.Main.main(Main.java:18)
Pom file:
4.0.0
<groupId>org.example</groupId>
<artifactId>letstry</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<id>execution</id>
<phase>test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>e2e</projectName>
<outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.28</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-htmlunit-driver -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.48.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>
code:
public WebDriver driver;
#Given("^I launch a browser$")
public void i_launch_a_browser() throws Throwable {
public class Homepagelogo_Login {
public WebDriver driver;
#Given("^I launch a browser$")
public void i_launch_a_browser() throws Throwable {
System.setProperty("webdriver.chrome.driver", "/Users/me/Desktop/test/webdriver");
driver = new ChromeDriver();
}

Add following to the VM options in the Run configuration of your IDE:
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED
Reference from here: https://github.com/Riduidel/aadarchi/issues/90#issuecomment-1291640544
The above link also has sample code to use in pom.xml if you are running a mvn test instead.

Related

Mule application deploy issue

I am new on Mule and Anypoint Studio and want to deploy a project. When I run it I get exceptions that might get caused by a jar dependency called wrapper for Mapping the java classes that says could not be found, how do I have to install this dependency? And if it is not the dependency then how to fix it? I don't know what to do at this point so I appreciate any answer.
I get the following exceptions when I try to run and compile the project:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [net.inspira.api.transformers.json.ObjectToJsonMapper] for bean with name 'JsonMapper' defined in class path resource [spring/config-beans.xml]; nested exception is org.mule.runtime.module.artifact.api.classloader.exception.CompositeClassNotFoundException: Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region 'domain/default/app/mambo-supply'.,
Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region '/domain/default'.,
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' not found in classloader for artifact 'container'.]]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1391) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:641) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1490) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1013) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:741) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.3.21.jar:5.3.21]
at org.mule.extension.spring.api.SpringConfig.lambda$configure$0(SpringConfig.java:63) ~[?:?]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:265) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1032) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:970) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.extension.spring.api.SpringConfig.configure(SpringConfig.java:58) ~[?:?]
at org.mule.runtime.config.internal.MuleArtifactContext.prepareObjectProviders(MuleArtifactContext.java:311) ~[mule-module-spring-config-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.config.internal.MuleArtifactContext.prepareBeanFactory(MuleArtifactContext.java:303) ~[mule-module-spring-config-4.4.0-20220824.jar:4.4.0-20220824]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) ~[spring-context-5.3.21.jar:5.3.21]
at org.mule.runtime.config.internal.SpringRegistry.doInitialise(SpringRegistry.java:102) ~[mule-module-spring-config-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.registry.AbstractRegistry.initialise(AbstractRegistry.java:94) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:111) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:73) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:69) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.privileged.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:132) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.context.DefaultMuleContext.initialise(DefaultMuleContext.java:352) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:177) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:60) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.lambda$build$1(ArtifactContextBuilder.java:485) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:224) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1075) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:993) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.build(ArtifactContextBuilder.java:397) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.doInit(DefaultMuleApplication.java:237) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.init(DefaultMuleApplication.java:206) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:265) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1032) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:970) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.executeWithinArtifactClassLoader(DeployableArtifactWrapper.java:146) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.init(DeployableArtifactWrapper.java:89) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.doInit(DefaultArtifactDeployer.java:133) ~[mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:60) ~[mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:481) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:470) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.internalDeployPackagedArtifact(DefaultArchiveDeployer.java:578) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployOrRedeployPackagedArtifact(DefaultArchiveDeployer.java:543) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:387) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:53) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.deployPackedApps(DeploymentDirectoryWatcher.java:240) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.run(DeploymentDirectoryWatcher.java:311) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.MuleDeploymentService.start(MuleDeploymentService.java:156) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.launcher.MuleContainer.start(MuleContainer.java:256) [mule-module-launcher-4.4.0-20220824.jar:4.4.0-20220824]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_332]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_332]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_332]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_332]
at org.mule.runtime.module.reboot.internal.MuleContainerWrapper.start(MuleContainerWrapper.java:53) [mule-module-boot-ee-4.4.0-20220824.jar:4.4.0-20220824]
at org.tanukisoftware.wrapper.WrapperManager$11.run(WrapperManager.java:4537) [wrapper-3.5.50.jar:3.5.50]
Caused by: org.mule.runtime.module.artifact.api.classloader.exception.CompositeClassNotFoundException: Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region 'domain/default/app/mambo-supply'.,
Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region '/domain/default'.,
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' not found in classloader for artifact 'container'.]]
Caused by: org.mule.runtime.module.artifact.api.classloader.exception.ClassNotFoundInRegionException: Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region 'domain/default/app/mambo-supply'.
My pom.xml file:
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.grupoareas</groupId>
<artifactId>mambo-supply-2017</artifactId>
<version>4.0.0-M4</version>
<packaging>mule-application</packaging>
<name>mambo-supply</name>
<description>Application migrated with MMA</description>
<properties>
<mule.tools.version>1.1</mule.tools.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.8.4</mule.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<munit.version>2.2.5</munit.version>
</properties>
<dependencies>
<dependency>
<groupId>com.cloveretl</groupId>
<artifactId>cloveretl-engine</artifactId>
<version>3.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
<dependency>
<groupId>com.mulesoft.modules</groupId>
<artifactId>mule-secure-configuration-property-module</artifactId>
<version>1.2.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.module</groupId>
<artifactId>mule-java-module</artifactId>
<version>1.2.6</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.mulesoft.mule.modules</groupId>
<artifactId>mule-compatibility-module</artifactId>
<version>1.4.0</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-db-connector</artifactId>
<version>1.8.1</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-scripting-module</artifactId>
<version>1.1.7</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-json-module</artifactId>
<version>2.1.3</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-runner</artifactId>
<version>2.2.5</version>
<classifier>mule-plugin</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-tools</artifactId>
<version>2.2.5</version>
<classifier>mule-plugin</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-spring-module</artifactId>
<version>1.3.3</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.4.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-objectstore-connector</artifactId>
<version>1.2.1</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-apikit-module</artifactId>
<version>1.5.1</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
</repository>
<repository>
<id>anypoint-exchange</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v1/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<url>https://repository.mulesoft.org/releases/</url>
</pluginRepository>
</pluginRepositories>
<build>
<testResources>
<testResource>
<directory>src/test/munit</directory>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-clover-plugins</id>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>com.cloveretl</groupId>
<artifactId>cloveretl-engine</artifactId>
<version>3.8.4</version>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<unzip dest="${project.build.testOutputDirectory}" src="${project.build.testOutputDirectory}/cloveretl-engine.zip"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mulesoft.munit.tools</groupId>
<artifactId>munit-maven-plugin</artifactId>
<version>2.2.5</version>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<coverage>
<runCoverage>true</runCoverage>
<formats>
<format>html</format>
</formats>
</coverage>
</configuration>
</plugin>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>3.5.1</version>
<extensions>true</extensions>
<configuration>
<sharedLibraries>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</sharedLibrary>
</sharedLibraries>
<classifier>mule-application</classifier>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<args>-parameters</args>
</compilerArgs>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The error is related to the class net.inspira.api.transformers.json.ObjectToJsonMapper. This class seems to be coming from artifact net.inspira.api:api-transformers:2.0.0. Since a quick search in Maven Central founds nothing related to that, I'll assume it is a proprietary library that your company uses. You would need to ask inside where it comes and how to install it.
Having said that, if there was no Maven error at built time, the dependency has been accessible to the build and the issue may be that the application can not see it because of Mule 4 classloader isolation. Try adding a Shared Library entry to the pom to make it visible. Example:
<sharedLibrary>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
</sharedLibrary>
Put it with the other similar entries.
As a side note, this application seems to have been migrated from Mule 3 using the Mule Migration Assistant tool. Such migrations are not fully automated and required developers familiar with Mule 3 and Mule 4 to complete them. If you are new to Mule and the migration is not complete it may be extra hard for you to make it work.

java.lang.NoClassDefFoundError: io/cucumber/core/runtime/TypeRegistryConfigurerSupplier

I am getting the 'java.lang.ClassNotFoundException' exception while running maven test in my project. The same program works fine if #RunWith is tagged to (Cucumber.class) but apparently not with #Runwith(CucumberWithSerenity.class). I am not sure why issue is appearing!
Note: I did refer the similar post to rectify the issue but apparently none helped me yet.
Error logs:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running foo.boo.TestRunner
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.049 s <<< FAILURE! - in foo.boo.TestRunner
[ERROR] foo.boo.TestRunner.initializationError Time elapsed: 0.008 s <<< ERROR!
java.lang.NoClassDefFoundError: io/cucumber/core/runtime/TypeRegistryConfigurerSupplier
Caused by: java.lang.ClassNotFoundException: io.cucumber.core.runtime.TypeRegistryConfigurerSupplier
[ERROR] TestRunner.initializationError » NoClassDefFound io/cucumber/core/runtime/Type...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
TestRunner.java
package foo.boo;
import io.cucumber.junit.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.runner.RunWith;
#RunWith(CucumberWithSerenity.class)
#CucumberOptions(
plugin = {"pretty"},
features = "foo",
glue = "boo"
)
public class TestRunner {
}
POM.XML:-
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>fooboo</groupId>
<artifactId>Experiment</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<build>
<sourceDirectory>${project.basedir}</sourceDirectory>
<testSourceDirectory>${project.basedir}</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<type>maven-plugin</type>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.0.0</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.6</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.4.0</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.29</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-core -->
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>3.1.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-ensure -->
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-ensure</artifactId>
<version>3.1.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-cucumber -->
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber</artifactId>
<version>3.1.10</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>3.1.10</version>
</dependency>
</dependencies>
</project>
Could someone share what is causing such issues?
You should remove all occurences of cucumber artifacts from your pom. Serenity artifacts already have dependencies to the required cucumber versions. The lates supported version is 6.11.
When you put the same artifact of different version to your root pom, you override that. Hence there is version inconsistency take the place.
You should not give space after Scenario. In case of typing something, as follows, will throw an error:
Scenario :
As you see there is a space just before the colon and that throws an error.

non-static variable role cannot be referenced from a static context- JDO Querydsl

I am building one maven project using JDO, Querydsl. But in my DaoImpl class one line is showing error which is: "non-static variable role cannot be referenced from a static context"
My pojo classes are:
User.java
#PersistenceCapable(table="User_Login")
public class User {
#PrimaryKey
#Column(name="user_id")
private Integer userId=0;
#Column(name="user_profile_name")
private String userProfileName=null;
#Column(name="user_email")
private String userEmail=null;
#Column(name="user_contact")
private String userContact=null;
#Column(name="user_name")
private String userName=null;
#Column(name="user_password")
private String userPassword=null;
#Column(name="user_role_id")
private Integer userRoleId=0;
private Role userRole=null;
Role.java:
#PersistenceCapable(table="User_Role")
public class Role {
#PrimaryKey
#Column(name="id")
private Integer roleId=0;
#Column(name="role")
private String role=null;
My required result will be:
userid: 1, role: admin
my DAOImpl class:
public List<User> getUser(String user_name, String user_password) {
PersistenceManager pm =
this.persistenceManagerFactory.getPersistenceManager();
Transaction tx = pm.currentTransaction();
SQLTemplates templates = new MySQLTemplates();
QUser user = QUser.user;
QRole role = QRole.role;-----------**this is showing error**
JDOSQLQuery query = new JDOSQLQuery(pm, templates);
try {
// Start the transaction
tx.begin();
List<User> result = query.from(user)
.innerJoin(role).on(user.userRoleId.eq(role.roleId))
.where(user.userName.eq(user_name),
user.userPassword.eq(user_password)).
list(user);
query.close();
tx.commit();
return result;
}
finally {
if (tx.isActive())
{
// Error occurred so rollback the transaction
tx.rollback();
}
pm.close();
}
My pom.xml is:
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.titas</groupId>
<artifactId>QuerydslJDO</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>QuerydslJDO</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>3.6.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jdo</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-sql</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}
</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-
api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.0.4</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources
/java</outputDirectory>
<processor>com.mysema.query.apt.jdo.
JDOAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-maven-plugin</artifactId>
<version>2.9.0</version>
<executions>
<execution>
<goals>
<goal>export</goal>
</goals>
</execution>
</executions>
<configuration>
<jdbcDriver>com.mysql.jdbc.Driver</jdbcDriver>
<jdbcUrl>jdbc:mysql://localhost:3306/login</jdbcUrl>
<jdbcUser>root</jdbcUser>
<packageName>com.titas.model</packageName>
<targetFolder>${project.basedir}/target/generated-sources
/java</targetFolder>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
Since your Role.java already contains a property 'role' Querydsl cannot generate your standard variable as 'QRole.role', so it is named 'QRole.role1'.

Arquillian, glassfish & h2database

I am currently fighing quite a few issues with the creation of a database unit test environment using Arquillian. My project already works in a Glassfish 3.1.2 environment based on Seam 3, JSF and MySQL. However, when trying to set up a test environment using Arquillian, things get nasty.
My ultimate goal is an Arquillian-based unit test using a Glassfish embedded server and an embedded, in-memory h2database. I’m not picky when it comes to the embedded container, it’s just that the Arquillian JPA guide suggested that the minimal Weld container does not support JPA. That’s why I opted out towards Glassfish. Since I'm not getting even near the initialization of the persistence context, I'm not posting my persistence.xml file.
Here’s the POM I ended up with so far:
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.diction</groupId>
<artifactId>web-portal</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Diction web portal</name>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jee.version>1.0.0.Final</jee.version>
<seam.version>3.1.0.Final</seam.version>
<primefaces.version>3.4</primefaces.version>
<primefaces.theme.version>1.0.8</primefaces.theme.version>
<drools.version>5.4.0.Final</drools.version>
<arquillian.version>1.0.2.Final</arquillian.version>
<arquillian.weld.version>1.0.0.CR3</arquillian.weld.version>
<junit.version>4.8.1</junit.version>
<h2.version>1.3.168</h2.version>
<weldcore.version>1.1.10-SNAPSHOT</weldcore.version>
<slf4j.version>1.6.6</slf4j.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<outputDirectory>target/main</outputDirectory>
<testOutputDirectory>target/test</testOutputDirectory>
<resources>
<resource>
<targetPath>ch/diction/webportal/resources</targetPath>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<targetPath>ch/diction/webportal/resources</targetPath>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<targetPath>ch/diction/webportal/resources</targetPath>
<directory>src/main/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</repository>
<repository>
<id>Java.Net</id>
<name>Java Maven Repository</name>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>seam-bom</artifactId>
<version>${seam.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>redmond</artifactId>
<version>${primefaces.theme.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam.security</groupId>
<artifactId>seam-security</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
<exclusions>
<exclusion>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.seam.persistence</groupId>
<artifactId>seam-persistence</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.solder</groupId>
<artifactId>solder-impl</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.transaction</groupId>
<artifactId>seam-transaction</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.international</groupId>
<artifactId>seam-international-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.international</groupId>
<artifactId>seam-international</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.seam.faces</groupId>
<artifactId>seam-faces</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>juli</artifactId>
<version>6.0.13</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I guess for this post, only the „Test dependencies“ are important (see comment marker), since the actual main deploy works flawlessly. Running the following unit test:
package ch.diction.webportal.test.glossary.model;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.security.SecurityInterceptor;
import org.jboss.seam.transaction.TransactionInterceptor;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import ch.diction.webportal.glossary.entity.Glossary;
import ch.diction.webportal.glossary.model.IGlossaryDataAccessObject;
import ch.diction.webportal.glossary.model.JpaGlossaryDataAccessObject;
import ch.diction.webportal.security.seam.producer.EntityManagerProducer;
#RunWith(Arquillian.class)
public class JpaGlossaryDataAccessObjectTest {
#Deployment
public static Archive<?> createDeployment() {
final Archive<?> ar = ShrinkWrap
.create(WebArchive.class, "test.war")
.addPackage(Glossary.class.getPackage())
.addClass(SecurityInterceptor.class)
.addClass(TransactionInterceptor.class)
.addClass(EntityManagerProducer.class)
.addClass(JpaGlossaryDataAccessObject.class)
.addAsWebInfResource("ch/diction/webportal/resources/security/beans.xml", "beans.xml")
.addAsResource("ch/diction/webportal/resources/persistence/persistence.xml", "META-INF/persistence.xml");
return ar;
}
#Inject
private IGlossaryDataAccessObject dao;
#PersistenceContext
private EntityManager entityManager;
#Inject
private UserTransaction userTransaction;
private void clearData() throws Exception {
userTransaction.begin();
entityManager.joinTransaction();
entityManager.createQuery("delete from Glossary").executeUpdate();
userTransaction.commit();
}
#After
public void commitTransaction() throws Exception {
userTransaction.commit();
}
private void insertData() throws Exception {
userTransaction.begin();
entityManager.joinTransaction();
// TODO: Insert records
userTransaction.commit();
entityManager.clear();
}
#Before
public void preparePersistenceTest() throws Exception {
clearData();
insertData();
startTransaction();
}
private void startTransaction() throws Exception {
userTransaction.begin();
entityManager.joinTransaction();
}
#Test
public void testCreateEmptyGlossary() {
final Glossary glossary = new Glossary("empty");
dao.store(glossary);
}
}
Now provides me with the following exception:
Caused by: java.lang.VerifyError: class com.sun.enterprise.web.WebModule overrides final method stop.()V
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.newInstance0(Class.java:343)
at java.lang.Class.newInstance(Class.java:325)
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:65)
... 79 more
As to that, I am completely clueless. I didn’t even know these kinds of exceptions existed in java o.O ...
Thanks in advance for any suggestions here! Any help is appreciated!
Best regards
Pascal
Well, I ended up ignoring the h2database part and instead used a MySQL test database provided by a fully-fledged Glassfish 3.1.2 container. The Arquillian's embedded container proved quite a hassle and wasn't worth the trouble, when Arquillian can work with actual remote Glassfish containers instead.
This is the POM I ended up with:
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.diction</groupId>
<artifactId>web-portal</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Diction web portal</name>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jee.version>1.0.0.Final</jee.version>
<seam.version>3.1.0.Final</seam.version>
<primefaces.version>3.4</primefaces.version>
<primefaces.theme.version>1.0.8</primefaces.theme.version>
<drools.version>5.4.0.Final</drools.version>
<arquillian.version>1.0.2.Final</arquillian.version>
<arquillian.persistence.version>1.0.0.Alpha5</arquillian.persistence.version>
<junit.version>4.8.1</junit.version>
<slf4j.version>1.6.6</slf4j.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<outputDirectory>target/main</outputDirectory>
<testOutputDirectory>target/test</testOutputDirectory>
<resources>
<resource>
<targetPath>ch/diction/webportal/resources</targetPath>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<targetPath>ch/diction/webportal/resources</targetPath>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/resources/container</directory>
</testResource>
<testResource>
<targetPath>ch/diction/webportal/resources</targetPath>
<directory>src/main/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</repository>
<repository>
<id>Java.Net</id>
<name>Java Maven Repository</name>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>seam-bom</artifactId>
<version>${seam.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>redmond</artifactId>
<version>${primefaces.theme.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam.security</groupId>
<artifactId>seam-security</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
<exclusions>
<exclusion>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.seam.persistence</groupId>
<artifactId>seam-persistence</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.solder</groupId>
<artifactId>solder-impl</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.transaction</groupId>
<artifactId>seam-transaction</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.international</groupId>
<artifactId>seam-international-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.international</groupId>
<artifactId>seam-international</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.seam.faces</groupId>
<artifactId>seam-faces</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>${jee.version}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-remote-3.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-persistence-impl</artifactId>
<version>${arquillian.persistence.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
And my test-persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="web-portal-test" transaction-type="JTA">
<jta-data-source>jdbc/web-portal-test</jta-data-source>
<properties>
<property name="eclipselink.logging.level" value="FINE" />
</properties>
</persistence-unit>
</persistence>
The lesson I get from this is that Arquillian is too bleeding edge to provoke unnecessary configuration issues. From now on, I'll always start out with a full remote container.

maven-plugin-api com.thoughtworks.qdox.parser.ParseException

Getting a com.thoughtworks.qdox.parser.ParseException when building my project. This error first occurred when I changed:
<packaging>jar</packaging>
to:
<packaging>maven-plugin</packaging>
Before that, the entire project built and ran cleanly. maven-plugin-api is the newest version available in maven, so upgrading per "GWT, Maven, Spring - Getting com.thoughtworks.qdox.parser.ParseException: syntax error on Maven Build" won't work. I've also tried downgrading; no change.
The exception:
com.thoughtworks.qdox.parser.ParseException: syntax error #[38,1] in file:/home/blablahbla/MyClass.java
at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:716)
at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:826)
at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:697)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:300)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:316)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:312)
at com.thoughtworks.qdox.JavaDocBuilder$1.visitFile(JavaDocBuilder.java:369)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:43)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:52)
at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:366)
at org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtractor.discoverClasses(JavaMojoDescriptorExtractor.java:628)
at org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtractor.execute(JavaMojoDescriptorExtractor.java:592)
at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor(DefaultMojoScanner.java:105)
at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute(AbstractGeneratorMojo.java:171)
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.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
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)
The pom file:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo.bar</groupId>
<artifactId>foobar</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0.1</version>
<name>foobar</name>
<properties>
<org.springframework.version>3.1.0.M1</org.springframework.version>
<org.hibernate.version>3.6.0.Final</org.hibernate.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${org.hibernate.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.1.0.7.0</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>foo.bar.internal</groupId>
<artifactId>internal-artifact</artifactId>
<version>0.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
</project>
The class in question:
import javax.persistence.*;
#Table(name = "MY_TABLE")
#SecondaryTables({
#SecondaryTable(name = "MY_TABLE2"),
#SecondaryTable(name = "MY_TABLE3"),
#SecondaryTable(name = "MY_TABLE4")
})
#Entity
#NamedQueries({
...
})
#AttributeOverrides({ // line 37
// #AttributeOverride( //line 38
// name = "metadataCheckOutFlag",
// column = #Column(
// name = "COMMENTED_OUT_FIELD",
// table = "MY_TABLE2"
// )
// ),
})
public class MyClass extends SimpleMyClass {
}
All JPA annotations have previously functioned without issue.
Well, it turns out I had an older version of another maven plugin, the maven-compiler-plugin. When I upgraded it to versino 2.3.2, a new version of the qdox library was downloaded and my problems disappeared, even when I tested downgrading to 2.0.2 again. Relevant section of pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>