Maven WildFly Plugin: Could not execute goal deploy - java

I want to deploy my war-files with the maven wildfly-plugin.
I use the wildfly-8.2.0.Final-version and I was to force to change the port of the management-console to http://127.0.0.1:9990.
This is my maven configuration:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<configuration>
<jbossHome>C:\wildfly-8.2.0.Final</jbossHome>
<hostname>127.0.0.1</hostname>
<port>8080</port>
<serverConfig>standalone-full.xml</serverConfig>
</configuration>
</plugin>
I get following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.705 s
[INFO] Finished at: 2016-02-01T22:46:43+01:00
[INFO] Final Memory: 21M/171M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:deploy (default-cli) on project wildfly: Could not execute goal deploy on C:\Users\laudatio\Documents\Java\wildfly\target\wildfly.war. Reason: I/O Error could not execute operation '{
[ERROR] "operation" => "read-attribute",
[ERROR] "address" => [],
[ERROR] "name" => "launch-type"
[ERROR] }': java.io.IOException: Unknown service name
[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/MojoExecutionException
Any suggestions?

The error message isn't great, it's been fixed upstream, but the issue is you've got the wrong port defined. The plugin uses the management port which by default is 9990. If you change the configuration to <port>9990</port> or leave it off it should work.
A side note most of the configuration you have is not needed. The jbossHome and serverConfig are only needed for the run and start goals. If you're just deploying you don't need any of that configuration defined. The defaults should be correct.

The reason of the problem could be one of the following:
The deployment of any archive (jar, war, ear) through wildfly-maven-plugin plugin will happen only if the WildFly is listening at its management port which is 9990 by default. So make sure that WildFly is listening at its management port.
If WildFly is listening at its management port then check if your host file located at %SYSTEM_ROOT%\System32\drivers\etc for windows machine is configured correctly. i.e. your local host is mapped correctly for both IPv4 and IPv6.
127.0.0.1 localhost
::1 localhost

Related

Failed to read artifact descriptor for commons-jxpath:commons-jxpath:jar:1.3-osgi:

I am facing below mentioned error while building through maven . I have tried many solutions like using mirror but none of them is working . Please point me in some direction to fix the issue.
Downloading: http://repository.codehaus.org/org/beanshell/bsh/2.0b4-osgi/bsh-2.0b4-osgi.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.779 s
[INFO] Finished at: 2016-05-23T13:26:22+05:30
[INFO] Final Memory: 16M/308M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project net-myproject-ticketing-reports: Could not resolve dependencies for project net.myproject.ticketing.reports:net-myproject-ticketing-reports:jar:1.0.1-SNAPSHOT: Failed to collect dependencies at com.myproject.resourcelib.thirdparty.framework:mule-mule-2.2.1:jar:2.2.1 -> org.mule.transports:mule-transport-bpm:jar:2.2.1 -> org.mule.modules:mule-module-client:jar:3.4.0 -> org.mule.modules:mule-module-xml:jar:3.4.0 -> commons-jxpath:commons-jxpath:jar:1.3-osgi: Failed to read artifact descriptor for commons-jxpath:commons-jxpath:jar:1.3-osgi: Could not transfer artifact commons-jxpath:commons-jxpath:pom:1.3-osgi from/to codehaus (http://repository.codehaus.org): Failed to transfer file: http://repository.codehaus.org/commons-jxpath/commons-jxpath/1.3-osgi/commons-jxpath-1.3-osgi.pom. Return code is: 503 , ReasonPhrase:Service Unavailable. -> [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
The problem is that codehaus.org was closed and is no longer available, but older versions of Mule still mention that repository as a place to resolve some dependencies. Specifically commons-jxpath:commons-jxpath:jar:1.3-osgi which appears to be non-standard rebundling of version 1.3 with added OSGI support.
What you can do:
use a newer version of Mule that no longer depends on custom artifacts that are not available in standard repositories
find a different repository that hosts this artifact and add custom repository location either to user settings.xml or project pom.xml.
With option 2 random googling presents this repository: (not sure if it's a good choice!)
<repositories>
<repository>
<id>mule-old-dependencies</id>
<url>http://repository.idega.com/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Maven not using mirror from settings.xml after jdk version change

I have a simple java application which prints Hello world. I have mentioned a proxy server in settings.xml which Maven should use while running(running fine in Jenkins).
Previously, I was using jdk7. Now, I changes it to jdk1.8.0_45 and reran the application again(in Jenkins). Now I can see in the log that maven is searching the default repository which is should not be.
Now the error is:
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.093s
[INFO] Finished at: Tue Jul 07 15:56:36 CEST 2015
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused: Connection timed out: connect -> [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/PluginResolutionException
Thanks in Advance!

Oracle JDBC 7 as Maven dependency

I'm attempting to add Oracle JDBC to my project as a maven dependency. I've followed multiple tutorials online which suggest various means to add a third party dependency.
I've opted for the local installation method, but like (this person) I'm experiencing issues.
I run the following command to install the jar:
mvn install:install-file -Dfile={lib/ojdbc7.jar} -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
and it succeeds with:
[INFO] --- maven-install-plugin:2.3:install-file (default-cli) # standalone-pom ---
[INFO] Installing /home/<myfolder>/{lib/ojdbc7.jar} to /home/<myname>/.m2/repository/com/oracle/ojdbc7/12.1.0.1/ojdbc7-12.1.0.1.jar
I have then added the following to my pom:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>
and yet when I compile I get the following:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.307s
[INFO] Finished at: Sat May 02 20:40:07 NZST 2015
[INFO] Final Memory: 8M/56M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project xxx: Could not resolve dependencies for project com.xxx:xxx:jar:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc7:jar:12.1.0.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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
I've played around with the -U and -o flags to no avail. I have also tried installing the jar by first cding into the lib directory (as suggested by Raghuram on the other question) with no change.
Solution
Manually place this ojdbc7-12.1.0.1.jar file in your Local Maven/Cache Repository.
Use mvn deploy goal while you are using 3rd Party Jar/Proprietary JAR Files in your Local Maven Repository.

Deploying on Wildfly using jboss-as-maven-plugin

I'm actually really new to this...
everytime I try to deploy a war file in Wildfly it gives me this error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.774 s
[INFO] Finished at: 2015-03-23T01:56:20+08:00
[INFO] Final Memory: 24M/283M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.3.Fi
nal:deploy (default-cli) on project jbpm6-example: Could not execute goal deploy
on E:\Apps\jbpm6-example\target\jbpm6-example-1.0.war. Reason: Error could not
execute operation '{
[ERROR] "address" => [],
[ERROR] "operation" => "read-attribute",
[ERROR] "name" => "launch-type"
[ERROR] }'. java.net.ConnectException: JBAS012144: Could not connect to remote:/
/localhost:9999. The connection timed out
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
I've tried configuring the plugin in pom.xml like this to connect to port 9999 since from what I've searched wildfly is using port 9990..
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.3.Final</version>
<configuration>
<hostname>localhost</hostname>
<port>9999</port>
</configuration>
</plugin>
but still can't deploy it...
I've also tried using the wildfly-maven-plugin but it also gives me an error: Deployment failed and was rolled back
Older jboss-as-maven-plugin will not work with WildFly. You need to use the newer wildfly-maven-plugin only. It can be defined as:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha1</version>
</plugin>
...
</plugins>
...
</build>
...
</project>
And then mvn wildfly:deploy will work.
Here is a blog that provide more details:
http://blog.arungupta.me/wildfly-maven-plugin-tech-tip-9/
All Java EE 7 samples at https://github.com/javaee-samples/javaee7-samples use this plugin as well.
Alternatively, you can find a simpler Java EE 7 sample using this plugin at:
https://github.com/javaee-samples/javaee7-simple-sample/blob/master/pom.xml

Deploy maven project to tomcat

I have Maven project and Tomcat server.
I work in IDEA when I click in "Maven LifeCicle" -> "deploy", i have a problem:
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # TestMaven ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.035 s
[INFO] Finished at: 2014-09-20T13:52:32+04:00
[INFO] Final Memory: 11M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestMaven: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [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
Piace of my POM.xml is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>tomcat</server>
<url>http://localhost:8080/manager/text</url>
</configuration>
</plugin>
Not worked or:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
also not worked.
In the default maven lifecycle mvn deploy means to deploy one or more build artifacts to a maven repository. The reason is because the maven-deploy-plugin's deploy goal is bound to the deploy phase of the lifecycle. This configuration is automatically done when you use for example packaging jar.
In maven
a maven build lifecycle is made up of phases
a phase is made up of plugin goals
the packaging type (e.g. jar, ear, war) pre-configures plugins goals for execution in a lifecycle phase
In order to solve your problem I would first package the webapp and then invoke the deploy goal of the tomcat7-maven-plugin.
mvn package org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy
or simply
mvn package tomcat7:deploy
The mvn command above means:
invoke the default build lifecycle until phase package
then the goal deploy of the tomcat7 plugin.
If you want to know how maven resolves tomcat7:deploy to org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy you should read more about plugin groups and plugin naming conventions.
With maven deploy command, usually gets errors for various reasons.
if you work in Unix/Linux system, I recommend using "rsync" method on console. (You can write own shell script to manage easily). It helps not only deploying without a problem but also helps to get time while redeploying (only uploading changed / new files). Because maven deploy / redeploy uploads your project as a bundle in jar/war. However "rysnc" method uploads your project files one by one.
Before using it, you should sure that two conditions.
1- your project is built in target folder (Spring Tool Suite)
2- you have access to tomcat via ssh
example code : (v_ : prefix which is variable(customizable))
rsync -avz v_your_project_in_target root#v_ip:v_tomcat_name/webapps/v_project_name

Categories

Resources