An exception occured while executing the Java class. java.lang.InterruptedException - java

I get my Apache Storm from http://mirror.symnds.com/software/Apache/storm/apache-storm-0.9.3/apache-storm-0.9.3.tar.gz
I never modified any thing in the /home/user/storm/examples/storm-starter/ directory.
When I run this command
mvn exec:java -D storm.topology=storm.starter.WordCountTopology
in the /home/user/storm/examples/storm-starter/, it gives the error as below:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project storm-starter: An exception occured while executing the Java class. java.lang.InterruptedException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
MojoExecutionException - Apache Maven - Apache Software Foundation
cwiki.apache.org
Anyone know what is the problem & how to solve it?
I wish can provide me a detail solution as I am a newbie. Thank you.

Try this
Go to the path where your pom.xml file exists and run this command
mvn -e -f pom.xml compile exec:java -D storm.topology=storm.starter.WordCountTopology
Try adding this to your pom.xml and run the above command.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<classpathScope>compile</classpathScope>
<mainClass>${storm.topology}</mainClass>
</configuration>
</plugin>

Related

Maven Java Error with Duplicated tag: 'configuration'

I'm getting an error with maven. It added one dependency with the tool in VS Code and turned off checkstyle in . I tried to restart vs code because it might be a bug but clearly it isn't.
Error message with debugging:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM c:\Users\wikim\Desktop\Java\argbot\pom.xml: Duplicated tag: 'configuration' (position: START_TAG seen ...</dependencies>\r\n <configuration>... #80:24) # line 80, column 24
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (c:\Users\wikim\Desktop\Java\argbot\pom.xml) has 1 error
[ERROR] Non-parseable POM c:\Users\wikim\Desktop\Java\argbot\pom.xml: Duplicated tag: 'configuration' (position: START_TAG seen ...</dependencies>\r\n <configuration>... #80:24) # line 80, column 24 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
Here's pom.xml file
If you look at the error it shows line 80 has an issue. For the plugin maven-checkstyle-plugin you have two configuration tags in the XML. I would change it to a single one:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<configLocation>com/github/ngeor/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<skip>${skipTests}</skip>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
<dependency>
<groupId>com.github.ngeor</groupId>
<artifactId>checkstyle-rules</artifactId>
<version>${checkstyle-rules.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>checkstyle</id>
<phase>none</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

How to add License.txt to Maven project

I'm trying to add a LICENSE.txt to my maven project via a plugin.
I've tried using org.codehaus.mojo license-maven-plugin 1.14, with the following pom entries...
<organizationName>My Organization</organizationName>
<inceptionYear>2018</inceptionYear>
<licenses>
<license>
<name>GNU-JEFF General Public License (GPL)</name>
<url>http://www.gnu.org/licenses/gpl.txt</url>
</license>
</licenses>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<verbose>false</verbose>
<addSvnKeyWords>true</addSvnKeyWords>
</configuration>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<licenseName>gpl_v3</licenseName>
<organizationName>My Organization</organizationName>
<inceptionYear>2017</inceptionYear>
<roots>
<root>src/main/java</root>
<root>src/test</root>
</roots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
But with the following command...
mvn license:update-project-license
I get this error...
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.pcmsgroup.v21.pos.tools:confluence-updater:2.0.1-SNAPSHOT (C:\x\pom.xml) has 1 error
[ERROR] Malformed POM C:\x\pom.xml: Unrecognised tag: 'organizationName' (position: START_TAG seen ...</packaging>\r\n\t\r\n<organizationName>... #9:19) # C:\tools\workspace\POS-ConfluenceUpdater\pom.xml, line 9, column 19 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
The error has nothing to do with the plugin. As far as I can tell from the Maven XSD, your organizationName tag is indeed invalid, as the error says. Try replacing it with organization. That one does exist.
<organization>
<name>My Organization</name>
<url>http://example.com</url>
</organization>

Can't able maven install

I had been created a jar from my Java project using Eclipse IDE.
Then I have added that jar into my spring boot maven project's build path.
When I am trying to maven clean and install after adding my custom jar, I can't able to run maven install successfully.
I am getting below error,
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project springBootExample: Compilation failure: Compilation failure:
[ERROR] error reading C:\Users\VAIBHAV-PC\.m2\repository\org\hsqldb\hsqldb\2.3.3\hsqldb-2.3.3.jar; invalid LOC header (bad signature)
[ERROR] /D:springBootExample/src/main/java/com/springBootExample/service/impl/UserServiceImpl.java:[9,29] package com.ResponceGenerator does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException.
Can you upload the pom.xml of the SpringBoot Project ? Below is the example. Also make sure the custom jar is in your local maven repository.
Project A pom.xml ( Add the below plugin)
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.1.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
Project B pom.xml (Add your local repo information and include Project A under dependency section)
<repositories>
<repository>
<id>local-repo</id>
<url>file:${user.home}\.m2\repository</url>
</repository>
</repositories>
Project A Information

maven plugin install:install-file error

I use install:install-file to install jar to my local repository.My pom.xml is written as follow:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>install-paho</id>
<phase>generate-resources</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${basedir}/lib/paho.jar</file>
<groupId>org.eclipse</groupId>
<artifactId>paho</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
You can find that I binding it to phase 'generate-resources'.And then,I use order mvn eclipse:eclipse.It works very well and the jar was copied to my local repository.But when I use order mvn install:install-file I got the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file (default-cli) on project xxx:
The parameters 'file' for goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file are missing or invalid -> [Help 1]
The error messages when use mvn compile
[ERROR] Failed to execute goal on project android-engine: Could not resolve dependencies for project com.youku.wireless:android-engine:jar:1.0-SNAPSHOT: Could not find artifact org.eclipse:paho:jar:1.0.0 in spring-milestone (http://maven.springframework.org/milestone) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Since you have bound install:install-file goal to the generate-sources phase, you should run mvn compile or mvn install or such to use the defined configurations.
mvn eclipse:eclipse works because maven runs the generate-sources phase prior to invoking eclipse:eclipse.
Edit: From the comments it looks like you want to use the locally available paho.jar in your project by first installing it to your local repo in the generate-sources phase and thereafter use it as a dependency in your project.
This is not going to work since maven checks for availability of dependencies before it starts executing its life-cycle goals.
You could manually install it one-time using mvn install:install-file outside the context of the pom. Better still you could deploy it to a repository manager and then access it like any other dependency.
However, if you still want to go down this path, an alternate approach would be to specify the dependency with a system scope providing the path of the jar. Refer to this.
<project>
...
<dependencies>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>paho</artifactId>
<version>1.0.0/version>
<scope>system</scope>
<systemPath>${basedir}/lib/paho.jar</systemPath>
</dependency>
</dependencies>
...
</project>

M2Eclipse (M2E) build errors

I have installed the m2e plugin for Eclipse and used it to create a simple archetype. I wrote a small test driver and am trying to build the project (via Maven) and compile my Java sources into class files.
I go toRun >> Run Configurations and create a New Maven Build. I name it and set its base directory to be my project root.
When I try to select Goals it doesn't see any and so I can't add/specify any. I click the Run button. Here is my console output:
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.me:myproject:0.0.1-SNAPSHOT (C:\Users\me\workbench\eclipse\workspace\MyProject\pom.xml) has 3 errors
[ERROR] 'build.plugins.plugin.artifactId' is missing. # line 145, column 17
[ERROR] 'build.plugins.plugin.groupId' is missing. # line 144, column 14
[ERROR] 'build.plugins.plugin.version' for : must be a valid version but is ''. # line 146, column 14
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
The <build> tag in my pom.xml is:
<build>
<plugins>
<plugin>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compiler:compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
A few things:
What should my artifactId, groupId and version be if this is the (standard) Maven compile phase?
Is this the correct way to launch a Maven build (through Run Configurations)? In Ant there is a plugin that lets you see all of the targets defined in your build.xml; I see no such analog in Maven/m2e.
Why does something as simple as compile require plugins? One would think this would be a standard part of any build tool.
You don't need to put anything as you are using all the defaults settings of the maven compiler. If you really want to specify it you can do it this way:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>

Categories