FakeHttpServer breaks when upgrading to Jetty 9 - java

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.

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.

Tomcat 8.5 hot code replace failed - delete method not implemented

I have a problem when using Tomcat 8.5 with Eclipse. If I comment a java method, I get the error below, and also if I restart the server I cannot get synchronized. The only way to get synchronized is to restart Server.
I am using:
- tomcat 8.5.x
- Eclipse mars 2
- Java 8
- Tomcat manager plugin for eclipse, i cannot add tomcat server as usual because of the architecture of the project.
Any suggestion to solve de problem?
I am responding because I have found the solution.
First of all, the best practice is to created a Dynamic Web Project as suggested, but due to economic reasons (current architecture is installed and configured on a large number of servers and mantained by different prsons) we cannot change it.
The problem was in a class using a native Sun package and the use of the class JPEGImageEncoder that was deprecated after Java 6. Removing the use of that class and configuring ant to use java 7 and downgrading the jdk configured in Tomcat Manager Plugin from JDK 8 to JDK 7, after the deploy, the problem disappeared.

Build web service with jax-ws reference implemetation bundled in JDK 6

I used to saw a tutorial about this topic. But when I try to make my example application by following the example. I can't find com.sun.xml.ws.transport.http.servlet.WSServletContextListener on my classpath.
but I found com.sun.xml.internal.ws.transport.http.servlet.WSServletContextListener
It confused me, why Oracle move those classes in com.sun.xml.xxx to com.sun.xml.internal? I am using JDK1.6.0_45. I saw some people said, form JDK6U4, jax-ws reference implementation is bundled in JDK, so we should be able to publish a web service by running a light weight http server just with JDK and no other dependencies needed, is that ture? You should notice that in the tutorial I mentioned above, additional dependencies is still needed, see step 5 "JAX-WS Dependencies".
And I also found that in IBM JDK, even com.sun.xml.internal.ws.transport.http.servlet.WSServletContextListener can't be found.
Yes, JAX-WS RI (same as JAX-B RI) is shipped with JDK since Jdk6. All the packages except for javax.xml.* are changed to .internal. in order to avoid conflicts between JDK's and standalone JAX-WS versions.
Using JDK's version, you can deploy web service using just JDK; if you want deploy WS in tomcat or in some AS, you still need JAX-WS standalone version.
If you check grepcode for (non-internal) WSServletContextListener, it shows you, the class is shipped with jaxws-rt/webservice-rt jar.
By looking for the internal WSServletContextListener, you can't find a jar shipping it. (but grepcode also contains the sources of openJDK)
Also, I tried to find WSServletContextListener in my local jdk7, but can't find it. But maybe some third-party jdk ship with the class.
Anyway, if you look into the tutorial again, you will find that jaxws-rt.jar is necessery for the application. Probably you should add it?

Is It Possible To Use The IBM WebSphere JAX-WS Runtime To Generate Web Services In Eclipse 4.x?

I'm attempting to generate a JAX-WS server top down (from a WSDL) for the IBM WebSphere v7 runtime using Eclipse Kepler. The problem I'm running into is that I simply cannot select the web service runtime to be IBM WebSphere JAX-WS, there is no option for it. I've installed the WebSphere Application Server Developer Tools plugin for Kepler and configured the runtime in Eclipse to be the runtime installed on my system. I can also compile applications against the WAS 7 runtimes and deploy them to a WAS 7 server, so it would appear the runtimes are available.
The biggest thing that's frustrating me is that the option is available in Eclipse Indigo (3.x). To make sure there wasn't something awry with my work space or install in any way, I downloaded fresh copies of both versions of Eclipse, started with fresh work spaces, and installed the WAS 7 plugin on both versions from the marketplace. Eclipse 3.x gives me the option, but 4.x does not.
Now, I know these plugins are different versions. The version provided by the marketplace for Eclipse 4.x is 8.5.5011.v20131031_0202 while the version for 3.x is 8.5.1002.v20130402_2058, which based on the version number appears to be about 7 months older. This leads me to my question, is it possible to use the IBM WebSphere JAX-WS runtime to generate web services in Eclipse 4.x anymore? I've tried searching the web all I can but have found no mention of this ability being removed from the plugin. I've even found other SO posts that make it seem like this once was available for Eclipse 4.x, but maybe no longer is with the latest version of the plugin (this linked question is over a year old). Does anyone know the answer to this. Is it no longer possible to do this, or is it actually possible by some other means that that you could share please?
Apparently this is fixed now (see https://www.ibm.com/developerworks/community/forums/html/topic?id=29712397-fdfd-41be-8668-ada56447711a). The version of the plugin didn't change, but it sounds like there was an update to the plugin that fixed a bug.

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