JBoss AS7 Deployment Plugin (jboss-as-maven-plugin) - java

I have tried everything i can think of to get my JBoss to run as a plugin with maven, but it seems impossible to get it tio run. I get the same error on all versions(tried 7.1.1 - 7.9 final).
Does anyone now what can be the problem? I am running on Java 8 and maven 3.
I have also tried all possible ports, 9999, 9990, 4447 and so on. Running in standalone mode. This seems to be a really horrible plugin.
ERROR] Failed to execute goal
Reason: I/O Error could not execute operation '{
ERROR] "operation" => "read-attribute",
[ERROR] "address" => [],
[ERROR] "name" => "launch-type"
[ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:4447. The connection timed out
[ERROR] -> [Help 1]
Jonas

For a default standalone.xml configuration (with 0 port offset) remote management port is 9999.
You need to set this port in jboss maven plugin configuration.
Usually, in this cases you need to check:
1- Plugin configuration matches your jboss standalone xml file. 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>
</configuration>
</plugin>
2 - check if hostname matches the binding interface where your jboss AS is listening. For example using netstat command you can check if jboss is listening in 0.0.0.0:9999 or 127.0.0.1:9999 or another interface.
This ip should be setted in jboss.hostname property and the default port 9999 in jboss.port property.
jboss.user and jboss.pass properties are related to your defined management user in jboss AS.
3 - try to execute mvn jboss-as:deploy. If you get a timeout error message try increasing timeout value in the plugin configuration. 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>
....
30000
....
4 - if problem persist, check your firewall configuration too.

Related

Connect to repo.maven.apache.org:443 failed

I'm trying to build a spring-boot maven project from a jenkins pipeline.
Error:
ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for xxx.xxxxx.xxxx:finance-portal:0.0.1-SNAPSHOT:
Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.4.2
Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.4.2
from/to central (https://repo.maven.apache.org/maven2):
Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.24.215] failed:
Connection refused (Connection refused) and 'parent.relativePath' points at no local POM # line 6, column 10
maven goal:
clean install -U -X
pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
The resolutions I tried so far:
Setting up org proxy through settings.xml file in jenkins and use the config in the pipeline.
Setting up proxies through maven goal: clean install -DproxySet=true -DproxyHost=proxy.com -DproxyPort=xxxxx.
Omitting/Changing relativePath tag in pom.xml to <relativePath>../pom.xml</relativePath> and few other variants.
Remove jenkins workspace for the project and re-build it.
make a curl request to maven central repo before the build to check connection establishment: curl -I -x proxy.com:xxxxx "https://repo.maven.apache.org/maven2". The connection gets established but fails in the build process.
I bet you missed something configuring the proxy setting. For example set up the wrong protocol or you misspelled/misplaced the proxies tag in the setting.xml file.
Here is an example from Apache manual:
<settings>
.
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
.
</settings>
The protocol seems to be a protocol of the proxy server, not of the proxied request. Here is a long discussion about this point:
How to configure a proxy server for both HTTP and HTTPS in Maven's settings.xml?
It is also possible your setting.xml was placed on the wrong place. Here is the default location:
(Linux) /home/bob/.m2/settings.xml
(Windows) C:\Users\bob\.m2\settings.xml
IDE or CD/CI pipeline could override the default location. It can be done like this:
mvn --settings your_location/settings.xml clean install
(or)
mvn -s your_location/settings.xml clean install
Another problem could be the conflict with JVM proxy configuration. I am not sure, which configuration has priority. JVM uses its own arguments:
http.proxyHost (default: <none>)
http.nonProxyHosts (default: localhost|127.*|[::1])
http.proxyPort (default: 80)
https.proxyHost(default: <none>)
https.proxyPort (default: 443)
Here http and https are protocols of the proxied request (at least AFAIU)
https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html
One more possible problem could be the argument -Djava.net.useSystemProxies. If it is set to true (default - false) the operation system wide proxy configuration is used.
While 30thh's answer was definitely helpful for troubleshooting, as a last resort I just cloned a working VM to a new instance, created my pipeline there and it worked like a charm in the first attempt. So it's pretty evident that it was something to do with proxy/firewall of the previous VM/jenkins.

Jetty 9.1.2 Https Connector Selenium maven tests fail in Jenkins

I have below jetty maven plugin config in pom.xml-
<artifactId>jetty-maven-plugin</artifactId>
<version>9.1.2.v20140210</version>
<configuration>
<!-- Added for https connector -->
<jettyXml>${project.basedir}/jetty.xml,
jetty- http.xml,jetty-ssl.xml,jetty-https.xml</jettyXml>
I use following settings in Jenkins-
-Djetty.port=12854 -Dupdate.trunk=1 -Dupdate.trunk=1 -Djetty.stopport=16657
and use below maven plugin for running integration tests-
maven-failsafe-plugin:2.16:integration-test
I have copied all jetty xmls from -
http://juplo.de/configure-https-for-jetty-maven-plugin-9-0-x/
and changed the https connector port to 19854.
I have selenium tests configured for https protocol and 19854 port, and they run in local with firefox webdriver without any issue.
Problems-
1) When I do not send maven arguments -Djetty.port, it takes default port 8080 and fails to start jetty with error - port already in use.
2) When I specify port, I see below in Jenkins-
and jenkins opens http and https-
Started ServerConnector#7eb879b8{HTTP/1.1}{0.0.0.0:12854}
INFO:oejs.ServerConnector:pool-1-thread-1 for channel:
Started ServerConnector#56eafbb4{SSL-http/1.1}{0.0.0.0:19854}
but tests fail- with following error
WARN:oejh.HttpParser:qtp2005308873-112: badMessage: 400
Illegal character for HttpChannelOverHttp#1bf94c90{r=0,a=IDLE,uri=-}
and I see below url in the jenkins test log-
https://localhost:12854/
where as it should be
https://localhost:19854/
How do I get this working in Jenkins?
I appreciate the help.

Memory error when running unit tests in SonarQube -- forked VM terminated without saying properly goodbye

We are consistently getting out of memory errors when running our sonar analysis. It is intermittent across machines, but seems once you get it, it persists.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-cli) on project optimus-client-web-configuration: Execution default-cli of goal org.apache.maven.plugins:
maven-surefire-plugin:2.16:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command wascmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_45\jre\bin\java" -javaagent:C:\Users\cxxx\AppData\Local\Temp\jacocoagent8301608889470684052.jar=destfile=target/jacoco.exec,excludes=
*_javassist_* -jar C:\redesign_Trunk\optimus-lms-server\optimus-client-web-configuration\target\surefire\surefirebooter2312966376869893038.jar C:\redesign_Trunk\optimus-lms-server\optimus-client-web-con
figuration\target\surefire\surefire350975689095180011tmp C:\redesign_Trunk\xxx-xx-server\xxx\target\surefire\surefire_45613339175612175619tmp"
The unit tests do not fail with this when running before the sonar phase. It is occurring on one particular test that activates the Spring configuration to test that it works okay. Likely this test consumes more memory than most since it has to load the whole context.
I upped memory in MAVEN_OPTS to use 1024M max heap. Added this configuration to my pom
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
in this configuration you are just configuring surefire plugin to use this memory when it spawns new jvm, you need to increase memory for mvn's jvm as well
export MAVEN_OPTS="-Xmx2048m"
try above (with proper memory size)
Another solutions: Run application [Eclipse IDE, SonarQube...] as administrator
Problem:
1. When error log contains: '... VM terminated without saying properly goodbye ...'
2. Error log contains: "cmd.exe /C ... error something ..."
3. Error log contains: '... java.io.tmpdir ... c:\windows'

maven... Failed to clean project: Failed to delete ..\org.ow2.util.asm-asm-tree-3.1.jar

I use STS(spring tool suite) + maven plugin.
Every time when I run my application using maven-clean I see following error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hhsystem ui 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # ui ---
[INFO] Deleting C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.471s
[INFO] Finished at: Mon Oct 21 12:34:33 MSK 2013
[INFO] Final Memory: 2M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project ui: Failed to clean project: Failed to delete C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\target\org.ow2.util.asm-asm-tree-3.1.jar -> [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
I have to close STS and go to C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\target and delete org.ow2.util.asm-asm-tree-3.1.jar
After starting STS again it works, but this is a hassle.
Can you help me with this problem?
UPDATE
for Kalathoki L.
I run maven-clean from this state:
I see same behaviour from the command line as from the eclipse plugin
If I watch unlocker when STS is running I see
:
Stop your server before you start to clean.
Stopping a server
You can stop the server from the Servers view.
To stop the server:
In the Servers view ( Window > Show View > Other > Server >
Servers > OK), select the server that you want to stop.
Click the Stop the server icon
in the toolbar. In the Servers view, the status of the server
changes to Stopped.
If for some reason the server fails to stop, you can terminate the
process as follows:
a. Switch to the Debug perspective.
b. In the Process view, select the server process that you want to stop.
c. Click the Terminate
icon in the toolbar.
Note: When terminating a server, the server process will end and the server will not go through the normal routine of stopping, for example calling the destroy() method on a servlet.
Source: Eclipse Help
You may also try try -Dmaven.clean.failOnError=false
(from Maven FAQ)
Delete the java.exe process in Task Manager and run mvn clean install.It worked for me.
Your problem is that a running process within STS is using files located in your target directory while you execute a mvn clean command. Maven will be unable to delete these files (since other processes are still accessing them) and thus fail with that error.
Try to stop all processes (tests, servers, applications) from within STS before running Maven console commands. Look out: This behaviour might also appear if STS is cleaning up the projects and thus re-compiles the sources, and not running a process.
Close the target folder and its file you have opened before mvn clean
Probably there are many processes that use sources compiled, could be a server, an old maven instruction or IDE. Sure terminate all processes, stop the server and then execute maven again. If the problem persists, you should close java.exe process.
Regards!
Try disabling Project->Build Automatically.
As Scorpio suggested, there's a process running that's got a lock on a file somewhere.
I have a large multi-module maven project that regularly fails on clean and this resolves it for me.
I re-enable Build Automatically when I'm done.
I have same problem and this
mvn clean install -U
command fixed the error.
Summary : Use an external script (batch file) that a) stops the server and b) Unlocks the .jar file before running maven-clean.
Steps:
Bind the maven-antrun-plugin:run goal to the pre-clean phase of mvn clean. See how to do this here
See how to use the antrun plugin to run an external batch file in Windows here : sblundy's answer to "Starting external process". Let's call this file unlock_handles.bat
Use the Sysinternals handle utility download link in the pre_clean.bat to a) stop the Tomcat server and b) unlock the .jar file. handle -c and handle -p would be useful here.
Whew! That's a bit of work, but it will reliably automate the process for you so that you do need to do it manually yourself each time!
OK, here's a rough, proof-of-concept version of unlock_handles.bat for you to try out:
REM "Use handle.exe to figure out the process id and handle ids, parse the output, then close the handle (again using handle.exe)"
cd "C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\target"
"c:/Program Files/Process Explorer/handle.exe" -p java.exe "C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\target" > handles.txt
#echo "O====== Going to unlock all the below file handles! =======O"
FOR /F "tokens=1-26 delims=: " %a in (handles.txt) DO #echo %h
FOR /F "tokens=1-26 delims=: " %a in (handles.txt) DO handle -p %c -c %f -y
Of course, you have to change the path to Sysinternals' handle.exe before giving this a try.
If all steps (in existing answers) dont work , Just close eclipse and again open eclipse .
For linux users: possible solution.
Build error due to "Failed to delete < any-file-or-folder >" will occur if there is by chance of only delete access provided to root user rather to normal-user.
Fix : type ll command to list file that cannot be deleted, if the file is given root access, change to normal user by :
sudo chown -R user-name:user-name filename
Later try for maven clean and build.
solved by deleting the target folder manually.
I had similar issue. Earlier I was using Maven 3 to build the project. After switching to maven 2 , I had the above error.
Solved it by switching to Maven 3.
Maven complains if you do not have admin permissions on the target folder.Check if you have admin right to delete that folder.
I solved mine by doing:
mvn clean
mvn install
mvn clean install
For some reasons it worked for me . Good luck !!
If you lock org.ow2.util.asm-asm-tree-3.1.jar and start eclipse, the logging shows who was unable to lock the file. The same codeline who cant lock the file will not release the lock.
In pre-clean phase I execute with Maven Unlocker program. This program unlock all files and directory for anyone program.
I execute this with maven-antrun-plugin and only in windows systems
<profile>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>pre-clean</phase>
<configuration>
<tasks>
<exec dir="${project.build.directory}" executable="cmd" failonerror="false">
<arg value="Unlocker.exe" />
<arg value="/S" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Please close all the browser tab. And next time when you try to upload war from another place except target folder.
If you run into this error in an IDE like Eclipse or IntelliJ, you may have one or more debug windows open and paused on a break-point. Terminate them.
The reason for this error is, the file which maven is trying to delete is being used by some process. One example of such process is Eclipse or any other IDE is doing validation on same project.
Please make sure that no validation running from eclipse or in any other IDE where project is open.
I closed Git Bash (might be another terminal you are working on). It stops the process
Delete ...0.0.1-SNAPSHOT.jar
mvn clean install (or other start your project command; we have .sh)
If you have a process running that using the packaged app deployed like an ftp or ssh session - it could prevent the resource being deleted or moved:
so identify the open port which is using the war or jar, close it - then restart
sftp - ssh port : 22
ssh port : depend on config
for me
mvn install
mvn clean install
worked..

maven release -> peer not authenticated

I'm experimenting a bit with releasing my software (I've never done this before) and so far I've been able to execute mvn release:prepare. As I'm executing release:perform I get the following error:
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plug
in:2.7:deploy (default-deploy) on project img2stl: Failed to deploy artifacts: C
ould not transfer artifact nl.byterendition:img2stl:jar:0.9 from/to byterenditio
n-releases (https://localhost:443/svn/repo/releases): peer not authenticated ->
[Help 1]
I've set up a local password protected svn repository at localhost:443, so I added the following to my settings.xml in my .m2 folder
EDITED TO INCLUDE Edwin Buck's answer:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>byterendition-releases</id>
<username>username</username>
<password>password</password>
</server>
<server>
<id>byterendition-snapshots</id>
<username>username</username>
<password>password</password>
</server>
</servers>
</settings>
This is the useful section of my pom:
<distributionManagement>
<repository>
<id>byterendition-releases</id>
<url>https://localhost:443/svn/repo/releases</url>
</repository>
<snapshotRepository>
<id>byterendition-snapshots</id>
<url>https://localhost:443/svn/repo/snapshots</url>
</snapshotRepository>
</distributionManagement>
How can I get maven to access the svn repository?
Ok, as Edwin Buck suggested I shouldn't use localhost, but since I haven't been able to get it to work otherwise I thought I'd try this using a remote SVN server I use for work. Now I get a different error:
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plug
in:2.7:deploy (default-deploy) on project img2stl: Failed to deploy artifacts: C
ould not transfer artifact nl.byterendition:img2stl:jar:0.9.5 from/to byterendit
ion-releases (https://svn.science.ru.nl/repos/estens/releases/): Failed to trans
fer file: https://svn.science.ru.nl/repos/estens/releases/nl/byterendition/img2s
tl/0.9.5/img2stl-0.9.5.jar. Return code is: 409, ReasonPhrase: Conflict. -> [Hel
p 1]
Again I can access this repo from Eclipse. Does anyone know what I'm doing wrong?
Since version 3.0.5 Maven checks the SSL certificate on https connections. You can temporarily fix this by adding the command line parameters
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
Installing the SSL certificate into your JRE should permanently fix the issue.
Official documentation: http://maven.apache.org/wagon/wagon-providers/wagon-http/
Step 1. Download the certificate in DER format *.cer (/X.509 .cert) file to your local dir
(You can do this from your browser; For Chrome Click on the Lock symbol, Show Ceritficate --> Copy to File)
Step 2. Import it to Java trust store
\Program_Files\Java\jdk1.6.0_45\jre\lib\security>%JAVA_HOME%\jre\bin\keytool
-v -alias mavensrv -import -file d:\temp\apacher.cer -keystore trust.jks
Step 3. Give the path to maven as environment variables
set MAVEN_OPTS=-Xmx512m
-Djavax.net.ssl.trustStore=%JAVA_HOME%/jre/lib/security/trust.jks -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.ssl.keyStore=%JAVA_HOME%/jre/lib/security/trust.jks -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStorePassword=changeit
Your entry in settings.xml is for a server id of localhost but you are accessing repositories with id(s) of byterendition-releases and byterendition-snapshots.
This means that maven won't recogonize and associate the credentials with these two servers, because they have different "identities". You will need settings.xml entries for byterendition-releases and byterendition-snapshots.
Now if you added an entry like
<server>
<id>byterendition-releases</id>
<username>user</username>
<password>password</password>
</server>
Then maven would meet the https authentication challenge to byterendition-releases with a username of user and a password of password, because it has a server credential entry for byterendition-releases.
You'll also have to add in an additional entry for byterendition-snapshots, or set it to have the same server id as byterendition-releases.
--- Edited to keep up with the updated question ---
You are reaching for your repository with a localhost URL. While this might work if your repository is really on the same host machine, there are lots of reasons why it might not work.
The SVN repository is on a remote SVN server, so this will fail when developing elsewhere than the remote server.
The HTTP server is not configured to resolve localhost exactly the same way that it might resolve an external request.
Either way, ditch localhost. If you can't get a stable DNS name for the machine, even putting in an IP address is a better choice. If your SVN server is on DHCP, then invest the time into getting DynamicDNS working (but really, you should get a static IP for a server if you can).
https://github.com/escline/InstallCert provides the necessary tools and provides a step by step instruction on how to import a remote certificate into the system-wide certificate store.
I found that the Java version can make a difference here.
With Maven 3.0.5 I was getting this error with Java 6, but switching to Java 7 (or newer) resolved it for me.
It looks like a SSL problem when connecting to the server. Maybe before the username and password check.
Did you config the svn server with SSL client auth? This means you need to send a client certificate to the server.
I've had lot of security issues after upgrading to OSX Mavericks
SSL problem with Amazon AWS
peer not authenticated with Maven and Eclipse
trustAnchors parameter must be non-empty
I applied this JAVA update and it fixed all my issues:
http://support.apple.com/kb/DL1572?viewlocale=en_US
I'm using maven 3.5.3, and I choose to temporarily fix this SSL issue by adding the command line parameters according to above answers. But the parameters's format seems changed a little.
-D maven.wagon.http.ssl.insecure=true -D maven.wagon.http.ssl.allowall=true
Sorry I can't comment #Alex Punnen's answer, so I have to write a new answer.
I had the same issue using maven 3.6.0. All proposed solutions (using -Dmaven.wagon.http.ssl.insecure=true, -Dmaven.wagon.http.ssl.allowall=true, update CA store) did not work for me. Actually the deployment failed not on the first module but on the ~25ish or so, and was successful for all previous modules. Thus I assumed that in general the SSL handling was ok and there was general issue in the local <> server connection or certificates.
Leaving me quite confused for some time, I today stumbled across this jacoco issue where they mention the deployAtEnd parameter. Adding this parameter to my pom.xml as part of the deploy plugin configuration solved the issue for me.
However, I'm yet not clear on why the deployment failed on some later module and not on the first already.

Categories

Resources