Maven embedded Tomcat version - java

Is there a way to control the Maven embedded Tomcat version?
mvn tomcat:run
This command will run a Tomcat 6.0.16 instance. I'd like to run a 5.5 version of Tomcat. Is there a way to configure this? Searching the plugin docs didn't help...
Thanks!

No, there is no real way to configure the Tomcat version with the tomcat-maven-plugin. Actually, Tomcat 6 support is due to MOJO-1106 and was added in the version 1.0-alpha-2 of the plugin (see revision r7348), in previous versions and revisions, the plugin was using Tomcat 5.5.15. The version 1.0-alpha-1 is available in the repo so you could give it a try. But I didn't check and can't say if it could be impacted by any major issue.
If this option doesn't work and if you really want finer control, then it would be better to use Cargo as pointed out by romaintaz.

Maybe it would be easier for you to use the Cargo plugin. You will then be able to change the Tomcat you want to run.

These answers appear out of date. You can control the version.
http://mojo.codehaus.org/tomcat-maven-plugin/examples/adjust-embedded-tomcat-version.html

Related

How to recompile old Spring 2.5 application?

We have in use an old application running on Spring 2.5 and Jboss 4.2.3 which hasn't been modified for years. It will be replaced with a new application, developed in our current stack, in a foreseable future. Until then, we need to provide very basic maintenance and updates.
I have succeded to setup a working development environment with newer JRE and MySQL versions. Now I need to test that we are able to modify the original source and recompile it the WAR package for deployment.
I would appreciate information on the following topics:
Which JDK version should I use? Can I use Java 7 or do I need a 1.6 version?
Where can I find build scripts or samples? (there's nothing such as build.xml in the project).
Any other tip that would be helpful.
Thanks in advance.

FakeHttpServer breaks when upgrading to Jetty 9

I am migrating an application that used Jetty 7.4.5.v20110725 to Jetty 9.3.0.M2, using Maven. I already had upgraded the javax.servlet-api to 3.1.0.
But I am using the FakeHttpServer version 0.3.0 for tests, and at this time there is no newer version. It uses the org.eclipse.jetty.server.nio.SelectChannelConnector class that used to exist up to Jetty 8.x, but does not exists anymore in Jetty 9.
Currently my projects breaks at runtime with a NoClassDefFoundError due to the removed class in Jetty that FakeHttpServer tries to use, holding me back from upgrading Jetty. What can I do to fix that?
Note, this was also cross-posted in the Portuguese StackOverflow version: https://pt.stackoverflow.com/q/64548/132
Upgrade the code that uses Jetty on FakeHttpServer for Jetty 9.
That is your only choice if you want to use Jetty 9 with FakeHttpServer.
Looking at the project page for FakeHttpServer, it seems that there have been no updates (commits) to the project tree since Dec 2012.
You'll either have to convince the project leads to update it, or do it yourself.
Note that Jetty contains several ways of testing webapps. Look at the unit tests in the jetty source code and I'm sure you will find the equivalent of FakeHttpServer.
ServletTester comes to mind as one example. Or just create a Server using the LocalConnector is another way.

How to install jetty with eclipse on Mac

I am a newbie w.r.t. jetty and RESTful API's.
I want to create REST services using Jetty and wants to use embedded jetty with eclipse.
Can anyone suggest me any HowTo for installing Jetty/ Jetty plugins with Eclipse in Mac OS.
Regards,
If you're looking for an Eclipse plugin that will allow you to start your web app in Jetty via the Debug/Run menus, you may want to take a look at the run-jetty-run plugin.
If you happen to be using Maven, there's a Maven plugin you can use to start your app in Jetty as well. This can be configured to run via a launcher in Eclipse or can be launched via the command line.
Edit - Added more info about the jetty-maven-plugin:
If you're just talking about local development, then you don't have to download Jetty separately for use with the Maven plugin. The Maven plugin handles the download of the dependencies that you need by simply running mvn jetty:run. This will start your web app in Jetty (by default) at http://localhost:8080. If you use this, then there's really no need for the Eclipse plugin, either. As far as versions go, these are the available versions. I'd recommend sticking with a fairly recent version unless you have a need to use an older version of Jetty (it looks like the most recent version is a release candidate--8.0.0.RC0).
There's also an example of usage in a project on Github that I just found, but you may want to update the plugin version used.

Configure sysdeo tomcat plugin in eclipse

I have created a dynamic web application in eclipse helios i have install sysdeo tomcat plugin how to run my application using sysdeo plugin what are the setting needed please help me
BalusC: Just a note about why you might want to use Sysdeo. To the best of my knowledge, Sysdeo is still the only free way to hot-swap Java classes (not just JSPs) while using Tomcat inside Eclipse. There is JRebel and myEclipse, but neither of these are free.
I would try the steps listed in the article: Setting up the Sysdeo Tomcat Plug-in. They worked for me when I was figuring out how to configure things.

does sysdeo tomcat plugin for eclipse add value to helios?

am developing a simple web app using jsps and servlets for tomcat 5.5.
Currently using the Eclipse Helios and Dynamic Web Application Project.
For some reason it is a nightmare. We spent 4 hours today trying to deploy a servlet to tomcat. We kept getting errors like
"java.lang.UnsupportedClassVersionError: Bad version number in .class file"
we played around with everything trying to set the build compatibility to what tomcat had but couldn't make the stupid thing work. (Yes it is possible we're incompetent. any suggestions on what we can try looking at are apprecieated)
My friend recalls from long time ago that he used this plugin
eclipsetotale_tomcatPlugin
in order to create a "tomcat project". My question is, does sysdeo tomcat plugin add any features that aren't already available in helios?
thanks
Not sure about sysdeo, but your error seems similar to bug 116713:
If your default JRE is set to 1.4.2 and you have a Web project targetting
Tomcat 5.5 (dynamic Web module version 2.4 and Java 5.0), when you tried to run
a main program, you'll get the error (you mention).
What is your default JRE set for your project?
This scenario happens when the JVM running the code is older than the one the compiler generated code for.
Have you considered simply running Tomcat under Java 6? If that is not an option, please edit your question to include this and any other restrictions on this project.
We used to get that error often when we had Java version issues. Eclipse environment and Windows environment (java_home and path variables typically) are easy to overlook.
Also, you can use javap -v Foo in same directory as Foo.class to find out its version.
Just use the Eclipse IDE for Java EE Developers, 206 MB edition of Eclipse. It has Tomcat and other webserver support built-in by default. Works like a charm!
Sysdeo is an old, as far as I know obsolete, plugin.

Categories