April 2017
« Sep    
Your widget title

Posts Tagged ‘JOnAS’

PostHeaderIcon Hot Redeploy EJBs on JOnAS


I ogten have to redeploy my JEE application on JOnAS. Basically, I stopped the server, copied the files (EAR, JAR, etc.), then started up again the server. I was fed up with implementing this method.
How to speed up?


Below is a proposal of solution, without any pretention (I am not fond of JOnAS…), based on an Ant script running under Maven. The code is commented, in a summary: build the EAR (or JAR, WAR, etc.), then copy it to JOnAS deploy folder, undeploy the beans, check which beans are still deployed, deploy the new version of the beans, check which beans are deployed:

                                <property name="jonas.root" value="${env.JONAS_ROOT}"/>
                                <property name="jonas.base" value="${env.JONAS_BASE}"/>
                                <echo>Copy files</echo>
                                <copy todir="${jonas.base}/deploy" overwrite="true">
                                    <fileset dir="${}/">
                                        <include name="*.*ar"/>
                                <echo>Undeploy beans</echo>
                                <exec executable="${jonas.root}/bin/jonas.bat">
                                    <arg line="admin -r ${jonas.base}/deploy/${artifactId}-${version}.${packaging}"/>
                                <echo>Currently deployed beans:</echo>
                                <exec executable="${jonas.root}/bin/jonas.bat">
                                    <arg line="admin -j"/>
                                <echo>Deploy beans:</echo>
                                <exec executable="${jonas.root}/bin/jonas.bat">
                                    <arg line="admin -a ${jonas.base}/deploy/${artifactId}-${version}.${packaging}"/>
                                <echo>Currently deployed beans:</echo>
                                <exec executable="${jonas.root}/bin/jonas.bat">
                                    <arg line="admin -j"/>

At first glance I assume I should swap the phases of copying file and undeploying beans. Anyway, this scripts works for me and allows to redeploy after each mvn clean install 😉

PostHeaderIcon (long tweet) JOnAS / GenIC / Method … of interface … should NOT throw RemoteException


On generating Locals and Remotes of EJBs (let’s say JonathanBean) to be deployed on JOnAS, the GenIC raises:

GenIC.fatalError : GenIC fatal error: Cannot read the Deployment Descriptors from /foo/goo/jonathan-server.jar: Method foo of interface lalou.jonathan.JonathanLocal should NOT throw RemoteException

Within the EJB2, the method foo is declared to be Local and to throw RemoteException


The error is explicit.

A Local EJB cannot throw RemoteException.
Especially, the considered method can be declared with the right XDocLet tag, ie:

* @ejb.interface-method view-type="remote"

but can with neither:

* @ejb.interface-method view-type="both"


* @ejb.interface-method view-type="local"

As a quickfix, I suggest to surround with a try/catch block a throw a RuntimeException if needed.

PostHeaderIcon (long tweet) JOnAS / no security manager: RMI class loader disabled

On server side:

an EJB2 packaged in a JAR within an EAR, deployed on JOnAS 5.

On client side:

java.lang.ClassNotFoundException: (no security manager: RMI class loader disabled)]


This means there is some kind of issue with generated Stubs on client side. Should check whether the Stubs depended on are available in classpath.

PostHeaderIcon Problems when invoking main method from GenIC … error in fastrmic


Trying to deploy an EAR on JOnAS, I got the following error:

Problems when invoking main method from GenIC: java.lang.RuntimeException: error in fastrmic (null)

More detail:

JOnASEJBService.__checkGenIC : Cannot apply GenIC on the file 'C:\jonathan\jonathan_2012.05.11-13.47.29.ear\jonathan-server.jar' with the args '[-classpath, C:\jonathan\jonathan_2012.05.11-13.47.29.ear\jonathan-server.jar, -protocols, jrmp, -invokecmd]'.
org.ow2.jonas.service.ServiceException : Problems when invoking main method from GenIC: java.lang.RuntimeException: error in fastrmic (null)
        at org.ow2.jonas.generators.genic.wrapper.GenicServiceWrapper.callGenic(
        at org.ow2.jonas.ejb2.internal.JOnASEJBService.__callGenic(


Edit $JONAS_BASE/conf/
The properties and must be consistent.

Especially, if GenIC is enabled ( true), then check ejb2 is among the services pointed at by, eg: jtm,db,security,resource,ejb2,web,ear.

PostHeaderIcon Configure JProfiler 5 to work with JOnAS 5

JOnAS 4 (and older) and JProfiler 4 (and older) were used to working smoothly. JOnAS 5 makes a large use of OSGi libraries… which may “blind” JProfiler.

Here is a workaround, slightly different from former version, to bypass this issue, in order to make JProfiler 5 work with JOnAS 5:

  • let’s assume you have installed JOnAS in a folder, let’s say JONAS_ROOT
  • install JProfiler 5 with default options, set the JDK, licence key, etc., let’s say in a folder C:\win32app\jprofiler5\ also known as JPROFILER_HOME.
  • edit %JONAS_ROOT%/bin/setEnv.bat:
    • set: JAVA_OPTS=-agentlib:jprofilerti=port=8849 "-Xbootclasspath/a:C:\win32app\jprofiler5\bin\agent.jar" %JAVA_OPTS%
  • edit %JONAS_ROOT%/conf/osgi/
    • in the property bootdelegation-packages, add the JProfiler packages:
bootdelegation-packages com.sun.corba, \
                              com.sun.corba.*, \
                              com.jprofiler, \
                              com.jprofiler.*, \
                              com.jprofiler.agent, \
  • add JPROFILER_HOME\bin\windows to your environment variable PATH.
  • startup JOnAS, you should see the following block in standard output:
JProfiler> Protocol version 25
JProfiler> Using JVMTI
JProfiler> 32-bit library
JProfiler> Listening on port: 8849.
JProfiler> Native library initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Hotspot compiler enabled
JProfiler> Starting org/ow2/jonas/commands/admin/ClientAdmin ...
  • run JProfiler, follow the wizard, take caution to set JProfiler port at 8849 (or remain consistent with the port set in JOnAS config file)