Public stuff

Here you find some stuff resulting from my work as lecturer at the University of Applied Sciences Wiesbaden / Germany which might be interesting not only for my students but also for the rest of the world.
Feel free to use them in any way you want. I don't include any license, just do everything you ever wanted to do a piece of data. If you feel the need to do so you can even claim it be your own work ;-).

image without any importance



WTP 3.0: JBoss JSR88 and exploded deployment / Server definition for JBoss 5.1, 6.0, 6.1 and 7.1

This plugin consist of a few enhancements to the Eclipse integrated JBoss server definitions.

Features for JBoss 4.2 to 7.1: JSR88 deployment

This server definition performs deployment according to the JSR88 specification (plugins for JBoss 4.2, 5.0, 5.1, 6.0, 6.1 and 7.1): http://jcp.org/en/jsr/detail?id=88. This should allow even remote deployment (a local JBoss installation is still required so that Eclipse finds the required JavaEE libraries, but by setting the "server address" config parameter, one should be able to do remote deployment).

Note that JBoss 7.0 does not seem to support JSR88 deployment.


Server definition for JBoss 7.1 in "standalone" mode:

The plugin contains a server definition for JBoss 7.1 STANDALONE.

Note that this server definition does not work in DOMAIN mode.
Also note that it will not work for JBoss 7.0: it complains about an argument "-mbeanserverbuildermodule", so removing it from the server runtime arguments might help, but I never tested whether there are further issues.
It might even fail on Beta versions of 7.1.0, because they played with command line arguments quite a lot ;-).

Deployment can be done by file copying ("hot deployment") or by using JSR88. When performing hot deployment, the plugins performs those steps: No marker files are created, which would be necessary in domain mode (e.g. ".dodeploy" to trigger a deployment).

On undeployment, the steps are those:
Why no deployment using CLI? Well, I liked the idea of a file based deployment - you see what is deployed by looking in the "deployments" directory ;-). But it should be no problem to apply CLI deployment, too.

Limitations: starting an Application Client module is not possible (at least on windows), because the list of included JAR files exceeds the maximum command line length. If you need to run an application client, either use "JBoss Tools" (they just include a reduced list of JBoss jars in the build path), or modify the run configuration of your project (remove the "Server library" from the "Classpath" tab and add only the necessary jars).



Features for JBoss 5.1 to 6.1: Exploded deployment

The plugin contains server definitions for JBoss 5.1 to 6.1, which perform exploded deployment of Enterprise Application Projects (recursively explodes the modules), EJB Projects or Dynamic Web Projects.
The plugin does some tricky stuff for EAR deployment, because here the WTP created archives for module projects are unpackaged again before deployment.
I don't know whether this exploded deployment is helpful, because there is no incremental deployment, the full project is deployed each time. As the old app has to be deleted before copying the new stuff, it will probably be slower than the WTP default deployment.

This part of the plugin uses software of the "ant-contrib" project: http://ant-contrib.sourceforge.net/ and http://sourceforge.net/projects/ant-contrib/.

Enhancements for JBoss 4.2 to 6.1

Compared to the WTP integrated JBoss server definition plugin, there are a few useful enhancements:
  1. Endorsed dirs (see http://docs.oracle.com/javase/6/docs/technotes/guides/standards/index.html): for all server definitions up to JBoss 6.1 (JBoss 7 does not seem to support this), "lib/endorsed" is added to Classpath. The VM argument "-Djava.endorsed.dirs="${serverRootDirectory}/lib/endorsed", which is missing in the WTP 5.0 definition, is also added (this does of course NOT modify the WTP server definitions). Follow this bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=250643 for the core libraries.

  2. For JBoss 5.1, 6.0 and 6.1, there are five differences to the WTP default server definition for 5.0:

  3. Shutting down servers with non-default port configuration:

    JBoss up to 6.0.0M2:
    If the JNDI port of the server is changed, shutdown will fail. See http://www.eclipse.org/forums/index.php?t=msg&goto=489439 for discussion and solution for this issue (not that "-S" changed to "-s ...". Case matters...).
    All my server definitions contain this modified shutdown ant task:
    	<stop>
    		<mainClass>org.jboss.Shutdown</mainClass>
    		<workingDirectory>${serverRootDirectory}/bin</workingDirectory>
    		<programArguments>-s jnp://${serverAddress}:${jndiPort}</programArguments>
    		<vmParameters>-Djboss.boot.loader.name=shutdown.bat</vmParameters>
    		<classpathReference>jboss.shutdown</classpathReference>
    	</stop>  

    JBoss 6.0.0M3 to 6.1:
    In this version shutting down the server was changed: it is no longer a JNDI call at port 1099, but a RMI/JMX call at port 1090, and the URL is "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi". Thus, a new config parameter "RMI/JMX port" with default = 1090 was added. The ant task now looks like this:
    	<stop>
    		<mainClass>org.jboss.Shutdown</mainClass>
    		<workingDirectory>${serverRootDirectory}/bin</workingDirectory>
    		<programArguments>-s service:jmx:rmi:///jndi/rmi://${serverAddress}:${jmxRmiPort}/jmxrmi</programArguments>
    		<vmParameters>-Djboss.boot.loader.name=shutdown.bat</vmParameters>
    		<classpathReference>jboss.shutdown</classpathReference>
    	</stop>
    See https://community.jboss.org/thread/152911 for some more links.
The plugin is tested with WTP 2.0 and newer and JBoss version 4.2, 5.0, 5.1, 6.0, 6.1 and 7.1.

Requirements

The plugin requires Java 1.5 and Eclipse 3.3/WTP2.0 or newer.


Installation


Installation for the Eclipse 3.6 plugin
Add this update site: http://www.cs.hs-rm.de/~knauf/public/eclipse/ and install the software "JBoss Generic server definitions (enhanced)". You are done already, and you will receive updates if there is one.

You might also browse the plugin site and download the plugin jar named "org.eclipse.jst.server.generic.jboss.jsr88ant171_...jar". Then unzip (this one is important!) it to "eclipse\plugins" directory. It should be placed in a directory "org.eclipse.jst.server.generic.jboss.jsr88ant171_..." (same name as the JAR).

Installation for the Eclipse 3.5 plugin
Difference to the Eclipse 3.6 plugin: no JavaEE6 project facets, no JBoss 6.1 server runtime.

Download the zip file org.eclipse.jst.server.generic.jboss.jsr88ant171_1.1.0.201006102304.zip, unzip it to your eclipse installation directory (the zip file contains the subdirectory "plugins\org.eclipse.jst.server.generic.jboss.jsr88ant171_1.1.0.201006102304\..."), and start Eclipse once with option "eclipse.exe -clean" to load the new plugin.

Installation for the Eclipse 3.3/3.4 plugin
Difference to the Eclipse 3.5 plugin: internal differences, because Eclipse 3.5 was updated to use Ant 1.7.1, and this made internals easier. Ant 1.7.1 brings the new feature of declaring classpath directories as optional. As JBoss 5.0GA introduced "common/lib", which is not present in previous 5.0 versions, I need two different buildfiles for Ant 1.7.0 to declare the correct the classpath directories for JBoss 4.x and 5.x versions. For Ant 1.7.1/Eclipse 3.5, I can declare the "common/lib" directory as "optional", so I didn't need separate buildfiles.
Also, this plugin version does not contain exploded deployment (I was too lazy to add it to the 3.4/3.4 plugin ;-)).

Download the zip file org.eclipse.jst.server.generic.jboss.jsr88ant170_1.0.2.v20090711.zip, unzip it to your eclipse installation directory (the zip file contains the subdirectory "plugins\org.eclipse.jst.server.generic.jboss.jsr88ant170_1.0.2.v2009..."), and start Eclipse once with option "eclipse.exe -clean" to load the new plugin.

This plugin version will not work with the 5.0 betas and community releases (JBoss 5.0 CR2 and before), because the classpath changed. It will only run with 5.0GA and newer.

Usage

After installing the plugin, you will find many new server runtimes. Unfortunately, I need a new runtime for each deployment process.

One important note for JBoss 4.2 to JBoss 6.1: If using JSR88 deployment, you have to perform a redeploy after each restart of JBoss! JSR88 deployed apps are unfortunately only available until the next server restart. This was a limitation of JBoss, which was fixed in 7.x.


Internals

JSR88
All my JSR88 findings are documented in the JBoss wiki: https://community.jboss.org/wiki/JSR88Client.

Logging:
The JBoss classes might create some Log4J output, so a "log4j.xml" is contained in the zip. My "log4j.xml" switches off all output, because undeploy always results in an ERROR output (the deployer tries do delete the local file on undeploy, though it was already deleted on deploy).
But on rare occasions, it might happen that the plugin prints an error "Deployment failed. See server log", but there is no message in the server log. In this case, an internal error in the JSR88 client might have happened. So, open "buildfiles\log4j.xml" and set the log level to "TRACE" instead of its current value "OFF":
   <category name="org.jboss">
      <priority value="TRACE"/>
   </category>
The logging output is directed to the console output of the build task.

Optimizing WTP
WTP performs an asynchronous publishing, which means that publishing is started before server startup is done (really a problem if the publishing code communicates with the server). You could switch this off in the Preferences ("Server" -> "Launching" -> uncheck "Automatically publish when starting servers").
The better solution is to tell WTP to publish after full startup. In file "plugin.xml", I located the "serverTypes" extension point and added the bold line (startBeforePublish="true") for the JBoss version to change:
	<extension point="org.eclipse.wst.server.core.serverTypes">
	     ...
	     <serverType
	           runtime="true"
	           class="org.eclipse.jst.server.generic.core.internal.GenericServer"
	           id="org.eclipse.jst.server.generic.jboss5"
	           ...
	           hasConfiguration="false"
	           startBeforePublish="true"
	           launchModes="run,debug,profile">        
	     </serverType>
	</extension>



If you are interested in my work the entry point for your search would be here: http://www.cs.hs-rm.de/~knauf/index.html (all pages are in German).

Last Modified 2012-02-15
History:
2006-01-01: Created this page.
2006-01-03: Link to bug, more credits, ie zip file problem.
2006-01-04: "about.html" in plugins had invalid link.
2006-01-08: Added "%JBOSS_HOME%\server\default\lib\javax.servlet.jsp.jar" to the classpath declared by the plugin.
2006-01-15: Linux version of the plugin also needed for MacOS.
2006-01-31: comments about the integrated plugin in 1.0.1.
2006-08-27: Added the JBoss-EJB3 plugin.
2006-08-28: Added "<?xml version="1.0" encoding="UTF-8"?>" to all deployment descriptor header.
Updated plugin: from "org.eclipse.jst.server.jboss.ejb3_1.5.0.v200608271730.jar" to "org.eclipse.jst.server.jboss.ejb3_1.5.0.v200608282050.jar"
Remove a invalid "jboss40.serverdef" from the plugin. Added two new JAR references: "ejb3-persistence.jar" (for persistence annotations) and "hibernate-client.jar" (so that an application client sees hibernate exceptions, otherwise the stack trace would contain only an error message about a not found exception class)
2006-09-22: Some changes to the plugin because EJB3 RC9 has different client jars. Updated "org.eclipse.jst.server.jboss.ejb3_1.5.0.v200608282050.jar" to "org.eclipse.jst.server.jboss.ejb3_1.5.0.v200609222200.jar"
2006-10-11: Added "jboss-annotations-ejb3.jar" to the plugin (needed for JBoss specific annotations like "@SecurityDomain"). Updated "org.eclipse.jst.server.jboss.ejb3_1.5.0.v200609222200.jar" to "org.eclipse.jst.server.jboss.ejb3_1.5.0.v200610112000.jar"
2007-03-03: Added a modified plugin for WTP 2.0
2007-03-10: Added support for JBoss 4.2.0
2007-04-09: Added JBoss 5.0 to the server definitions.
Some cleanup in Stateless.ear sample (application client Manifest was invalid, eclipse warnings).
2007-05-17: replaced "/client/hibernate-client.jar" with "/server/default/lib/hibernate3.jar", "/server/default/lib/hibernate-annotations.jar" and "/server/default/lib/hibernate-entitymanager.jar" to allow full Hibernate Access
2007-05-19: Removed "hibernate-entitymanager.jar", added "commons-logging.jar" and "javassist.jar" (only for 4.2 and 5.0 server).
2007-06-05: Added "antlr.jar" for JBoss 4.2 and JBoss 5.0
2007-10-01: Removed the WTP 2.0 JBoss plugin because it is included in WTP 2.0 now. Instead, added a modified JBoss deployer which waits for successfull deployment.
2007-10-30: Removed three Javadoc warnings in the WTP 2.0 JBoss deployer
2007-11-09: Fixed a linux problem with deployment to a JBoss on a symlink
2008-02-02: "...-service.xml" files in EJB jars caused exception in deployer (resolution: lib/endorsed/xercesImpl.jar must be on the classpath).
2008-08-04: JSR88 deployer
2008-10-03: Configuring WTP to perform publishing after startup
2008-10-06: JSR88 deployer: errors on "Start" action are reported, no more StackTraces.
2008-11-07: Update link to changed JBoss wiki entry.
2008-12-17: JSR88 deployer: added "log4j.xml", fixed some javadoc warnings.
2008-12-22: JSR 88 deloyer: changed classpath to JBoss jars (previous plugin could not deserialize deployment exception because of JBoss 5 changes).
2009-04-10: replaced the JSR88 deployer with a full plugin for Eclipse 3.3/3.4/3.5. This plugin also supports JBoss 5.1Beta1
2009-05-11: Plugin for JBoss 5.1.0CR1 adds the VM argument "-Dxb.builder.useUnorderedSequence=true"
2009-05-24: Link to the JBoss 5.1.0 bug which automatically adds this VM argument
2009-07-11: Updated plugin:
-added lib/endorsed to Classpath
-added VM Argument -Djava.endorsed.dirs="${serverRootDirectory}/lib/endorsed" to JBoss 5.0/5.1 server definitions (4.2 already contained it)
-Start timeout of JBoss 5.1 is 180 seconds now (instead of 50)
2010-01-20: Updated plugin (only Eclipse 3.5 version):
-exploded deployment for JBoss 5.1/6.0
-server shutdown works also with different JNDI port
-now with update site
2010-02-21: Updated plugin (only Eclipse 3.5 version):
-last update introduced invalid resource strings for JBoss 5.1/6.0 (no slash allowed). This broke the classpath of projects.
2010-06-10: Updated plugin (only Eclipse 3.5 version): support for shutting down JBoss 6.0M3
2010-09-03: Updated plugin: update site has a 3.6 version now, which supports JavaEE6 project facets for JBoss 6.0.
2010-10-13: Updated plugin: error with JSR-88 deployment on JBoss 6.0M5, because Log4J wrapper had changed. Removed duplicate items in plugin jar.
2011-04-24: Updated plugin: project facet "application client 6.0" was missing for JBoss 6.0 server runtimes. This resulted in error messages when importing an JavaEE6 app.
2011-06-03: Updated plugin: server runtime for JBoss 6.1.0.Snapshot
2012-01-30: Updated plugin: JBoss 7.1 support. Removed all my older work, only the current plugin is left.
2012-02-15: Updated plugin: cleanup and bugfixing in JBoss 7.1 server definition (renamed from "7.0" to "7.1" - not backwards compatible)