This document lists all known problems and bugs of the J2EE Server API. It will serve as a starting point for the future API fixes and possible redesigns.
J2eeModuleProvider does much more than what it should. The original purpose of J2eeModuleProvider is to provide J2eeModules. At the moment it provides also configuration support, verifier support, etc. This class became kind of messy and therefore we should try to clean it up.
One big issue is that J2eeModuleProvider makes the InstanceProperties public. I don't think this should be ever be public. As a side effect any code can modify the server properties and broke the server registry. Another issue is that code using the InstanceProperties usually depends on specific properties (acessed by name) that are not guaranteed to exist for the serverplugin.
TODO: elaborate it a bit more
It would be nice if this were de-coupled from the project such that a standalone deploy task could be developed. (Please refer to the attachment to issue 62228 for an example). A standalone deploy has the following advantages:
That said, even with this change, there's no reason the nbdeploy task couldn't behave as it does today. That is, the nbdeploy task could still fetch the J2eeModuleProvider from the project and pass it to Deploy. The difference would be that from Deploy on down, it would use the J2eeModuleProvider instance passed to it rather than fetching it from the project.
I can probably think of more use-cases for these to be public, but the particular problem I had to solve was that of automatically undeploying and shutting down the server. Whenever the user does a "Clean Project" the war needs to be undeployed or they get a bunch of "Unable to delete..." error messages. In addition, when performing a deploy/redeploy you will eventually run out of memory and need to restart the server. It is simply too easy for a class loaded in a parent class loader to hold onto a reference to a class in your war and so memory leaks on redeploy are nearly unavoidable.
I've solved both these problems by writing a ShutdownServer ant task that undeploys all wars on the given server and shuts down the server. This is called at the start of every build. Shutting down and restarting Tomcat takes no more than a second and is definitely worth it from the standpoint of the user.
In order to implement ShutdownServer, I had to hack the thread-local class loader and use reflection to invoke the APIs I needed. It would be nice if these were public.
Every serverplugin must solve ui presentation of server logs. Even without the ui process streams has to be consumed otherwise deadlock threatens. Almost every serverplugin solves it either custom way or by code copy pasting. Experience shows that almost every such implementation contains a bug or deadlock possibility. The new support api should solve this in unified way.
description of the issue