I've tried for days to use jboss-as-maven-plugin to deploy web projects to remote JBoss AS7, but it didn't work.
Here is my pom.xml:
<!-- JBoss Application Server -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.CR1b</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<!-- Only remote server needs -->
<configuration>
<hostname>192.168.1.104</hostname>
<port>9999</port>
<username>admin</username>
<password>admin123</password>
</configuration>
</execution>
</executions>
</plugin>
Using this configuration I can deploy to localhost without <configuration>, even no <username> and <password>.
To deploy to my real IP address, I modified ${JBOSS_HOME}/configuration/standlone.xml, by changing jboss.bind.address from 127.0.0.1 to 0.0.0.0 (to unbind JBoss address), so I can deploy projects by using:
<configuration>
<!-- 192.168.1.106 is my ip -->
<hostname>192.168.1.06</hostname>
<port>9999</port>
</configuration>
It works too, but by changing <hostname> to point to my other computer (in the same router) it doesn't work but that computer receives a request, and the request is cut by something. (I thought it may be JBoss)
The error message in Maven console is as follows:
INFO: JBoss Remoting version 3.2.0.CR8
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.572s
[INFO] Finished at: Fri Feb 10 23:41:25 CST 2012
[INFO] Final Memory: 18M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.1.0.
CR1b:deploy (default) on project MessagePushX-RELEASE: Could not execute goal de
ploy on MessagePush.war. Reason: java.net.ConnectException: JBAS012144: Could no
t connect to remote://192.168.1.104:9999. The connection timed out -> [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/MojoExecutionException
Who can tell me is JBoss as 7.1.0 is not allowed remote deploy?
For some security issues?
It is definitely not a security issue.
The plugin you are referring uses the JBoss AS7 ability to deploy applications using the Server Deployment Manager (this is new feature in AS7). Previously the deployment was only possible via JMX console, which required the deployment artifact to be reachable by server (local file or URL).
You need to make sure:
192.168.1.104 is running JBoss AS7 with Server Deployment Manager listening on port 9999.
The port should not be bound to localhost iface (not 127.0.0.0:9999 but *:9999).
There is no firewall between you and 192.168.1.104 rejecting packets to port 9999.
what worked for me was to change from jboss-as plugin to wildfly plugin:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha8</version>
</plugin>
and then using the maven command:
mvn wildfly:deploy
reference: https://issues.jboss.org/browse/WFLY-3684
For me it worked when configuring the plugin with the hostname parameter "127.0.0.1" as the server seems to bind to that IP by default:
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.3.Final</version>
<configuration>
<hostname>127.0.0.1</hostname>
</configuration>
</plugin>
</plugins>
</build>
I solved this problem, using the last version of plugin:
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.5.Final</version>
</plugin>
Remote deployment definitely works.
Be sure that management port (native) is bound to *.9999, as mentioned above .
<socket-binding name="management-native" interface="management" port="${*:9999}"/>
Be sure that you added user to management realm. Also, I noticed that password was cached the first time I ran plugin, so later on it keep using stale password (from first run) instead of new one. I notice this using mvn -X option.
I also turned off firewall on jboss server host machine. At least ports 8787, 4447, 8080, 9990 must be opened.
Here is complete plugin declaration
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.6.Final</version>
<executions>
<execution>
<goals>
<goal>deploy</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
<configuration>
<force>true</force>
<hostname>IP</hostname>
<port>9999</port>
<username>mvndeploy</username>
<password>pa##word1.</password>
<filename>${project.build.finalName}</filename>
</configuration>
</plugin>
Test everyting with :
mvn package jboss-as:deploy
Use wildfly-maven-plugin instead of jboss-maven-plugin.
For me worked changing the version of the maven plugin to the newer:
<version>7.1.0.Final</version>
When I got the same error by using IntelliJ I undeployed the project from JBoss server and again deployed it is working fine.
This issue usually occurs due to binding address of your JBOSS, if you will take a look at standlone.xml the jboss management bind address is
jboss.bind.address.management:127.0.0.1
You can change it to the machine IP adress or point it to 0.0.0.0
jboss.bind.address.management:0.0.0.0/machine IP
restart JBOSS and try mvn jboss plugin should work like a charm.
Related
I am facing this issue while building a maven project
[INFO] Cloning git#bitbucket.org:bookkeeper/bookkeeper-openapi3-hosted-ui-configuration.git:refs/tags/v5.0.0 into /Users/shubhamjain/bookkeeper/de/bookkeeper-ui-service/service/bookkeeper-api/bookkeeper-platform-hosted-ui-configuration-5.0.0
[ERROR] Failed to fetch bookkeeper-platform-hosted-ui-configuration API (5.0.0):
org.eclipse.jgit.api.errors.TransportException: git#bitbucket.org:bookkeeper/bookkeeper-openapi3-hosted-ui-configuration.git: Auth fail
at org.eclipse.jgit.api.FetchCommand.call (FetchCommand.java:222)
----
----
Caused by: org.eclipse.jgit.errors.TransportException: git#bitbucket.org:bookkeeper/bookkeeper-openapi3-hosted-ui-configuration.git: Auth fail
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession (JschConfigSessionFactory.java:162)
at org.eclipse.jgit.transport.SshTransport.getSession (SshTransport.java:107)
Initially I had issues in access to the mentioned repository but then I got required permissions.
In the pom.xml
-----
-----
<plugin>
<groupId>com.bookkeeper</groupId>
<artifactId>bookkeeper-api-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-hosted-ui-configuration-openapi-hook</id>
<goals>
<goal>generate-client</goal>
</goals>
<configuration>
<apiName>bookkeeper-platform-hosted-ui-configuration</apiName>
<apiVersion>5.0.0</apiVersion>
<repositorySpecPath>bookkeeper-platform-hosted-ui-configuration/application-hosted-ui-configuration.yaml</repositorySpecPath>
<gitUrlTemplate>git#bitbucket.org:bookkeeper/bookkeeper-openapi3-hosted-ui-configuration.git</gitUrlTemplate>
<openapiConfigurationOverrides>
<isExperimental>false</isExperimental>
<apiName>hosted-ui-configuration</apiName>
</openapiConfigurationOverrides>
</configuration>
</execution>
</executions>
</plugin>
-----
-----
What could be missing ? Thanks in advance.
Issue was Maven couldn't find ssh binary path on the environment
Setting GIT_SSH environment variable worked.
export GIT_SSH=${SSH_BINARY_PATH}
In my case
export GIT_SSH=/usr/bin/ssh
In my project I have a configuration such as
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<commandlineArgs>${additionalExecArgs} -jar ${project.build.directory}/someDir/some.jar</commandlineArgs>
<executable>java</executable>
<classpathScope>runtime</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
to start an executable JAR using Maven exec:exec.
The additionalExecArgs property is empty by default.
In NetBeans I can run this goal by specifying the following action in the nbactions.xml file:
<action>
<actionName>run</actionName>
<goals>
<goal>exec:exec</goal>
</goals>
</action>
To debug this goal in NetBeans I've added the following action to the nbactions.xml file:
<action>
<actionName>debug</actionName>
<goals>
<goal>exec:exec</goal>
</goals>
<properties>
<jpda.listen>true</jpda.listen>
</properties>
<activatedProfiles>
<activatedProfile>debug</activatedProfile>
</activatedProfiles>
</action>
So in addition to running exec:exec it sets the NetBeans (?) property jpda.listen to true and activates the Maven profile debug.
I've also added the following Maven profile to my POM:
<profile>
<id>debug</id>
<properties>
<additionalExecArgs>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</additionalExecArgs>
</properties>
</profile>
With this configuration I can simply run the debug action from the project context menu/ toolbar.
Please note the jpda.address Maven property however. This property seems to get populated by NetBeans somehow.
If I try to run exec:exec with the debug profile in IntelliJ or Eclipse I'm getting an error, likely because the jpda.address Maven property doesn't get set.
E.g. I'm getting the following error in IntelliJ:
/usr/lib/jvm/java-8-oracle/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:42300,suspend=y,server=n -Dmaven.home=/usr/share/maven -Dclassworlds.conf=/usr/share/maven/bin/m2.conf -Dfile.encoding=UTF-8 -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar:/opt/idea-IC-141.1010.3/lib/idea_rt.jar org.codehaus.classworlds.Launcher -Didea.version=14.1.3 -Dmaven.repo.local=/home/someUser/.m2/repository exec:exec -P debug
Connected to the target VM, address: '127.0.0.1:42300', transport: 'socket'
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test-application 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:exec (default-cli) # test-application ---
ERROR: transport error 202: connect failed: Verbindungsaufbau abgelehnt
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
The port changes with every call.
I've tried and replaced jpda.address with a fixed address/ port such as 127.0.0.1:8000, but I'm getting the same error and now in NetBeans, too.
So how can I get a similar behavior in IntelliJ and Eclipse as in NetBeans and debug an exec:exec goal using a Maven run configuration directly without having to resort to a remote debugger configuration or such?
It sounds like you can set up a Remote debug configuration in intellij with a Before launch Maven Goal.
Set it up as follows:
Run/Debug Configurations -> Add Remote -> Add Before Launch -> Maven -> specify correct module and goal.
When I try to deploy or undeploy my application(EAR) in JBoss using Maven and Jenkins I get the following error :
INFO: JBoss Remoting version 3.2.12.GA
[DEBUG]
java.io.IOException: java.net.ConnectException: JBAS012144: Could not
connect to remote://192.168.1.8:10099. The connection timed out
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:129)
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:71)
at org.jboss.as.plugin.common.AbstractServerConnection.isDomainServer(AbstractServerConnection.java:234)
at org.jboss.as.plugin.common.AbstractServerConnection.getClient(AbstractServerConnection.java:156)
...
My JBoss server is listening the port 10099 (9999+100) taking into account the following jboss configuration:
<socket-binding-group
name="standard-sockets"
default-interface="public"
port-offset="${jboss.socket.binding.port-offset:100}">
<socket-binding
name="management-native"
interface="management"
port="${jboss.management.native.port:9999}"/>
The Maven plugin configuration :
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.6.Final</version>
<inherited>true</inherited>
<configuration>
<!-- <skip>true</skip> -->
<hostname>${deploy.jboss.host}</hostname>
<port>${deploy.jboss.port}</port>
<username>${deploy.jboss.user}</username>
<password>${deploy.jboss.password}</password>
<filename>fitness-${stage}-${app.server}.ear</filename>
<name>fitness-${stage}-${app.server}.ear</name>
<skip>${skip.deployment}</skip>
<!-- Logging ??? not working-->
<execute-commands>
<commands>
<command>/subsystem=logging/file-handler=debug:add(level=DEBUG,autoflush=true,file={"relative-to"=>"jboss.server.log.dir", "path"=>"jenkins-deployment.log"})
</command>
<command>/subsystem=logging/logger=org.jboss.as:add(level=DEBUG,handlers=[debug])
</command>
</commands>
</execute-commands>
</configuration>
<executions>
<execution>
<id>deploy-application</id>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>undeploying-all-application</id>
<goals>
<goal>undeploy</goal>
</goals>
<configuration>
<match-pattern>fitness-.*</match-pattern>
<matchPatternStrategy>all</matchPatternStrategy>
</configuration>
</execution>
</executions>
</plugin>
With the following variables :
deploy.jboss.host = 192.168.1.8
deploy.jboss.port = 10099
Here is my configuration :
OS : Ubuntu 13.04
Java : 1.6.0_26
JBoss : 7.1.1.final
Maven : 3.0.3
Jboss-as-maven-plugin : 7.6.final
Jenkins and the target jboss server are running the same machine identified by the ip 192.168.1.8
My own diagnostic :
If I run
sudo netstat -nlp | grep :10099
I get :
tcp 0 0 0.0.0.0:10099 0.0.0.0:* LISTEN 25475/java
And 25475 is my Jboss instance. It seems that JBoss is listening behind the right port.
I can connect using another instance with CLI :
sh jboss-cli.sh controller=192.168.1.8:10099
Thanks in advance for your help
I had same problem and I solved it setting a higher timeout value.
For example:
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.9.Final</version>
<inherited>true</inherited>
<configuration>
<hostname>${jboss.hostname}</hostname>
<port>${jboss.port}</port>
<username>${jboss.user}</username>
<password>${jboss.pass}</password>
....
<timeout>30000</timeout>
....
</configuration>
</plugin>
Default "timeout" value is 5000ms. You can try with a higher value like 30000ms. It worked for me.
Edited:
As Pedro said, another option can be passing "timeout" to maven via a command line argument. eg. -Djboss-as.timeout=30000
The problem was JDK 7 related. My jenkins server was using Java 1.7
If you want to use the jdk 7 you need to use the following parameter :
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider
I had the similar issue, however the fix was different, it might help somebody. I had to change maven plugin to the following one:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha11</version>
</plugin>
I've been toying around with the latest changes in the gwt-maven-plugin. Most notably, the new packagings gwt-app and gwt-lib.
To my understanding, if I have some code that I'd like to reuse between different GWT apps, gwt-lib packages all needed sources and *.gwt.xml files in the jar right next to all classes. It works like a charm.
If I opt for a multi-module maven reactor build, everything is detected on compile time and I'm able to build and deploy successfully without any hassle. If I try to develop however, the shiny GWT 2.7 SuperDevMode is unable to detect changes in the gwt-lib projects, obviously because they are referenced from the jars and not the actual sources directory where they were changed.
To illustrate, I used the modular-requestfactory archetype by Thomas Broyer.
mvn archetype:generate \
-DarchetypeCatalog=https://oss.sonatype.org/content/repositories/snapshots/ \
-DarchetypeGroupId=net.ltgt.gwt.archetypes \
-DarchetypeArtifactId=modular-requestfactorcom.testy \
-DarchetypeVersion=1.0-SNAPSHOT
and I entered the following information:
Define value for property 'artifactId': : mvngwt
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': com.test: :
Define value for property 'module': App: : MvngwtApp
Define value for property 'module-short-name': mvngwtapp: :
Afterwards I created an additional maven module called "mvn-gwt-client-api", which contains a single class that is to be used by the mvn-gwt-client. The end structure looks like this:
mvngwt/
--mvngwt-client/
--mvngwt-client-api/
--mvngwt-server/
--mvngwt-shared/
--pom.xml
The goal is to be able to edit the files in mvngwt-client-api (e. g. the only class currently: MvngwtApi.java), then recompile in SuperDevMode and actually see the changes immediately without restarting the CodeServer.
A working copy of the project can be found here: https://github.com/elnicko/maven-gwt-test
PS: I tried to work it out with the build-helper-maven-plugin:
<profiles>
<profile>
<!-- elnicko: add to support CodeServer hot compile for referenced libraries -->
<id>env-dev</id>
<activation>
<property>
<name>env</name>
<value>dev</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-shared-sources-to-classpath</id>
<!--
<phase>process-classes</phase>
<phase>compile</phase>
-->
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/../mvngwt-client-api/src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
However it didn't improve the situation.
Any hints/pointers/ideas greatly appreciated.
Edit:
I am able to use the SuperDevMode incremental compilation by using the aforementioned build-helper-maven-plugin configuration, changing the mvngwt-client-api packaging from "gwt-lib" to "jar", and adding a "maven-source-plugin". That way maven compilation and deployment work the same way, but the CodeServer is made aware of the changes in the source directory of mvngwt-client-api. Nevertheless, the question remains open, how one can use the new "gwt-lib" without losing the CodeServer incremental compilation. The diff may be seen here: https://github.com/elnicko/maven-gwt-test/compare/master...working_wihtout_gwt-lib_but_with_jar_packaging
You have to use <type>gwt-lib</type> in your dependency.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mvngwt-client-api</artifactId>
<version>${project.version}</version>
<type>gwt-lib</type>
</dependency>
Actually, if you run Maven with -X you'll see in the logs:
[DEBUG] Adding sources for com.test:mvngwt-client:gwt-app:1.0-SNAPSHOT
[DEBUG] Ignoring com.test:mvngwt-shared:jar:1.0-SNAPSHOT; neither a java-source, gwt-lib or jar:sources.
[DEBUG] Adding sources for com.test:mvngwt-shared:jar:1.0-SNAPSHOT
[DEBUG] Ignoring com.test:mvngwt-client-api:jar:1.0-SNAPSHOT; neither a java-source, gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.7.0; neither a java-source, gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.7.0; neither a java-source, gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-codeserver:jar:2.7.0; neither a java-source, gwt-lib or jar:sources.
Maybe those should be emitted at INFO level rather than DEBUG…
BTW, instead of the build-helper-maven-plugin, you could have just used a <type>java-source</type> or <classifier>sources</classifier> dependency, like it's done for the mvngwt-shared module.
I wanna run selenium tests from TeamCity using Maven at Linux server without display.
While running Selenium tests I'm getting the following error in TeamCity:
Failed to execute goal org.codehaus.mojo:selenium-maven-plugin:2.3:xvfb (xvfb) on project my-project:
It appears that the configured display is already in use: :1
I installed x11-fonts*, xvfb, firefox, extracted DISPLAY=localhost:1, started xvfb
In pom.xml I added the following plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>xvfb</id>
<phase>pre-integration-test</phase>
<goals>
<goal>xvfb</goal>
</goals>
<configuration>
<display>:1</display>
</configuration>
</execution>
<execution>
<id>selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin>
Do you have any ideas how to fix this problem?
UPD: xvfb is running using commmand
Xvfb :1 -screen 0 1920x1200x24 > /dev/null 2>&1 &
UPD: Before I've tried not to run xvfb before running tests, but was getting:
Execution xvfb of goal org.codehaus.mojo:selenium-maven-plugin:2.3:xvfb failed: Execute failed: java.io.IOException: Cannot run program "xauth": java.io.IOException: error=2, No such file or directory
The error message tells you there is already an X server running on display number 1. From what you say:
I installed x11-fonts*, xvfb, firefox, extracted DISPLAY=localhost:1, started xvfb ... I added the following plugin
it seems that you started a server, and then the plugin tried to start it once more (as it should). I'd try not starting xvfb beforehand (ensure it doesn't run).
Or get rid of the display number in the plugin configuration altogether, it will try to find a free display number. It won't use your xvfb instance, though.
I removed plugin declaration from pom.xml (as far as got to know that it's for previous version of Selenium), installed xauth (not sure that was necessary) and everything began to work.