maven-enunciate-plugin NullPointerException generating docs - maven

I'm trying to run the maven-enunciate-plugin:1.26.2:docs and facing a NUllPointerException.
The only thing I want is its documentation generation as described here http://docs.codehaus.org/display/ENUNCIATE/Documentation+Only, so my pom.xml is as:
...
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.26.2</version>
<configuration>
<docsDir>${project.build.directory}/docs</docsDir>
</configuration>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
</execution>
</executions>
</plugin>
...
But, it launches:
Caused by: org.apache.maven.plugin.MojoExecutionException: Problem assembling the enunciate app.
at org.codehaus.enunciate.DocsMojo.execute(DocsMojo.java:100)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.NullPointerException
at org.codehaus.enunciate.modules.java_client.JavaClientDeploymentModule.isGenerateJsonJar(JavaClientDeploymentModule.java:892)
at org.codehaus.enunciate.modules.java_client.JavaClientDeploymentModule.doCompile(JavaClientDeploymentModule.java:501)
at org.codehaus.enunciate.modules.BasicDeploymentModule.step(BasicDeploymentModule.java:113)
at org.codehaus.enunciate.main.Enunciate.doCompile(Enunciate.java:286)
at org.codehaus.enunciate.main.Enunciate$Stepper.step(Enunciate.java:1738)
at org.codehaus.enunciate.main.Enunciate$Stepper.stepTo(Enunciate.java:1766)
at org.codehaus.enunciate.DocsMojo.execute(DocsMojo.java:96)
Any suggestion?

Try version 1.27. If it still happens, open up a bug.

For the record. I was using v.1.27 and ran into this problem: https://jira.codehaus.org/browse/ENUNCIATE-771 then I bumped to v.1.28 and got the mentioned problem above.

Related

Maven Failsafe plugin - SurefireBooterForkException: There was an error in the forked process (TypeNotPresentExceptionProxy)

I get this strange stacktrace when running mvn clean verify -P P1
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.21.0:verify (default) on project prj-name: There are test failures.
[ERROR]
[ERROR] Please refer to C:\path\to\project\target\failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] sun.reflect.annotation.TypeNotPresentExceptionProxy
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:658)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
What does it mean?
Maven pom.xml:
<profiles>
<profile>
<id>P1</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.21.0</version>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<!-- Includes integration tests -->
<includes>
<include>**/integration/*.java</include>
<include>**/integration/*/*.java</include>
</includes>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
UPDATE
There's a surefire dumpstream file
ForkStarter IOException: For input string: "1;5".
org.apache.maven.plugin.surefire.booterclient.output.MultipleFailureException: For input string: "1;5"
at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.<init>(ThreadedStreamConsumer.java:58)
at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer.<init>(ThreadedStreamConsumer.java:110)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:596)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:854)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:200)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:196)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Because of garbage in string variables and occasional IndexOutOfBoundsException / ConcurrentModificationException in logs it seems like a concurrency issue.
This GitHub issue - [#6254] Maven-failsafe-plugin fails to execute integration tests - and the related discussion helped me to solve my problem.
It's a bug. It turns out that newer Failsafe plugin versions (2.19.0 and later) don't work well with Spring Boot 1.4 (or later). Workaround is to downgrade the maven-failsafe-plugin to 2.18.1. Here's the updated pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<!-- I don't specify version at all (Spring Boot can autoconfigure plugin version) -->
<executions>
<execution>
<!-- changed <id> to <phase>, but I don't know whether it's important or not. -->
<phase>integration-test</phase>
<!-- ... no changes here: the same as in the question ... -->
</execution>
</executions>
</plugin>
</plugins>
I followed the solution proposed here:
https://github.com/spring-projects/spring-boot/issues/6254#issuecomment-307151464
Currently, I have failsafe plugin 2.22.0 and I'm able to use this version and not downgrade by explicitly configuring the classesDirectory property:
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
Example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<configuration>
...
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
...
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Another variant of the workaround is described later in the same Github issue thread: https://github.com/spring-projects/spring-boot/issues/6254#issuecomment-343470070
<classesDirectory>${project.build.directory}/${artifactId}.jar.original</classesDirectory>
Note (2020-02-27): maven-failsafe-plugin version 3.0.0-M4 still needs these workarounds :-(
My testng class was having LoginPageTest.java, I removed .java and worked perfectly fine. :)
<classes>
<class name="com.qa.Backend.tests.LoginPageTest"/>
</classes>
I used to get the problem and mostly the problem is initializing instance variables. Check your instance variables that are working in local and if working check when they are running in CI/CD pipeline.
Another workaround is to configure a classifier for the repackaged jar. This allows Failsafe to use the original jar:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
This problem is due to a combination of a change in the Failsafe plugin and a change in the layout of a repackaged jar file in Boot 1.4. As of Failsafe 2.19, target/classes is no longer on the classpath and the project's built jar is used instead. In the case of a Boot app, that's the repackaged jar. In 1.4, the application's classes were moved from the root of the jar to the BOOT-INF/classes directory. This prevents them from being loaded by Failsafe.
src: GitHub Issues

Connecting to db2 from java client

I am trying to connect to db2 from a java client running the application as a jar. The jar is a super-jar with all dependencies generated by the shade plugin.
When I run the program from my ide(Netbeans) it runs fine, but when I run it from commandline like this it fails:
java -jar target/locationImporter.jar
The exception I get is:
Exception in thread "main" java.lang.NullPointerException
at com.ibm.as400.access.PortMapper.getServerSocket(PortMapper.java:216)
at com.ibm.as400.access.AS400ImplRemote.signonConnect(AS400ImplRemote.java:2363)
at com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:2278)
at com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:3142)
at com.ibm.as400.access.AS400.promptSignon(AS400.java:2706)
at com.ibm.as400.access.AS400.signon(AS400.java:4035)
at com.ibm.as400.access.AS400.connectService(AS400.java:1184)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:3338)
at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:1419)
at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:1256)
at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:395)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at dataprep.ConnectionSupplier.getConnection(ConnectionSupplier.java:18)
at dataprep.SqlFileRunner.runScript(SqlFileRunner.java:65)
at dataprep.SqlFileRunner.runSqlFile(SqlFileRunner.java:26)
at dataprep.PrepareDatabase.main(PrepareDatabase.java:26)
The code that fails is:
Class.forName("com.ibm.as400.access.AS400JDBCDriver").newInstance();
return DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASSWORD);
Since it runs in my ide, I know that the url, user and password is correct.
My shade plugin is configured like this in my pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>launcher</shadedClassifierName>
<finalName>locationImporter</finalName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
After hours of debugging a colleague of mine pointed me in the right direction. Removing the minimizeJar fixes the problem since the shade plugin removed the file "SocketContainerInet" since it was not directly instantiated but via a string-value..

Issue with stopping weblogic server using wls-maven-plugin

This is part of my pom.xml of my .ear file
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>wls-maven-plugin</artifactId>
<version>12.1.1.0</version>
<configuration>
<adminurl>${adminURL}</adminurl>
<user>${username}</user>
<password>${pswrd}</password>
<upload>true</upload>
<remote>false</remote>
<verbose>true</verbose>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<name>${project.build.finalName}</name>
<targets>${serverName}</targets>
<noExit>true</noExit>
<middlewareHome>${middlewareH}</middlewareHome>
<domainHome>${domainH}</domainHome>
</configuration>
<executions>
<execution>
<id>stopserver</id>
<phase>install</phase>
<goals>
<goal>stop-server</goal>
</goals>
<configuration>
<action>stopserver</action>
<workingDir>${stopScriptDirectory}</workingDir>
<command>stopScript.sh</command>
</configuration>
</execution>
</executions>
</plugin>
I am trying to stop the server by running the stopScript.sh
This is the error I am getting when it is trying to execute the stop-server goal:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.weblogic:wls-maven-plugin:12.1.1.0:stop-server (stopserver) on project OventusEAR2: Unable to parse configuration of mojo com.oracle.weblogic:wls-maven-plugin:12.1.1.0:stop-server for parameter command: Cannot assign configuration entry 'command' with value 'stopScript.sh' of type java.lang.String to property of type java.lang.String[]
Any ideas?
Though I am not familiar with this particular plugin, however I have seen similar issues before, I guess command parameter is expecting an array instead.
Please try replacing
<command>stopScript.sh</command>
with
<command>
<value>stopScript.sh</value>
</command>
and test again.

"parent.lock" for firefox profile when running selenium maven plugin

When my integration tests are run with selenium plugin for maven
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
</plugin>
the following message is received:
Lock file still present! C:\Users\ADM\AppData\Local\Temp\customProfileDirbb53fd86ecaf4236bf538b7a1171814b\parent.lock
If I delete parent.lock file immediately after the firefox profile is created the tests are working properly.
Does anyone know how to avoid creation of parent.lock file? or any other solution
I'm using selenium 2.33.0
the whole exception is
ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Firefox refused shutdown while preparing a profile
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:367)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:120)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:90)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:412)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:114)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:381)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:810)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:437)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:407)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:151)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\Users\ADM\AppData\Local\Temp\customProfileDirbb53fd86ecaf4236bf538b7a1171814b\parent.lock
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:318)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:365)
... 20 more
please ensure the following has been configured correctly
http://girliemangalo.wordpress.com/2009/02/05/creating-firefox-profile-for-your-selenium-rc-tests/

Maven classpath trouble with Maven-selenium plugin

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

Resources