File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to change jetty binding port number in maven.

 
sam White
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have built a web service application based on CXF2 and Spring 3.0.5, Jetty plugin.
During the deployment process, JBOSS AS7 (WEB) thrown the following exception:



I tried to setup jetty plugin in my pom.xml file to bind to port 8080, but I couldn't find the right way to do that.

Here is my pom.xml file:



web.xml:



I have searched google for the whole day but still unable to find the correct answer to resolve my question. I believe this is something to do with the xml configuraiton code in my pom.xml or web.xml.

Any suggestion and example would be very appreciated.

Thanks
Sam
 
N Sahni
Ranch Hand
Posts: 55
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can pass the port number through command parameters like:

 
sam White
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
N Sahni wrote:Hi,

You can pass the port number through command parameters like:



Thank you for the suggestion. with the following command:



I got this error

 
N Sahni
Ranch Hand
Posts: 55
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ohh!! my mistake i published incorrect command. jetty.port is passed to JVM as system parameters. Below is the correct command.
 
sam White
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for the prompt response, your command works, but it got a problem finding the correct path to web.xml file.

Here is the error:




Command:


mvn -Djetty.port=8080 jetty:run clean install


Thanks
Sam
 
N Sahni
Ranch Hand
Posts: 55
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is a configuration issue.
At line 200 in your pom.xml you need to specify correct path of your web.xml
 
sam White
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still getting the error:

Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 80: Cannot assign requested address: bind

Would the command "-Djetty.port=8080 jetty:run" change the jetty start up port number when the WAR file deployed to JBOSS AS7 server?

My development machine has no any application server running.
I only want to package it into a war file and scp into my remote server, and then deploy it in the JBOSS AS7.

How can I tell maven to setup jetty bind to port 8080 instead 80?

Thanks
Sam
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic