Saturday, June 14, 2008

Eclipse Ganymede RC3 and the JBoss WTP Plugin

This post is one of a number of reviews of the upcoming Eclipse Ganymede release. It has been added to the Ganymede Around the World map. Donate and become a Friend of Eclipse!

First a little update on my Eclipse environment and Geronimo. I am running Eclipse Ganymede RC3 now, downloaded from the Friends of Eclipse mirror. I have also tried to install and run WebSphere Community Edition (based on Geronimo) in Eclipse, and that failed miserably as well...



Starting to get used to servers failing to start, this time WebSphere CE

But let's discuss running JBoss in Eclipse WTP. Adding a JBoss server is pretty straightforward and involves creating a JBoss runtime and selecting a location where JBoss is preinstalled. I still had JBoss 4.2 lying around somewhere, so that's the one I used. Once JBoss is installed, it runs out of the box.

Problems start when you change the port number in the server configuration from within Eclipse. Sometimes I have multiple servers (sometimes running at the same time), and port 8080 is already in use. So what does one do in such a case? One configures JBoss to run on a different port. Just open the server and change the HTTP port 8080 into 8090 and the RMI port 1099 into e.g. 1109, just like when configuring a Tomcat server to run on a different port. Unfortunately this does not work. You can start the server, it will start allright, but then the plugin somehow fails to see the server and kills it.



Error when the port number of the JBoss server is changed in Eclipse

This same problem appeared in the Europa release and I decided to dig into the problem some more. It seems that changing the port number in the server configuration page in Eclipse does not actually change the port number of the JBoss at all. It just tell the plugin that it should look at that port number to see if there's a JBoss running there. If I connect to localhost 8090 the connection is indeed refused, and instead JBoss is still running on port 8080. The server configuration inside the JBoss install directory still reflects port 8080 as well, so that explains a lot.

The JBoss plugin does not support having the server configuration in the Eclipse workspace (as far as I can tell). That means hacking or going about the old fashioned way of adding servers in the jboss/server directory and then selecting that configuration. I was hoping this could be done from within Eclipse without having to touch the JBoss install, but as far as I can see this can't be done.

Tomcat does support having the configuration outside the Tomcat install directory. This helps a great deal in case you had installed Tomcat using a package management system. In that case the ownership of the Tomcat install by default denies access to the files. Having the Tomcat configuration in the Eclipse workspace means you can avoid having to add yourself to some Tomcat group and manually changing the Tomcat install directory permissions to group writable.


Conclusion

This is a case where one WTP plugin behaves differently from the other. In the case of Tomcat, setting the port number in Eclipse changes the port number of the actual Tomcat server configuration (which can be held in the workspace), causing it to actually listen on the port specified in Eclipse. Setting the port number for JBoss in Eclipse does not change the actual JBoss port number. It only instructs the plugin to try to connect to JBoss using that port.

If you want to run JBoss, be aware of this. In case you only have one JBoss server that runs everything you have, you'll just want to leave it on port 8080. If you have multiple and different kinds servers, JBoss being one of them, you may want to have JBoss running on port 8080 and the others on different ports. In case this is not feasible, add configurations in the JBoss server directory and configure the correct ports there as well as in Eclipse.


No comments: