This is my pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://192.168.10.42:8086/manager/html</url>
<server>TomcatServer</server>
<path>/MavenExample321</path>
<username>XXX</username>
<password>XXXXXX</password>
</configuration>
</plugin>
Am trying to redeploy the java application using maven using following command
mvn tomcat7:redeploy
am able to deploy but unable to redeploy application to same path second time, its giving the following error
[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] OK - Undeployed application at context path /MavenExample321
[INFO] FAIL - Failed to deploy application at context path /MavenExample321
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.490s
[INFO] Finished at: Wed Nov 25 11:00:38 IST 2015
[INFO] Final Memory: 16M/183M
[INFO] ------------------------------------------------------------------------
Finally I found the solution.
Use following update tag in configuration
<update>true</update>
and use the following command to undeploy last deployed application and redeploy the new war file with same name.
mvn clean tomcat:deploy
Related
How should I set up this maven plugin when there is no access to the online docker registry to force use local resources only?
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.4.0:dockerBuild (default-cli) on project mental: registry-1.docker.io: Temporary failure in name resolution: Unknown host registry-1.docker.io: Temporary failure in name resolution -> [Help 1]
the plugin conf is:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<configuration>
<from>
<image>adoptopenjdk:11-jre-hotspot</image>
</from>
<to>
<image>mental:latest</image>
</to>
<container>
<entrypoint>
<shell>sh</shell>
<option>-c</option>
<arg>chmod +x /entrypoint.sh && sync && /entrypoint.sh</arg>
</entrypoint>
<ports>
<port>8080</port>
</ports>
<environment>
<SPRING_OUTPUT_ANSI_ENABLED>ALWAYS</SPRING_OUTPUT_ANSI_ENABLED>
<JHIPSTER_SLEEP>0</JHIPSTER_SLEEP>
</environment>
<useCurrentTimestamp>true</useCurrentTimestamp>
</container>
</configuration>
</plugin>
UPD.
After upgrading jib plugin to 1.61. and adding the docker:// before the image name, offline build is working, but I'm getting the below error at the output:
[INFO] --- jib-maven-plugin:1.6.1:dockerBuild (default-cli) # mental ---
[WARNING] <container><useCurrentTimestamp> is deprecated; use <container><creationTime> with the value USE_CURRENT_TIMESTAMP instead
[WARNING] Setting image creation time to current time; your image may not be reproducible.
[INFO]
[INFO] Containerizing application to Docker daemon as mental...
[INFO]
[INFO] Container entrypoint set to [sh, -c, chmod +x /entrypoint.sh && sync && /entrypoint.sh]
[INFO]
[INFO] Built image to Docker daemon as mental
[INFO] Executing tasks:
[INFO] [==============================] 100.0% complete
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:30 min
[INFO] Finished at: 2019-09-28T19:02:35+03:00
[INFO] ------------------------------------------------------------------------
Exception in thread "Thread-5" Exception in thread "Thread-6" java.lang.NoClassDefFoundError: com/google/common/io/RecursiveDeleteOption
at com.google.cloud.tools.jib.filesystem.FileOperations.lambda$deleteRecursiveOnExit$1(FileOperations.java:102)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.google.common.io.RecursiveDeleteOption
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 2 more
java.lang.NoClassDefFoundError: com/google/common/io/RecursiveDeleteOption
at com.google.cloud.tools.jib.filesystem.FileOperations.lambda$deleteRecursiveOnExit$1(FileOperations.java:102)
at java.lang.Thread.run(Thread.java:748)
Seeing the config would help, but you can instruct jib via <configuration> to use local docker deamon as the source of the image by prepending the image name with docker:// like below (which btw requires plugin version 1.6.0+):
<configuration>
<from>
<image>docker://openjdk:alpine</image>
</from>
<!-- ... -->
</configuration>
HTH
I'm using Tomcat 8, Maven 3.1.1 , JDK 1.8.0_31 and tomcat7-maven-plugin 2.2 .
My OS is Windows 7 64 bit.
I can't deploy a war file to Tomcat when it's configured for HTTPS. HTTP works fine.
I found two threads on Stackoverflow but they didn't solve my problem.
The keystore file contains only one entry.
My maven settings.xml contains valid admin credentials for the tomcat server.
Here is the POM plugin configuration.
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>https://localhost:8443/manager/text</url>
<server>tomcat8-local</server>
<path>/entryServlet</path>
<httpsPort>8443</httpsPort>
<keystoreFile>D:\intellij-project\keystore\keystore</keystoreFile>
<keystorePass>pass1</keystorePass>
</configuration>
</pugin>
This is the maven output:
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # intellij-project ---
[INFO] Deploying war to https://localhost:8443/entryServlet
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.194s
[INFO] Finished at: Wed Jan 21 10:13:29 CET 2015
[INFO] Final Memory: 17M/206M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project intellij-project:
Cannot invoke Tomcat manager: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target -> [Help 1]
I found the solution: I had to import my self-created certificate in
the Java keystore located in JAVA_HOME/jre/lib/security
I followed these instructions:
No more 'unable to find valid certification path to requested target'
I use Jboss-Maven-Plugin by 1.4 version. I look JBoss Maven Plugin Usage Example,And I pom.xml is
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<jbossHome>E:\JavaWorkingTools\JBoss\jboss-5.1.0.GA</jbossHome>
<serverName>default</serverName>
<hostName>localhost</hostName>
<port>8080</port>
<fileName>${project.build.directory}/${{project.build.finalName}.war</fileName>
</configuration>
</plugin>
WHen I input the jboss:start console message is INfo! But Terminate isn't running?
Info Message is:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SSH2Maven JEE5 Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- jboss-maven-plugin:1.4:start (default-cli) # SSH2Maven ---
[INFO] Starting JBoss...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.328s
[INFO] Finished at: Sun Jul 11 19:10:15 CST 2010
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
Why?This version can only be used in 4.x below ?
Ok, first of all, the plugin is not really designed for JBoss AS 5 and while some features will work (start, stop, hard-deploy) some deployment features might not work.
Second, the jboss:start goal isn't "blocking", it will start JBoss in the background as an independent process.
Here is what I get after some time when running jboss:start with JBoss 5 (and a plugin configuration similar to yours):
$ mvn jboss:start
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building my-webapp Maven Webapp
[INFO] task-segment: [jboss:start] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [jboss:start {execution: default-cli}]
[INFO] Starting JBoss...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
...
$ ps aux | grep -i jboss
pascal 23080 0.0 0.0 1828 292 pts/3 S 23:02 0:00 sh -c cd /home/pascal/opt/jboss-5.1.0.GA/bin; export JBOSS_HOME="/home/pascal/opt/jboss-5.1.0.GA"; ./run.sh null
pascal 23107 91.4 30.3 1116240 624824 pts/3 Sl 23:02 3:19 /usr/lib/jvm/java-6-sun/bin/java -Dprogram.name=run.sh -server -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/home/pascal/opt/jboss-5.1.0.GA/lib/endorsed -classpath /home/pascal/opt/jboss-5.1.0.GA/bin/run.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar org.jboss.Main null
pascal 23298 0.0 0.0 3324 916 pts/3 S+ 23:06 0:00 grep -i jboss
JBoss has been started, as expected.
Update: Here is the configuration I used (quick and dirty, for testing purposes):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<jbossHome>/home/pascal/opt/jboss-5.1.0.GA</jbossHome>
<serverName>default</serverName>
<fileName>target/my-project.war</fileName>
</configuration>
</plugin>
I started jboss-5.1.0.GA server with maven2, is there a possibility that I can see what is happening in the console. I'm using eclipse plugin to run maven. Is it possible to see console in eclipse or elsewhere?
Here is what I mean by console :
Is it possible to see this output somewhere? I took this screen shot when manually running jboss.
When I start the server with maven here is what I get :
[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[snrf] in [C:\HOME\c0mrade\Workspaces\Eclipse 3.5 Classic\snrf\target\0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Webapp assembled in[337 msecs]
[INFO] Building war: C:\HOME\c0mrade\Workspaces\Eclipse 3.5 Classic\snrf\target\0.0.1-SNAPSHOT.war
[INFO] [jboss:hard-deploy]
[INFO] Copying C:\HOME\c0mrade\Workspaces\Eclipse 3.5 Classic\snrf\target\0.0.1-SNAPSHOT.war to C:\jboss-5.1.0.GA\server\default\deploy\0.0.1-SNAPSHOT.war
[INFO] [jboss:start]
[INFO] Starting JBoss...
[INFO] [install:install]
[INFO] Installing C:\HOME\c0mrade\Workspaces\Eclipse 3.5 Classic\snrf\target\0.0.1-SNAPSHOT.war to C:\HOME\c0mrade\.m2\repository\org\trialofmaven\0.0.1-SNAPSHOT\0.0.1-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
And that is it. nothing is happening..
Thank you
Is it possible to see this output somewhere? I took this screen shot when manually running jboss.
I'm don't think that the jboss-maven-plugin redirects the logs anywhere so you'll find them in
$JBOSS_HOME/server/<your_server>/log
Just in case, note that cargo has support for this (here, I'm getting the console output in cargo.log):
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>jboss5x</containerId>
<home>${jboss.home}</home>
<append>false</append>
<log>${basedir}/target/jboss5.x.logs/cargo.log</log>
<timeout>300000</timeout> <!-- 5 minutes -->
</container>
<configuration>
<type>existing</type>
<home>${jboss.home}/server/default</home>
<properties>
<cargo.jboss.configuration>default</cargo.jboss.configuration>
<cargo.rmi.port>1099</cargo.rmi.port>
<cargo.logging>high</cargo.logging>
</properties>
</configuration>
<wait>false</wait>
</configuration>
...
</plugin>
P.S.: I really wonder why you don't start JBoss with the WTP from Eclipse by the way.
I am trying to deploy and run my webapplication using maven and its tomcat plugin.
I have set it up in project's pom.xml, but when I'm calling it from command line:
mvn tomcat:run
all that I get is:
[root#ovz6022 trunk]# mvn -e tomcat:run
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.gotbrains.breeze:breeze:jar:1.0
[INFO] task-segment: [tomcat:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing tomcat:run
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/trunk/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [tomcat:run {execution: default-cli}]
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Thu Jul 23 14:34:31 MDT 2009
[INFO] Final Memory: 7M/14M
[INFO] ------------------------------------------------------------------------
And that's all. Tomcat hasn't been launched but I don't see any errors here.
Does anybody knows what's happening?
As mentioned before, you should use war packaging. However, if you can't because you're using OSGI or some other reason, you can tell the Tomcat plugin to deploy anyway even if it isn't war packaging by using the ignorePackaging option:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<ignorePackaging>true</ignorePackaging>
The clue is in the line:
[INFO] Skipping non-war project
The tomcat:run goal is intended to work with war projects, I'm guessing yours is a jar project.
You need to change the packaging of your project to war, you may also need to provide some additional configuration for the war to actually do anything.
Note: I'd recommend having a separate war project to your jar projects, then adding the jars as dependencies to the war.
if you're using Roo, and haven't yet invoked the controller command then your configuration is not yet set to generate a WAR file.