Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
122 views
in Technique[技术] by (71.8m points)

java - Deployment via tomcat7-maven-plugin keeps adding "/deploy?path" to the target path

I'm trying to deploy a new version of my app to the path /app-test using the ## notation.

I've set the warFileName in pom.xml to be app-test##2021-01-21-pkix-fix and then called

mvn clean tomcat7:deploy

which generates and builds a .war successfully:

...
[INFO] Generating war /xyz/target/app-test##2021-01-21-pkix-fix.war
[INFO] Building war: /xyz/target/app-test##2021-01-21-pkix-fix.war

As it proceeds to upload the resources, it tries to do so multiple times while adding /deploy?path for the 2nd time. The third attempt makes even less sense:

[INFO] Deploying war to http://mydomain.eu/app-test##2021-01-21-pkix-fix
  
Uploading: http://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploaded: http://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix 

Uploading: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploaded: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix

Uploading: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploaded: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix

The deployment then fails:

FAIL - Failed to deploy application at context path /app-test##2021-01-21-pkix-fix/deploy?path=/app-test##2021-01-21-pkix-fix

because paths must not contain the = char which is confirmed by the catalina-daemon.out error log:

...
javax.management.MalformedObjectNameException: Invalid character '=' in value part of property
    at javax.management.ObjectName.construct(ObjectName.java:618)
    at javax.management.ObjectName.<init>(ObjectName.java:1382)
...

Here's my condensed pom.xml.

I suspect this has to do with my relatively recent mvn upgrade through homebrew. Here's my current version:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 1.8.0_112, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

Why does tomcat keep adding /deploy?path to my deployments?


As I'm investigating further, it's likely it's related to the tomcat7-maven-plugin but the docs haven't really clarified anything.

question from:https://stackoverflow.com/questions/65829690/deployment-via-tomcat7-maven-plugin-keeps-adding-deploypath-to-the-target-pa

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When all else fails, there's always the option to deploy the .war manually.

Package the program first:

mvn clean package [-P profile_name]

and then locate the .war in /target:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...