Tag: ejb3

Invoking EJBs from One JBossAS7 to another JBossAS7

Hi,

In our previous examples we have seen how to invoke an EJB which is deployed on JBoss AS7 server from a standalone java client (http://middlewaremagic.com/jboss/?p=1466). However in this example we will see how to invoke an EJB from another EJB when both the EJBs are deployed on different JBoss instances. This is different from invoking the EJBs from a remote standalone client.

In order to achieve this we will need to create an "remote-outbound-connection" on the "ClientServer" (A Server which has the CallerEJB). The "remote-outbound-connection" which will use the newly created "outbound-socket-binding" (pointing to the EJB remoting connector of the "Destination Server")

Reference Document:
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance

Points we will discuss here:

Point-1) . In JBossAS7 how to create/delete Server-Groups, JBoss Servers, Outbound-Connections and Security realm using Batch Mode of CLI.

Point-2) . We will see how to configure a Server-Identity for the JBoss to JBoss EJB communication purpose.

Point-3) . We will see how to invoke an EJB from a standalone java client.

Point-4) . We will see how One EJB deployed on the Client Server (JBossServerOne) can invoke an EJB which is deployed on the destination server (JBossServerTwo)

Point-5) . The source code of this demo along with the “domain.xml” & “host.xml” including the Example source is present in the github repository.
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/EJB_Server_to_Server

Point-6) . We will see how to make use of “$EAR/META-INF/jboss-ejb-client.xml” file. Like following:

<jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">
    <client-context>
        <ejb-receivers>
            <remoting-ejb-receiver outbound-connection-ref="OutboundEJB_ConnectionOne"/>
        </ejb-receivers>
    </client-context>
</jboss-ejb-client>
EJB_to_EJB_Call_Between_JBossAS7_Servers

EJB_to_EJB_Call_Between_JBossAS7_Servers

Creating a User which will be available in Destination Server.

Step-1) Create a User with username “ejbUserOne” and password as “ejbPasswordOne” in the client Server.

[userone@localhost bin]$ ./add-user.sh 

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Realm (ApplicationRealm) : ApplicationRealm
Username : ejbUserOne
Password : ejbPasswordOne
Re-enter Password : ejbPasswordOne
What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: ejbRole
About to add user 'ejbUserOne' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'ejbUserOne' to file '/home/userone/jboss-as-7.1.2.Final/standalone/configuration/application-users.properties'
Added user 'ejbUserOne' to file '/home/userone/jboss-as-7.1.2.Final/domain/configuration/application-users.properties'
Added user 'ejbUserOne' with roles ejbRole to file '/home/userone/jboss-as-7.1.2.Final/standalone/configuration/application-roles.properties'
Added user 'ejbUserOne' with roles ejbRole to file '/home/userone/jboss-as-7.1.2.Final/domain/configuration/application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS process e.g. slave domain controller?
yes/no? yes

To represent the user add the following to the server-identities definition <secret value="ZWpiUGFzc3dvcmRPbmU=" />

NOTE: The “ejbUserOne” which we created in destination Server “JBossServerTwo” has generated a secret value “ZWpiUGFzc3dvcmRPbmU=” which we need to add in the “host.xml” of the Client JBoss where we will deploy the CallerBean.

In our case for our simplicity we will create the same user “ejbUserOne” in the clientServer “JBossServerOne” as well sothat the Standalone client also can use the same username & password in order to invoke the CallerBean deployed on Client Server “JBossServerOne”

Step-2) Create a directory somewhere in your file system like “/home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/” and place the CLI Batch file “ConfigureResources.cli” inside the above directory which we will use oin order to configure various resources on the JBoss quickly.

NOTE: In the following script you will need to replace the value secret key value (line-43) “ZWpiUGFzc3dvcmRPbmU=” which is generated in Step-1 (if you want to create a different username)

#################################################################
# Removing all Unnecessary & Default Configurations from Server
#################################################################
batch
# Stopping all the default servers, and removing default groups & servers
/host=master/server-config=server-one:stop(blocking=true)
/host=master/server-config=server-two:stop(blocking=true)

/host=master/server-config=server-one:remove
/host=master/server-config=server-two:remove
/host=master/server-config=server-three:remove
/server-group=main-server-group:remove
/server-group=other-server-group:remove

#################################################################
# Disabling the "$local" authentication from the Configuration
#################################################################
/host=master/core-service=management/security-realm=ApplicationRealm/authentication=local:remove

#################################################################
# EJB server to server call related configuration
#################################################################
/socket-binding-group=full-sockets/remote-destination-outbound-socket-binding=OutboundEJBOne:add(host=localhost, port=4647)

# adding the outbound connections to the remoting subsystem of the full-profile
/profile=full/subsystem=remoting/remote-outbound-connection=OutboundEJB_ConnectionOne:add(outbound-socket-binding-ref=remote-ejb, security-realm=ejbRealmOne, username=ejbUserOne)
/profile=full/subsystem=remoting/remote-outbound-connection=OutboundEJB_ConnectionOne/property=SASL_POLICY_NOANONYMOUS:add(value=false)
/profile=full/subsystem=remoting/remote-outbound-connection=OutboundEJB_ConnectionOne/property=SSL_ENABLED:add(value=false)

/socket-binding-group=full-sockets/remote-destination-outbound-socket-binding=remote-ejb:add(host=localhost, port=4647)

#################################################################
# Security-Realm configuration
#################################################################
#### using    add-user.sh   create a user with name "ejbUserOne"  and password  as "ejbPasswordOne" on the Client Server
#### Press "yes" When the user creation script asks:
#### Is this new user going to be used for one AS process to connect to another AS process e.g. slave domain controller?
####  it will generate an encrypted password., Use it in the below section.

/host=master/core-service=management/security-realm=ejbRealmOne:add()
/host=master/core-service=management/security-realm=ejbRealmOne/server-identity=secret:add(value=ZWpiUGFzc3dvcmRPbmU=)

#################################################################
# Configuring New Servers & Server Groups
#################################################################
/server-group=GroupOne:add(profile=full,socket-binding-group=full-sockets)
/server-group=GroupOne/jvm=default:add(permgen-size=64m, max-permgen-size=128m)
/host=master/server-config=JBossServerOne:add(auto-start=true, group=GroupOne, socket-binding-port-offset=100)

/server-group=GroupTwo:add(profile=full,socket-binding-group=full-sockets)
/server-group=GroupTwo/jvm=default:add(permgen-size=64m, max-permgen-size=128m)
/host=master/server-config=JBossServerTwo:add(auto-start=true, group=GroupTwo, socket-binding-port-offset=200)
run-batch

Step-3) Now start your JBoss Domain controller using the “domain.sh” script.

Step-4) Open a terminal and the move inside the “$JBOSS_HOME/bin” directory from where we will execute the above CLI Batch file in order to configure various resources on our JBoss.

[userone@localhost bin]$ ./jboss-cli.sh -c --controller=localhost:9999 --file=/home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/ConfigureResources.cli

Output will be something like following:

#1 /host=master/server-config=server-one:stop(blocking=true)
#2 /host=master/server-config=server-two:stop(blocking=true)

#3 /host=master/server-config=server-one:remove
#4 /host=master/server-config=server-two:remove
#5 /host=master/server-config=server-three:remove

#6 /server-group=main-server-group:remove
#7 /server-group=other-server-group:remove

#8 /host=master/core-service=management/security-realm=ApplicationRealm/authentication=local:remove

#9 /socket-binding-group=full-sockets/remote-destination-outbound-socket-binding=OutboundEJBOne:add(host=localhost, port=4647)

#10 /profile=full/subsystem=remoting/remote-outbound-connection=OutboundEJB_ConnectionOne:add(outbound-socket-binding-ref=remote-ejb, security-realm=ejbRealmOne, username=ejbUserOne)
#11 /profile=full/subsystem=remoting/remote-outbound-connection=OutboundEJB_ConnectionOne/property=SASL_POLICY_NOANONYMOUS:add(value=false)
#12 /profile=full/subsystem=remoting/remote-outbound-connection=OutboundEJB_ConnectionOne/property=SSL_ENABLED:add(value=false)

#13 /socket-binding-group=full-sockets/remote-destination-outbound-socket-binding=remote-ejb:add(host=localhost, port=4647)

#14 /host=master/core-service=management/security-realm=ejbRealmOne:add()
#15 /host=master/core-service=management/security-realm=ejbRealmOne/server-identity=secret:add(value=ZWpiUGFzc3dvcmRPbmU=)

#16 /server-group=GroupOne:add(profile=full,socket-binding-group=full-sockets)
#17 /server-group=GroupOne/jvm=default:add(permgen-size=64m, max-permgen-size=128m)

#18 /host=master/server-config=JBossServerOne:add(auto-start=true, group=GroupOne, socket-binding-port-offset=100)
#19 /server-group=GroupTwo:add(profile=full,socket-binding-group=full-sockets)
#20 /server-group=GroupTwo/jvm=default:add(permgen-size=64m, max-permgen-size=128m)
#21 /host=master/server-config=JBossServerTwo:add(auto-start=true, group=GroupTwo, socket-binding-port-offset=200)

The batch executed successfully.

Deploying and running the code:

You can download the TestCase from the following github repository. https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/EJB_Server_to_Server

Place the “EJB_Server_to_Server” directory somewhere in your file system thich contains the following:

├── domain_Configurations
│   ├── application-roles.properties
│   ├── application-users.properties
│   ├── domain.xml
│   ├── host.xml
│   └── mgmt-users.properties

├── EJB_2_EJB_Call_Between_Servers.JPG

└── Server_To_Server_EJB3_Remote_Lookup
    ├── build
    │   ├── ejbOneEAR.ear
    │   ├── ejbTwoEAR.ear
    │   └── remoteEJBClient.jar
    ├── build.xml
    ├── ConfigureResources.cli
    └── src
        ├── client
        │   ├── CallerRemote.java
        │   ├── Client.java
        │   └── jboss-ejb-client.properties
        ├── ejbOneEAR
        │   ├── application.xml
        │   ├── CallerBean.java
        │   ├── CallerRemote.java
        │   ├── jboss-ejb-client.xml
        │   └── TestRemote.java
        └── ejbTwoEAR
            ├── application.xml
            ├── TestBean.java
            └── TestRemote.java

Code snippet of “CallerBean.java”

package ejb.one;
import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import ejb.two.TestRemote;
@Stateless
@Remote(CallerRemote.class)
public class CallerBean implements CallerRemote
 {
     public String testMethod(String name)
	    {
                   String result="";
		   System.out.println("\n\n\t[CallerBean] Bean's testMethod(String name) called....");
                   System.out.println("\n\n\t[CallerBean] Is Now calling the TestBean deployed on another JBoss Instance.");
                   try {
                         Hashtable<String,String> props = new Hashtable<String,String>();
                         props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                         /******* FOLLOWING  CODE IS NOT NEEDED  ********/
                         //props.put(Context.PROVIDER_URL, "remote://localhost:4647");
                         //props.put(Context.SECURITY_PRINCIPAL, "ejbUserOne");
                         //props.put(Context.SECURITY_CREDENTIALS, "ejbPasswordOne");

                         Context context = new javax.naming.InitialContext(props);
                         String jndiName="ejb:" + "ejbTwoEAR/remoteEjbTwo/TestBean!ejb.two.TestRemote";
                         TestRemote remote = (TestRemote) context.lookup(jndiName);

                         result = remote.helloWorld("TestMessage For TestBean: MiddlewareMagic");
                         System.out.println("[CallerBean] Received result from TestBean: " + result);
                        }
                    catch (Exception e)
                        {
                         throw new RuntimeException(e);
                        }
		   return "[CallerBean] returned Hello "+name+"\tTestBean: " + result;
	    }
 }

Now open a Terminal where we need to set the PATH like following sothat ANT is available in the path and then compile and run the program:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/org.apache.ant_1.8.0/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.8.0/bin;%PATH%

Compile the program as following:


[userone@localhost Server_To_Server_EJB3_Remote_Lookup]$ cd /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup
[userone@localhost Server_To_Server_EJB3_Remote_Lookup]$ ant
Buildfile: build.xml

build_ear_one:
    [mkdir] Created dir: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
    [javac] Compiling 3 source files to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
      [jar] Building jar: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/remoteEjbOne.jar
    [mkdir] Created dir: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/META-INF
     [copy] Copying 2 files to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/META-INF
      [jar] Building jar: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/ejbOneEAR.ear
   [delete] Deleting: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/remoteEjbOne.jar
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/build
   [delete] Deleting: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/ejbOneEAR.ear

build_ear_two:
   [delete] Deleting directory /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
    [mkdir] Created dir: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
    [javac] Compiling 2 source files to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
      [jar] Building jar: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/remoteEjbTwo.jar
    [mkdir] Created dir: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/META-INF
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/META-INF
      [jar] Building jar: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/ejbTwoEAR.ear
   [delete] Deleting: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/remoteEjbTwo.jar
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/build
   [delete] Deleting: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp/ejbTwoEAR.ear

message:
     [echo] *******************  ******************* *********************
     [echo] ********** build/ejbOneEAR.ear Build Successfully **********
     [echo] ********** build/ejbTwoEAR.ear Build Successfully **********
     [echo] Deploy the above EARs on your desired servers using CLI script or using Manaagement Console
     [echo] *******************  ******************* *********************

all:

BUILD SUCCESSFUL
Total time: 2 seconds

Deploy & Run
Now deploy the “ejbOneEAR.ear” on “JBossServerOne”
And
deploy the “ejbTwoEAR.ear” on “JBossServerTwo”
And
Then Run the program as following:

[jsenshar@localhost Server_To_Server_EJB3_Remote_Lookup]$ ant run
Buildfile: build.xml

run:
   [delete] Deleting directory /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
    [mkdir] Created dir: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
    [javac] Compiling 2 source files to /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
      [jar] Building jar: /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/build/remoteEJBClient.jar
   [delete] Deleting directory /home/userone/jboss-as-7.1.2.Final/domain/EJB_Server_to_Server/Server_To_Server_EJB3_Remote_Lookup/tmp
     [java] Sep 10, 2012 2:20:25 AM org.xnio.Xnio <clinit>
     [java] INFO: XNIO Version 3.0.3.GA
     [java] Sep 10, 2012 2:20:25 AM org.xnio.nio.NioXnio <clinit>
     [java] INFO: XNIO NIO Implementation Version 3.0.3.GA
     [java] Sep 10, 2012 2:20:25 AM org.jboss.remoting3.EndpointImpl <clinit>
     [java] INFO: JBoss Remoting version 3.2.7.GA
     [java]
     [java] 	Got initial Context: javax.naming.InitialContext@671ff436
     [java] Sep 10, 2012 2:20:26 AM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
     [java] INFO: EJBCLIENT000017: Received server version 1 and marshalling strategies [river]
     [java] Sep 10, 2012 2:20:26 AM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
     [java] INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@62ebcdbb, receiver=Remoting connection EJB receiver [connection=Remoting connection <65efb4be>,channel=jboss.ejb,nodename=master:JBossServerOne]} on channel Channel ID 9a4598f0 (outbound) of Remoting connection 5d2aea3e to localhost/127.0.0.1:4547
     [java] Sep 10, 2012 2:20:26 AM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
     [java] WARN: Unsupported message received with header 0xffffffff
     [java]
     [java] 	 remote.testMethod("MiddlewareMagic") = [CallerBean] returned Hello MiddlewareMagic	TestBean: [TestBean] returned Hello TestMessage For TestBean: MiddlewareMagic

BUILD SUCCESSFUL
Total time: 3 seconds

.
.
Thanks :)
MiddlewareMagic Team


Accessing EJB3 Remotely over SSL in JBossAS7.1.1.Final

Hi,

In our previous demos we have already seen that how to remotely access the EJBs deployed on “JBoss AS 7.1.1.Final”. So in this example we will see how to invoke an EJB in a Secured manner over SSL (Secure Socket Layer). Here we will use the “jboss-ejb3.xml” file which is a new container specific deployment descriptor for the EJBs. Also we will an alternative option of defining the security domain for our ejbs using annotation “@org.jboss.ejb3.annotation.SecurityDomain”. Additionally we will create SSL Certificates and configure the JBoss Remoting to use the SSL so that the EJB communitation between client and JBossAS7.1.1.Final will be done in Secured Manner.

In this article we are going to see an easiest way to lookup a Secured EJBs remotely in >”JBoss AS7.1.1.Final”

Point-1). We will see How to create SSL Certificates and How to add the Client’s Public certificate/key in Server’s keyStore and how to store Server’s Public Certificate/Key on Client’s Keystore (truststore). And How to configure it in JBossAS7 configuration.

Point-2). How to create a separate Security Realm for our EJBs inside “standalone-full.xml”.

Point-3). How to create a separate Security Domain for our EJBs inside “standalone-full.xml”.

Point-4). How to use the “jboss-ejb3.xml” file inside the EJB jar file in order to associate it with the security domain?

Point-5). How to use the annotation “@org.jboss.ejb3.annotation.SecurityDomain” sothat we will not need to write the addiaional deployment descriptor “jboss-ejb3.xml”

Point-6). A properties file need to be placed in the Clients CLASSPATH with name “jboss-ejb-client.properties”, with some additional properties.

The whole article will be divided into two Parts 1) the Server side configuration and 2). the Application Level Settings from the Client side.

Source Code (Git Repo) Source Code for this Demo Can be downloaded from GIT Repository:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/EJB3_Over_SSL_JBossAS711

JBossAS7 side configuration changes

Here we will first see what all changes are required from the JBoss side in order to create a separate Security Realm and Security Domain for our EJBs.

Step-1). Open a command prompt and make sure that the JDK bin directory is present in the classpath, because the “keytool” which we are going to use in order to create certificate is present in the PATH and then run the following command to create JBoss Keystore.

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;%PATH%

As the PATH is set properly so we will create the Server and clients certificate as following:

# Create Server Key Store
keytool -genkey -v -alias jbossalias -keyalg RSA -keysize 1024 -keystore jbossServer.keystore -validity 3650 -keypass JBossPassword -storepass JBossPassword -dname "CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, S=Maharashtra, C=IN"

# Exporting Server's Public Key
keytool -export -keystore jbossServer.keystore -alias jbossalias -file serverPublicKey.cer -keypass JBossPassword -storepass JBossPassword

# Create Client Key Store
keytool -genkey -v -alias clientalias -keyalg RSA -keysize 1024 -keystore jbossClient.keystore -validity 3650 -keypass clientPassword -storepass clientPassword -dname "CN=localhost, OU=Client Unit, O=JBoss, L=Pune, S=Maharashtra, C=IN"

# Exporting Client's Public Key
keytool -export -keystore jbossClient.keystore -alias clientalias -file clientPublicKey.cer -keypass clientPassword -storepass clientPassword

Above commands will create the following files:
“jbossServer.keystore” == This is Server’s keystore which we need to place inside “$JBOSS_HOME/standaone/configuration/” directory.

“serverPublicKey.cer” == This is the Server’s public key which later Client will import in their Client Keystore.

“jbossClient.keystore” == This is Client’s keystore which we need to place on the client side and will pass it to the Client program using JAVA_OPTIONS “-Djavax.net.ssl.trustStore=certificates/jbossClient.keystore”

“clientPublicKey.cer” == This is the Clients’s public key which later Server will import in their Server Keystore.

Step-2). Now we we created the Server / Client Keystore and their Public Keys so we will not run the following commands in order to Import Client’s Public Key on Server’s Keystore and Server’s Public Key on Client’s Keystore as following:

# Importing Client's Public key into server's truststore
keytool -import -v -trustcacerts -alias clientalias -file clientPublicKey.cer -keystore jbossServer.keystore -keypass JBossPassword -storepass JBossPassword

__________
OUTPUT
__________
Owner: CN=localhost, OU=Client Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
Issuer: CN=localhost, OU=Client Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
Serial number: 4fef590d
Valid from: Sun Jul 01 01:22:45 IST 2012 until: Wed Jun 29 01:22:45 IST 2022
Certificate fingerprints:
	 MD5:  9B:4A:A2:5D:7C:15:8A:B8:01:00:84:69:C3:8C:66:5B
	 SHA1: 9C:C1:05:34:EE:D9:6C:A2:6D:85:97:EA:52:F4:7D:E5:2C:B9:DB:04
	 Signature algorithm name: SHA1withRSA
	 Version: 3
Trust this certificate? [no]:  yes
Certificate was added to keystore
[Storing jbossServer.keystore]

And

# Importing Server's Public key into client's truststore
keytool -import -v -trustcacerts -alias jbossalias -file serverPublicKey.cer -keystore jbossClient.keystore -keypass clientPassword -storepass  clientPassword

__________
OUTPUT
__________
Owner: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
Issuer: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
Serial number: 4fef590c
Valid from: Sun Jul 01 01:22:44 IST 2012 until: Wed Jun 29 01:22:44 IST 2022
Certificate fingerprints:
	 MD5:  BD:0C:57:5D:26:64:EE:F4:6E:7E:E6:9C:E7:D0:DD:46
	 SHA1: BF:DF:22:29:54:80:BF:9B:7E:F5:48:7F:02:D5:76:9A:84:D4:09:BE
	 Signature algorithm name: SHA1withRSA
	 Version: 3
Trust this certificate? [no]:  yes
Certificate was added to keystore
[Storing jbossClient.keystore]

Step-3). Open the “$JBOSS_HOME/standaone/configuration/standalone-full.xml” file and then add a new Security Realm there inside the tag as following:

  <security-realm name="EJBRealm">
    <server-identities>
      <ssl>
        <keystore path="jbossServer.keystore" relative-to="jboss.server.config.dir" password="JBossPassword"/>
      </ssl>
    </server-identities>
    <authentication>
      <jaas name="ejb-security-domain"/>
    </authentication>
  </security-realm>

If you are using JBossAS7.1.2 or higher then rather than using [password="JBossPassword"] you will need to use [keystore-password="JBossPassword"] as the keystore Tag’s attribute is changed.

Step-4). As the above Security Realm is pointing to a security Domain “ejb-security-domain” so let’s create a new Security Realm inside the [subsystem xmlns="urn:jboss:domain:security:1.1"] subsystem as following:

     <security-domain name="ejb-security-domain" cache-type="default">
         <authentication>
           <login-module code="Remoting" flag="optional">
             <module-option name="password-stacking" value="useFirstPass"/>
           </login-module>
           <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
             <module-option name="defaultUsersProperties" value="${jboss.server.config.dir}/ejb-users.properties"/>
             <module-option name="defaultRolesProperties" value="${jboss.server.config.dir}/ejb-roles.properties"/>
             <module-option name="usersProperties" value="${jboss.server.config.dir}/ejb-users.properties"/>
             <module-option name="rolesProperties" value="${jboss.server.config.dir}/ejb-roles.properties"/>
             <module-option name="password-stacking" value="useFirstPass"/>
           </login-module>
         </authentication>
     </security-domain>

Step-5). Also as we know that the EJBs are accessed remotely using the JBoss Remoting so we will need to make sure that the remoting subsystem is also using the Security Realm (EJBRealm) which we created as following:

    <subsystem xmlns="urn:jboss:domain:remoting:1.1">
       <connector name="remoting-connector" socket-binding="remoting" security-realm="EJBRealm"/>
    </subsystem>

Step-6). As our Security domain is using two properties file so we will need to create those properties file as well inside “$JBOSS_HOME/standaone/configuration/” as following:

ejb-users.properties

ejbUser=ejbPassword

ejb-roles.properties

ejbUser=ejbRole

Step-7). *** NOTE: Before running your Server make sure that you have copied the “jbossServer.keystore” file inside “$JBOSS_HOME/standaone/configuration/” directory. . Now start the JBoss AS7.1.1.Final as following:

./standalone.sh -c standalone-full.xml

Developing Secure EJB3 Application

As the Server side configurations are done so now we will proceed with developing the Secure EJB3 application.

Step-8). Create a directory somewhere in your file system like “/home/userone/EJB3_Over_SSL” and then create another directory with name “src” inside the “/home/userone/EJB3_Over_SSL” directory.

Step-9). Write the EJB Stateless Bean class “CallerBean.java” as following inside the directory “/home/userone/EJB3_Over_SSL/src”:

package remote;
import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import javax.annotation.Resource;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed;
import javax.ejb.LocalBean;
import javax.ejb.SessionContext;

@Stateless
@Remote(CallerRemote.class)

/*
   If you dont want to use "META-INF/jboss-ejb3.xml" then you can use
   the following annotation to defing your security-domain
   @org.jboss.ejb3.annotation.SecurityDomain("ejb-security-domain")
*/

public class CallerBean implements CallerRemote
 {
     @Resource
     private SessionContext sessionContext;

     @RolesAllowed("ejbRole")
     public String testMethod(String name)
	    {
		   System.out.println("\n\n\tBean's testMethod(String name) called....");
                   System.out.println("\n\n\tUserName: '" + sessionContext.getCallerPrincipal().getName() + "' is able to access testMethod()");
                   if (sessionContext.isCallerInRole("ejbRole"))
                         System.out.println("\tUser is in   \"ejbRole\"   ");
                   else
                         System.out.println("\tUser is NOT in an allowed role");
		   return "[CallerBean] testMethod() returned Hello "+name;
	    }

     public String commonMethod(String name)
	    {
		   System.out.println("\n\n\tBean's commonMethod(String name) called....");
                   System.out.println("\n\nUser " + sessionContext.getCallerPrincipal().getName() + " is able to access commonMethod()");
                   if (sessionContext.isCallerInRole("ejbRole"))
                         System.out.println("\t##### commonMethod()  User is in ejbRole");
                   else
                         System.out.println("\t##### commonMethod()  User is NOT in ejbRole");
		   return "[CallerBean] commonMethod() returned Hello "+name;
	    }
 }

Step-10). Write the EJB Remote Interface “CallerRemote.java” as following inside the directory “/home/userone/EJB3_Over_SSL/src”:

package remote;
public interface CallerRemote
{
     public String testMethod(String name);
     public String commonMethod(String name);
}

Step-11). In order to secure the EJB we will define the security domain inside the “jboss-ejb3.xml” file. Spo create a file with this name inside “/home/userone/EJB3_Over_SSL/src” as following:


<?xml version="1.0"?>
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:s="urn:security"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
   http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
   version="3.1"
   impl-version="2.0">
  <assembly-descriptor>
    <s:security>
      <ejb-name>*</ejb-name>
          <s:security-domain>ejb-security-domain</s:security-domain>
    </s:security>
  </assembly-descriptor>

</jboss:ejb-jar>

Step-12). As we are going to create an EAR file containing the above Stateless Session Bean so We will write the “application.xml” as following inside the directory “/home/userone/EJB3_Over_SSL/src”:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID" version="5">
  <module>
    <ejb>remoteEJB.jar</ejb>
  </module>
</application>

Developing EJB3 Remote Client

Step-13). Now we will write the Client side code to access the Above mentioned EJB Remotely so create a class “TestRemoteClientA.java” as following inside the directory “/home/userone/EJB3_Over_SSL/src”:

package client;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import remote.CallerRemote;
public class TestRemoteClientA
  {
      public static void main(String ar[]) throws Exception
       {
          Context context=null;
       try
         {
                Properties props = new Properties();
                props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
                props.put(Context.PROVIDER_URL, "remote://localhost:4447");
                props.put(Context.SECURITY_PRINCIPAL, "ejbUser");
                props.put(Context.SECURITY_CREDENTIALS, "ejbPassword");

                props.put("jboss.naming.client.remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED","true");
                props.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_STARTTLS","true");

                props.put("jboss.naming.client.ejb.context", true);
                props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
                context = new InitialContext(props);
	        System.out.println("\n\t--------------------------\nGot initial Context: "+context);
         }
       catch (Exception e)
         {
                e.printStackTrace();
          }

         // Lookup Format will be
         // <app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>

         CallerRemote remote=(CallerRemote)context.lookup("TestRemoteEJBEAR/remoteEJB//CallerBean!remote.CallerRemote");
         //System.out.println("\n\t remote.testMethod(\"Common-MiddlewareMagic\") = "+remote.commonMethod("Common-MiddlewareMagic"));

         System.out.println("\n\t remote.testMethod(\"MiddlewareMagic\") = "+remote.testMethod("MiddlewareMagic"));
       }
  }

Step-14). Now we will need to create a properties file “jboss-ejb-client.properties” as following inside the directory “/home/userone/EJB3_Over_SSL/src”:


remote.connections=testEJB
remote.connection.testEJB.port=4447
remote.connection.testEJB.host=localhost
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=true
remote.connection.testEJB.connect.options.org.xnio.Options.SSL_STARTTLS=true
remote.connection.testEJB.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true
remote.connection.testEJB.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
remote.connection.testEJB.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER

NOTE: The above properties file need to be present inside the client’s classpath. In our case we are going to put this file inside a JAR file “remoteEJBClient.jar” and then we will add this JAR inside the client’s classpath.

Step-15). Almost everything is done, so we will create a client side logging file sothat we will get the desired logging at the Remote EJB Client side. So lets create a file “logging.properties” inside “/home/userone/EJB3_Over_SSL/src” as following:


# Logging
handlers =  java.util.logging.ConsoleHandler
.level = ALL
INFO

# Console Logging
java.util.logging.ConsoleHandler.level=SEVERE

Step-16). Now the most important part of building / deploying and running the application so in order to achieve that we will create a simple ant build script, So Create a “build.xml” file inside the “/home/userone/EJB3_Over_SSL” directory as following:

<project name="EJB3_SSLBased_SecurityDomain_Service" default="all">
<property name="jboss.home" value="/NotBackedUp/JBoss_All/jboss-as-7.1.1.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="src.dir" value="src" />
<property name="output.dir" value="build" />
<property name="ear.name" value="TestRemoteEJBEAR.ear" />
<property name="ejb.jar" value="remoteEJB.jar" />
<property name="client.jar.name" value="remoteEJBClient.jar" />

        <path id="jboss.classpath">
           <fileset dir="${jboss.module.dir}">
               <include name="**/*.jar"/>
           </fileset>
        </path>

        <!-- Client Needs the following Jar to be present in the CLASSPATH including -->
        <path id="jboss.new.client.classpath">
          <!-- <fileset dir="${jboss.home}/bin/client">  -->
           <fileset dir="${jboss.home}/bin/client" >
               <include name="jboss-client.jar" />
           </fileset>
           <fileset dir="/NotBackedUp/MyJdks/jdk1.6.0_21/jre/lib">
               <include name="rt.jar" />
           </fileset>
        </path>

        <target name="all" depends="deploy" />

        <target name="build_ear">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}/META-INF" />
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="*.java" excludes="TestRemoteClientA.java" classpathref="jboss.classpath"/>
           <copy file="${src.dir}/jboss-ejb3.xml" todir="${tmp.dir}/META-INF"/>
           <jar jarfile="${tmp.dir}/${ejb.jar}" basedir="${tmp.dir}" compress="true" />

           <delete file="${tmp.dir}/ejb-users.properties"/>
           <delete file="${tmp.dir}/ejb-roles.properties"/>
           <delete file="${tmp.dir}/META-INF/jboss-ejb3.xml"/>

           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/remote"/>
           </delete>
           <mkdir dir="${tmp.dir}/META-INF"/>
           <copy todir="${tmp.dir}/META-INF">
                <fileset dir="${src.dir}/">
                  <include name="application.xml"/>
                </fileset>
           </copy>
           <jar jarfile="${tmp.dir}/${ear.name}" basedir="${tmp.dir}" compress="true" />
           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/META-INF"/>
           </delete>
           <delete file="${tmp.dir}/${ejb.jar}"/>

           <copy file="${tmp.dir}/${ear.name}" tofile="${output.dir}/${ear.name}"/>
           <delete file="${tmp.dir}/${ear.name}"/>
        </target>

        <target name="deploy" depends="build_ear">
            <echo message="*******************  Deploying the EAR file ${ear.name} *********************" />
            <echo message="********** ${output.dir}/${ear.name} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${ear.name}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
        </target>

        <target name="run">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <copy file="${src.dir}/jboss-ejb-client.properties" toDir="${tmp.dir}"/> 

           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="CallerRemote.java,TestRemoteClientA.java" classpathref="jboss.classpath"/>
           <jar jarfile="${output.dir}/${client.jar.name}" basedir="${tmp.dir}" compress="true" />
           <delete dir="${tmp.dir}"/>

           <java classname="client.TestRemoteClientA" fork="true">
               <classpath>
                  <pathelement location="${output.dir}/${client.jar.name}"/>
                  <path refid="jboss.new.client.classpath"/>
               </classpath>

               <sysproperty key="java.util.logging.manager" value="java.util.logging.LogManager"/>
               <sysproperty key="java.util.logging.config.file" value="logging.properties"/>
               <sysproperty key="java.util.logging.ConsoleHandler.level" value="TRACE" />

               <!-- SSL Related System Properties -->
               <sysproperty key="javax.net.ssl.trustStore" value="certificates/jbossClient.keystore"/>
               <sysproperty key="javax.net.ssl.trustStorePassword" value="clientPassword"/>
               <sysproperty key="javax.net.debug" value="all"/>

           </java>
        </target>        

</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory.

Step-17). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step-18). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/userone/EJB3_Over_SSL” and then run the ant to build and deploy the EJB based EAR applicationon your JBoss Standalone full profile, by running the command “ant deploy”

[userone@localhost EJB3_Over_SSL]$ ant deploy
Buildfile: build.xml

build_ear:
    [mkdir] Created dir: /home/userone/EJB3_Over_SSL/tmp/META-INF
    [javac] Compiling 2 source files to /home/userone/EJB3_Over_SSL/tmp
     [copy] Copying 1 file to /home/userone/EJB3_Over_SSL/tmp/META-INF
      [jar] Building jar: /home/userone/EJB3_Over_SSL/tmp/remoteEJB.jar
   [delete] Deleting: /home/userone/EJB3_Over_SSL/tmp/META-INF/jboss-ejb3.xml
     [copy] Copying 1 file to /home/userone/EJB3_Over_SSL/tmp/META-INF
      [jar] Building jar: /home/userone/EJB3_Over_SSL/tmp/TestRemoteEJBEAR.ear
   [delete] Deleting: /home/userone/EJB3_Over_SSL/tmp/remoteEJB.jar
     [copy] Copying 1 file to /home/userone/EJB3_Over_SSL/build
   [delete] Deleting: /home/userone/EJB3_Over_SSL/tmp/TestRemoteEJBEAR.ear

deploy:
     [echo] *******************  Deploying the EAR file TestRemoteEJBEAR.ear *********************
     [echo] ********** build/TestRemoteEJBEAR.ear to /home/userone/jboss-as-7.1.1.Final//standalone/deployments **********
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.1.Final//standalone/deployments
     [echo] *******************  Deployed Successfully   *********************

all:

BUILD SUCCESSFUL
Total time: 2 seconds

Step-19). NOTE: Before running the program make sure that the “jbossClient.keystore” is placed inside the “/home/userone/EJB3_Over_SSL/certificates” directory. Now we will try to compile and run the EJB3 remote Client application by running the command “ant run”

[userone@localhost EJB3_Over_SSL]$ ant run
Buildfile: build.xml

run:
   [delete] Deleting directory /home/userone/EJB3_Over_SSL/tmp
    [mkdir] Created dir: /home/userone/EJB3_Over_SSL/tmp
     [copy] Copying 1 file to /home/userone/EJB3_Over_SSL/tmp
    [javac] Compiling 2 source files to /home/userone/EJB3_Over_SSL/tmp
      [jar] Building jar: /home/userone/EJB3_Over_SSL/build/remoteEJBClient.jar
   [delete] Deleting directory /home/userone/EJB3_Over_SSL/tmp
     [java]
     [java] 	--------------------------
     [java] Got initial Context: javax.naming.InitialContext@5ff3ce5c
     [java]
     [java] 	 remote.testMethod("MiddlewareMagic") = [CallerBean] testMethod() returned Hello MiddlewareMagic

BUILD SUCCESSFUL
Total time: 3 seconds

Debugging SSL Communication

If you want to debug the SSL Communication then enable the “<sysproperty key=”javax.net.debug” value=”all”/>” system property in the Client “run” task in “build.xml” . then while starting the client program you will see the following kind of SSL Communication.

[userone@localhost EJB3_Over_SSL]$ ant run
ant run
Buildfile: build.xml

run:
   [delete] Deleting directory /home/userone/EJB3_Over_SSL/tmp
    [mkdir] Created dir: /home/userone/EJB3_Over_SSL/tmp
     [copy] Copying 1 file to /home/userone/EJB3_Over_SSL/tmp
    [javac] Compiling 2 source files to /home/userone/EJB3_Over_SSL/tmp
      [jar] Building jar: /home/userone/EJB3_Over_SSL/build/remoteEJBClient.jar
   [delete] Deleting directory /home/userone/EJB3_Over_SSL/tmp

     [java] keyStore is :
     [java] keyStore type is : jks
     [java] keyStore provider is :
     [java] init keystore
     [java] init keymanager of type SunX509
     [java] trustStore is: certificates/jbossClient.keystore
     [java] trustStore type is : jks
     [java] trustStore provider is :
     [java] init truststore
     [java] adding as trusted cert:
     [java]   Subject: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   Issuer:  CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   Algorithm: RSA; Serial number: 0x4fef590c
     [java]   Valid from Sun Jul 01 01:22:44 IST 2012 until Wed Jun 29 01:22:44 IST 2022
     [java]
     [java] adding as trusted cert:
     [java]   Subject: CN=localhost, OU=Client Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   Issuer:  CN=localhost, OU=Client Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   Algorithm: RSA; Serial number: 0x4fef590d
     [java]   Valid from Sun Jul 01 01:22:45 IST 2012 until Wed Jun 29 01:22:45 IST 2022
     [java]
     [java] trigger seeding of SecureRandom
     [java] done seeding SecureRandom
     [java] Using SSLEngineImpl.
     [java] %% No cached client session
     [java] *** ClientHello, TLSv1
     [java] RandomCookie:  GMT: 1324357980 bytes = { 110, 34, 249, 61, 71, 63, 18, 48, 41, 193, 247, 1, 150, 204, 40, 254, 85, 104, 159, 105, 26, 29, 243, 75, 81, 145, 157, 145 }
     [java] Session ID:  {}
     [java] Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
     [java] Compression Methods:  { 0 }
     [java] ***
     [java] [write] MD5 and SHA1 hashes:  len = 73
     [java] 0000: 01 00 00 45 03 01 4F F0   19 5C 6E 22 F9 3D 47 3F  ...E..O..\n".=G?
     [java] 0010: 12 30 29 C1 F7 01 96 CC   28 FE 55 68 9F 69 1A 1D  .0).....(.Uh.i..
     [java] 0020: F3 4B 51 91 9D 91 00 00   1E 00 04 00 05 00 2F 00  .KQ.........../.
     [java] 0030: 33 00 32 00 0A 00 16 00   13 00 09 00 15 00 12 00  3.2.............
     [java] 0040: 03 00 08 00 14 00 11 01   00                       .........
     [java] Remoting "config-based-naming-client-endpoint" read-1, WRITE: TLSv1 Handshake, length = 73
     [java] [write] MD5 and SHA1 hashes:  len = 98
     [java] 0000: 01 03 01 00 39 00 00 00   20 00 00 04 01 00 80 00  ....9... .......
     [java] 0010: 00 05 00 00 2F 00 00 33   00 00 32 00 00 0A 07 00  ..../..3..2.....
     [java] 0020: C0 00 00 16 00 00 13 00   00 09 06 00 40 00 00 15  ............@...
     [java] 0030: 00 00 12 00 00 03 02 00   80 00 00 08 00 00 14 00  ................
     [java] 0040: 00 11 4F F0 19 5C 6E 22   F9 3D 47 3F 12 30 29 C1  ..O..\n".=G?.0).
     [java] 0050: F7 01 96 CC 28 FE 55 68   9F 69 1A 1D F3 4B 51 91  ....(.Uh.i...KQ.
     [java] 0060: 9D 91                                              ..
     [java] Remoting "config-based-naming-client-endpoint" read-1, WRITE: SSLv2 client hello message, length = 98
     [java] [Raw write]: length = 100
     [java] 0000: 80 62 01 03 01 00 39 00   00 00 20 00 00 04 01 00  .b....9... .....
     [java] 0010: 80 00 00 05 00 00 2F 00   00 33 00 00 32 00 00 0A  ....../..3..2...
     [java] 0020: 07 00 C0 00 00 16 00 00   13 00 00 09 06 00 40 00  ..............@.
     [java] 0030: 00 15 00 00 12 00 00 03   02 00 80 00 00 08 00 00  ................
     [java] 0040: 14 00 00 11 4F F0 19 5C   6E 22 F9 3D 47 3F 12 30  ....O..\n".=G?.0
     [java] 0050: 29 C1 F7 01 96 CC 28 FE   55 68 9F 69 1A 1D F3 4B  ).....(.Uh.i...K
     [java] 0060: 51 91 9D 91                                        Q...
     [java] [Raw read]: length = 5
     [java] 0000: 16 03 01 02 A9                                     .....
     [java] [Raw read]: length = 681
     [java] 0000: 02 00 00 46 03 01 4F F0   19 5C 6A F6 F0 B2 5A B1  ...F..O..\j...Z.
     [java] 0010: 13 57 19 92 A7 4A D2 CF   57 FF 54 EB 72 DC 94 D9  .W...J..W.T.r...
     [java] 0020: 20 92 41 1A 1C 1D 20 4F   F0 19 5C D0 F5 36 B9 F4   .A... O..\..6..
     [java] 0030: A7 AD FE C7 9C 83 64 74   BA 73 5C D1 01 08 B5 B4  ......dt.s\.....
     [java] 0040: 88 98 D4 71 51 D0 A8 00   04 00 0B 00 02 57 00 02  ...qQ........W..
     [java] 0050: 54 00 02 51 30 82 02 4D   30 82 01 B6 A0 03 02 01  T..Q0..M0.......
     [java] 0060: 02 02 04 4F EF 59 0C 30   0D 06 09 2A 86 48 86 F7  ...O.Y.0...*.H..
     [java] 0070: 0D 01 01 05 05 00 30 6B   31 0B 30 09 06 03 55 04  ......0k1.0...U.
     [java] 0080: 06 13 02 49 4E 31 14 30   12 06 03 55 04 08 13 0B  ...IN1.0...U....
     [java] 0090: 4D 61 68 61 72 61 73 68   74 72 61 31 0D 30 0B 06  Maharashtra1.0..
     [java] 00A0: 03 55 04 07 13 04 50 75   6E 65 31 0E 30 0C 06 03  .U....Pune1.0...
     [java] 00B0: 55 04 0A 13 05 4A 42 6F   73 73 31 13 30 11 06 03  U....JBoss1.0...
     [java] 00C0: 55 04 0B 13 0A 4A 42 6F   73 73 20 55 6E 69 74 31  U....JBoss Unit1
     [java] 00D0: 12 30 10 06 03 55 04 03   13 09 6C 6F 63 61 6C 68  .0...U....localh
     [java] 00E0: 6F 73 74 30 1E 17 0D 31   32 30 36 33 30 31 39 35  ost0...120630195
     [java] 00F0: 32 34 34 5A 17 0D 32 32   30 36 32 38 31 39 35 32  244Z..2206281952
     [java] 0100: 34 34 5A 30 6B 31 0B 30   09 06 03 55 04 06 13 02  44Z0k1.0...U....
     [java] 0110: 49 4E 31 14 30 12 06 03   55 04 08 13 0B 4D 61 68  IN1.0...U....Mah
     [java] 0120: 61 72 61 73 68 74 72 61   31 0D 30 0B 06 03 55 04  arashtra1.0...U.
     [java] 0130: 07 13 04 50 75 6E 65 31   0E 30 0C 06 03 55 04 0A  ...Pune1.0...U..
     [java] 0140: 13 05 4A 42 6F 73 73 31   13 30 11 06 03 55 04 0B  ..JBoss1.0...U..
     [java] 0150: 13 0A 4A 42 6F 73 73 20   55 6E 69 74 31 12 30 10  ..JBoss Unit1.0.
     [java] 0160: 06 03 55 04 03 13 09 6C   6F 63 61 6C 68 6F 73 74  ..U....localhost
     [java] 0170: 30 81 9F 30 0D 06 09 2A   86 48 86 F7 0D 01 01 01  0..0...*.H......
     [java] 0180: 05 00 03 81 8D 00 30 81   89 02 81 81 00 8A B8 1B  ......0.........
     [java] 0190: C9 3E 28 C0 D0 3B 35 78   27 73 CC EE F0 03 5F 39  .>(..;5x's...._9
     [java] 01A0: A4 8D 35 B9 DB 45 CB B4   C2 18 57 7B 5C 12 E0 6A  ..5..E....W.\..j
     [java] 01B0: 1E 19 5C ED 0E B5 AB 21   B1 99 5C D6 32 32 75 BA  ..\....!..\.22u.
     [java] 01C0: D4 D4 B3 BE BF F4 FF 41   53 6F B3 1A 59 CF 8F F6  .......ASo..Y...
     [java] 01D0: 28 36 E8 DA 5F 72 1D B5   3B 27 39 7C B4 AE AF C5  (6.._r..;'9.....
     [java] 01E0: 19 17 86 10 F2 94 5C F6   24 45 9D F7 A7 7D CE 1D  ......\.$E......
     [java] 01F0: 45 CD D8 0B 92 8C 61 38   0C 03 2A 6E C3 70 A7 49  E.....a8..*n.p.I
     [java] 0200: F3 39 32 E6 D2 42 55 69   34 6F DD 45 B9 02 03 01  .92..BUi4o.E....
     [java] 0210: 00 01 30 0D 06 09 2A 86   48 86 F7 0D 01 01 05 05  ..0...*.H.......
     [java] 0220: 00 03 81 81 00 03 A2 ED   32 FC 46 69 3C 24 13 D2  ........2.Fi<$..
     [java] 0230: DA A9 EC 16 CB C0 12 D1   8D 1A D0 A1 AC EB 10 2E  ................
     [java] 0240: E0 24 60 5A D5 7B 57 5B   85 ED FF 34 73 E8 0D 42  .$`Z..W[...4s..B
     [java] 0250: F3 BC F1 B4 BB C3 22 5F   C8 84 AB D7 65 C8 B1 A4  ......"_....e...
     [java] 0260: 59 39 96 06 AE 44 19 0F   0F 85 BC 6D 22 B6 DD EC  Y9...D.....m"...
     [java] 0270: 63 31 59 8A 86 6A A1 66   73 C0 CD 78 EB D0 F6 B4  c1Y..j.fs..x....
     [java] 0280: 96 02 FF 8D E0 EF D6 63   91 7C 41 01 46 E9 1A 4A  .......c..A.F..J
     [java] 0290: 07 61 A1 17 48 2D B3 A5   EB 57 D8 1B 1A FF 67 1D  .a..H-...W....g.
     [java] 02A0: 75 2C 97 61 D5 0E 00 00   00                       u,.a.....
     [java] Remoting "config-based-naming-client-endpoint" write-1, READ: TLSv1 Handshake, length = 681
     [java] *** ServerHello, TLSv1
     [java] RandomCookie:  GMT: 1324357980 bytes = { 106, 246, 240, 178, 90, 177, 19, 87, 25, 146, 167, 74, 210, 207, 87, 255, 84, 235, 114, 220, 148, 217, 32, 146, 65, 26, 28, 29 }
     [java] Session ID:  {79, 240, 25, 92, 208, 245, 54, 185, 244, 167, 173, 254, 199, 156, 131, 100, 116, 186, 115, 92, 209, 1, 8, 181, 180, 136, 152, 212, 113, 81, 208, 168}
     [java] Cipher Suite: SSL_RSA_WITH_RC4_128_MD5
     [java] Compression Method: 0
     [java] ***
     [java] %% Created:  [Session-1, SSL_RSA_WITH_RC4_128_MD5]
     [java] ** SSL_RSA_WITH_RC4_128_MD5
     [java] [read] MD5 and SHA1 hashes:  len = 74
     [java] 0000: 02 00 00 46 03 01 4F F0   19 5C 6A F6 F0 B2 5A B1  ...F..O..\j...Z.
     [java] 0010: 13 57 19 92 A7 4A D2 CF   57 FF 54 EB 72 DC 94 D9  .W...J..W.T.r...
     [java] 0020: 20 92 41 1A 1C 1D 20 4F   F0 19 5C D0 F5 36 B9 F4   .A... O..\..6..
     [java] 0030: A7 AD FE C7 9C 83 64 74   BA 73 5C D1 01 08 B5 B4  ......dt.s\.....
     [java] 0040: 88 98 D4 71 51 D0 A8 00   04 00                    ...qQ.....
     [java] *** Certificate chain
     [java] chain [0] = [
     [java] [
     [java]   Version: V3
     [java]   Subject: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
     [java]
     [java]   Key:  Sun RSA public key, 1024 bits
     [java]   modulus: 97411916696004455715650884036315912728020904800771557030856740440315088203408504305929172442979068191350480416459422711766442170797911249673086293976645998139784138189674783077479005052825438145063261803343060485911264409807373232121906144287123313814508797496513262971443028578702660792151284744100478010809
     [java]   public exponent: 65537
     [java]   Validity: [From: Sun Jul 01 01:22:44 IST 2012,
     [java]                To: Wed Jun 29 01:22:44 IST 2022]
     [java]   Issuer: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   SerialNumber: [    4fef590c]
     [java]
     [java] ]
     [java]   Algorithm: [SHA1withRSA]
     [java]   Signature:
     [java] 0000: 03 A2 ED 32 FC 46 69 3C   24 13 D2 DA A9 EC 16 CB  ...2.Fi<$.......
     [java] 0010: C0 12 D1 8D 1A D0 A1 AC   EB 10 2E E0 24 60 5A D5  ............$`Z.
     [java] 0020: 7B 57 5B 85 ED FF 34 73   E8 0D 42 F3 BC F1 B4 BB  .W[...4s..B.....
     [java] 0030: C3 22 5F C8 84 AB D7 65   C8 B1 A4 59 39 96 06 AE  ."_....e...Y9...
     [java] 0040: 44 19 0F 0F 85 BC 6D 22   B6 DD EC 63 31 59 8A 86  D.....m"...c1Y..
     [java] 0050: 6A A1 66 73 C0 CD 78 EB   D0 F6 B4 96 02 FF 8D E0  j.fs..x.........
     [java] 0060: EF D6 63 91 7C 41 01 46   E9 1A 4A 07 61 A1 17 48  ..c..A.F..J.a..H
     [java] 0070: 2D B3 A5 EB 57 D8 1B 1A   FF 67 1D 75 2C 97 61 D5  -...W....g.u,.a.
     [java]
     [java] ]
     [java] ***
     [java] Found trusted certificate:
     [java] [
     [java] [
     [java]   Version: V3
     [java]   Subject: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
     [java]
     [java]   Key:  Sun RSA public key, 1024 bits
     [java]   modulus: 97411916696004455715650884036315912728020904800771557030856740440315088203408504305929172442979068191350480416459422711766442170797911249673086293976645998139784138189674783077479005052825438145063261803343060485911264409807373232121906144287123313814508797496513262971443028578702660792151284744100478010809
     [java]   public exponent: 65537
     [java]   Validity: [From: Sun Jul 01 01:22:44 IST 2012,
     [java]                To: Wed Jun 29 01:22:44 IST 2022]
     [java]   Issuer: CN=localhost, OU=JBoss Unit, O=JBoss, L=Pune, ST=Maharashtra, C=IN
     [java]   SerialNumber: [    4fef590c]
     [java]
     [java] ]
     [java]   Algorithm: [SHA1withRSA]
     [java]   Signature:
     [java] 0000: 03 A2 ED 32 FC 46 69 3C   24 13 D2 DA A9 EC 16 CB  ...2.Fi<$.......
     [java] 0010: C0 12 D1 8D 1A D0 A1 AC   EB 10 2E E0 24 60 5A D5  ............$`Z.
     [java] 0020: 7B 57 5B 85 ED FF 34 73   E8 0D 42 F3 BC F1 B4 BB  .W[...4s..B.....
     [java] 0030: C3 22 5F C8 84 AB D7 65   C8 B1 A4 59 39 96 06 AE  ."_....e...Y9...
     [java] 0040: 44 19 0F 0F 85 BC 6D 22   B6 DD EC 63 31 59 8A 86  D.....m"...c1Y..
     [java] 0050: 6A A1 66 73 C0 CD 78 EB   D0 F6 B4 96 02 FF 8D E0  j.fs..x.........
     [java] 0060: EF D6 63 91 7C 41 01 46   E9 1A 4A 07 61 A1 17 48  ..c..A.F..J.a..H
     [java] 0070: 2D B3 A5 EB 57 D8 1B 1A   FF 67 1D 75 2C 97 61 D5  -...W....g.u,.a.
     [java]
     [java] ]
     [java] [read] MD5 and SHA1 hashes:  len = 603
     [java] 0000: 0B 00 02 57 00 02 54 00   02 51 30 82 02 4D 30 82  ...W..T..Q0..M0.
     [java] 0010: 01 B6 A0 03 02 01 02 02   04 4F EF 59 0C 30 0D 06  .........O.Y.0..
     [java] 0020: 09 2A 86 48 86 F7 0D 01   01 05 05 00 30 6B 31 0B  .*.H........0k1.
     [java] 0030: 30 09 06 03 55 04 06 13   02 49 4E 31 14 30 12 06  0...U....IN1.0..
     [java] 0040: 03 55 04 08 13 0B 4D 61   68 61 72 61 73 68 74 72  .U....Maharashtr
     [java] 0050: 61 31 0D 30 0B 06 03 55   04 07 13 04 50 75 6E 65  a1.0...U....Pune
     [java] 0060: 31 0E 30 0C 06 03 55 04   0A 13 05 4A 42 6F 73 73  1.0...U....JBoss
     [java] 0070: 31 13 30 11 06 03 55 04   0B 13 0A 4A 42 6F 73 73  1.0...U....JBoss
     [java] 0080: 20 55 6E 69 74 31 12 30   10 06 03 55 04 03 13 09   Unit1.0...U....
     [java] 0090: 6C 6F 63 61 6C 68 6F 73   74 30 1E 17 0D 31 32 30  localhost0...120
     [java] 00A0: 36 33 30 31 39 35 32 34   34 5A 17 0D 32 32 30 36  630195244Z..2206
     [java] 00B0: 32 38 31 39 35 32 34 34   5A 30 6B 31 0B 30 09 06  28195244Z0k1.0..
     [java] 00C0: 03 55 04 06 13 02 49 4E   31 14 30 12 06 03 55 04  .U....IN1.0...U.
     [java] 00D0: 08 13 0B 4D 61 68 61 72   61 73 68 74 72 61 31 0D  ...Maharashtra1.
     [java] 00E0: 30 0B 06 03 55 04 07 13   04 50 75 6E 65 31 0E 30  0...U....Pune1.0
     [java] 00F0: 0C 06 03 55 04 0A 13 05   4A 42 6F 73 73 31 13 30  ...U....JBoss1.0
     [java] 0100: 11 06 03 55 04 0B 13 0A   4A 42 6F 73 73 20 55 6E  ...U....JBoss Un
     [java] 0110: 69 74 31 12 30 10 06 03   55 04 03 13 09 6C 6F 63  it1.0...U....loc
     [java] 0120: 61 6C 68 6F 73 74 30 81   9F 30 0D 06 09 2A 86 48  alhost0..0...*.H
     [java] 0130: 86 F7 0D 01 01 01 05 00   03 81 8D 00 30 81 89 02  ............0...
     [java] 0140: 81 81 00 8A B8 1B C9 3E   28 C0 D0 3B 35 78 27 73  .......>(..;5x's
     [java] 0150: CC EE F0 03 5F 39 A4 8D   35 B9 DB 45 CB B4 C2 18  ...._9..5..E....
     [java] 0160: 57 7B 5C 12 E0 6A 1E 19   5C ED 0E B5 AB 21 B1 99  W.\..j..\....!..
     [java] 0170: 5C D6 32 32 75 BA D4 D4   B3 BE BF F4 FF 41 53 6F  \.22u........ASo
     [java] 0180: B3 1A 59 CF 8F F6 28 36   E8 DA 5F 72 1D B5 3B 27  ..Y...(6.._r..;'
     [java] 0190: 39 7C B4 AE AF C5 19 17   86 10 F2 94 5C F6 24 45  9...........\.$E
     [java] 01A0: 9D F7 A7 7D CE 1D 45 CD   D8 0B 92 8C 61 38 0C 03  ......E.....a8..
     [java] 01B0: 2A 6E C3 70 A7 49 F3 39   32 E6 D2 42 55 69 34 6F  *n.p.I.92..BUi4o
     [java] 01C0: DD 45 B9 02 03 01 00 01   30 0D 06 09 2A 86 48 86  .E......0...*.H.
     [java] 01D0: F7 0D 01 01 05 05 00 03   81 81 00 03 A2 ED 32 FC  ..............2.
     [java] 01E0: 46 69 3C 24 13 D2 DA A9   EC 16 CB C0 12 D1 8D 1A  Fi<$............
     [java] 01F0: D0 A1 AC EB 10 2E E0 24   60 5A D5 7B 57 5B 85 ED  .......$`Z..W[..
     [java] 0200: FF 34 73 E8 0D 42 F3 BC   F1 B4 BB C3 22 5F C8 84  .4s..B......"_..
     [java] 0210: AB D7 65 C8 B1 A4 59 39   96 06 AE 44 19 0F 0F 85  ..e...Y9...D....
     [java] 0220: BC 6D 22 B6 DD EC 63 31   59 8A 86 6A A1 66 73 C0  .m"...c1Y..j.fs.
     [java] 0230: CD 78 EB D0 F6 B4 96 02   FF 8D E0 EF D6 63 91 7C  .x...........c..
     [java] 0240: 41 01 46 E9 1A 4A 07 61   A1 17 48 2D B3 A5 EB 57  A.F..J.a..H-...W
     [java] 0250: D8 1B 1A FF 67 1D 75 2C   97 61 D5                 ....g.u,.a.
     [java] *** ServerHelloDone
     [java] [read] MD5 and SHA1 hashes:  len = 4
     [java] 0000: 0E 00 00 00                                        ....
     [java] *** ClientKeyExchange, RSA PreMasterSecret, TLSv1
     [java] [write] MD5 and SHA1 hashes:  len = 134
     [java] 0000: 10 00 00 82 00 80 03 04   43 75 EF 72 2E 07 4A ED  ........Cu.r..J.
     [java] 0010: 2E 78 00 13 6B 8C C3 A3   88 56 E0 71 3C 3A 68 AE  .x..k....V.q<:h.
     [java] 0020: A8 B0 CA F9 CB 27 0F 01   DB 55 F9 B1 9E 99 EC 5E  .....'...U.....^
     [java] 0030: 31 BB FB 94 FE A2 7C F5   8F 8D 49 EF 01 F7 AE 69  1.........I....i
     [java] 0040: 0B 84 5B 43 7A 7C 47 B3   A0 CE 46 8C 06 B0 36 76  ..[Cz.G...F...6v
     [java] 0050: C7 30 42 B1 B9 DC 84 07   DA AC 5F 89 C1 6F 2C D5  .0B......._..o,.
     [java] 0060: CF 99 AC B3 E8 AC C6 79   83 E1 58 6C D6 55 86 2B  .......y..Xl.U.+
     [java] 0070: 84 D6 3A D0 F9 6B 46 FC   F6 F9 47 A8 E2 41 82 5F  ..:..kF...G..A._
     [java] 0080: 95 02 1E AE 4E E0                                  ....N.
     [java] Remoting "config-based-naming-client-endpoint" write-1, WRITE: TLSv1 Handshake, length = 134
     [java] SESSION KEYGEN:
     [java] PreMaster Secret:
     [java] 0000: 03 01 AC 7D FE 2C DE E8   96 19 47 B0 9C 36 2B 11  .....,....G..6+.
     [java] 0010: D7 83 58 D5 FF FE 2C AE   E0 20 95 B1 B0 9A EC 68  ..X...,.. .....h
     [java] 0020: 82 51 BA 98 4B 94 C4 E4   E7 EF FC B6 68 18 F6 FD  .Q..K.......h...
     [java] CONNECTION KEYGEN:
     [java] Client Nonce:
     [java] 0000: 4F F0 19 5C 6E 22 F9 3D   47 3F 12 30 29 C1 F7 01  O..\n".=G?.0)...
     [java] 0010: 96 CC 28 FE 55 68 9F 69   1A 1D F3 4B 51 91 9D 91  ..(.Uh.i...KQ...
     [java] Server Nonce:
     [java] 0000: 4F F0 19 5C 6A F6 F0 B2   5A B1 13 57 19 92 A7 4A  O..\j...Z..W...J
     [java] 0010: D2 CF 57 FF 54 EB 72 DC   94 D9 20 92 41 1A 1C 1D  ..W.T.r... .A...
     [java] Master Secret:
     [java] 0000: 35 92 7D A3 EE 1F BB 07   76 8A FF 49 52 F9 0D 6E  5.......v..IR..n
     [java] 0010: D6 03 08 2C D3 1D F8 4B   E5 A8 1A 22 FA 20 A0 56  ...,...K...". .V
     [java] 0020: 69 18 08 57 99 A0 8B 9F   CA 32 1A 09 9D E9 49 BA  i..W.....2....I.
     [java] Client MAC write Secret:
     [java] 0000: 16 22 37 98 C8 87 48 6A   C1 CE 7F 9D 6F A6 39 52  ."7...Hj....o.9R
     [java] Server MAC write Secret:
     [java] 0000: 68 5B 59 12 54 C5 1B 29   2B D2 86 22 10 F8 CC D1  h[Y.T..)+.."....
     [java] Client write key:
     [java] 0000: 67 7B BE 89 EB 94 C5 AA   B8 44 C5 53 80 F0 D9 0D  g........D.S....
     [java] Server write key:
     [java] 0000: C9 E5 5C 60 CC 2E DE 19   B6 07 1F 0E B6 B8 01 9D  ..\`............
     [java] ... no IV used for this cipher
     [java] Remoting "config-based-naming-client-endpoint" write-1, WRITE: TLSv1 Change Cipher Spec, length = 1
     [java] *** Finished
     [java] verify_data:  { 230, 49, 107, 73, 219, 244, 8, 157, 183, 78, 144, 252 }
     [java] ***
     [java] [write] MD5 and SHA1 hashes:  len = 16
     [java] 0000: 14 00 00 0C E6 31 6B 49   DB F4 08 9D B7 4E 90 FC  .....1kI.....N..
     [java] Padded plaintext before ENCRYPTION:  len = 32
     [java] 0000: 14 00 00 0C E6 31 6B 49   DB F4 08 9D B7 4E 90 FC  .....1kI.....N..
     [java] 0010: 36 64 83 45 B7 B1 E6 7A   04 16 B3 C1 CE CC 9A FA  6d.E...z........
     [java] Remoting "config-based-naming-client-endpoint" write-1, WRITE: TLSv1 Handshake, length = 32
     [java] [Raw write]: length = 139
     [java] 0000: 16 03 01 00 86 10 00 00   82 00 80 03 04 43 75 EF  .............Cu.
     [java] 0010: 72 2E 07 4A ED 2E 78 00   13 6B 8C C3 A3 88 56 E0  r..J..x..k....V.
     [java] 0020: 71 3C 3A 68 AE A8 B0 CA   F9 CB 27 0F 01 DB 55 F9  q<:h......'...U.
     [java] 0030: B1 9E 99 EC 5E 31 BB FB   94 FE A2 7C F5 8F 8D 49  ....^1.........I
     [java] 0040: EF 01 F7 AE 69 0B 84 5B   43 7A 7C 47 B3 A0 CE 46  ....i..[Cz.G...F
     [java] 0050: 8C 06 B0 36 76 C7 30 42   B1 B9 DC 84 07 DA AC 5F  ...6v.0B......._
     [java] 0060: 89 C1 6F 2C D5 CF 99 AC   B3 E8 AC C6 79 83 E1 58  ..o,........y..X
     [java] 0070: 6C D6 55 86 2B 84 D6 3A   D0 F9 6B 46 FC F6 F9 47  l.U.+..:..kF...G
     [java] 0080: A8 E2 41 82 5F 95 02 1E   AE 4E E0                 ..A._....N.
     [java] [Raw write]: length = 6
     [java] 0000: 14 03 01 00 01 01                                  ......
     [java] [Raw write]: length = 37
     [java] 0000: 16 03 01 00 20 68 AB F3   1F E7 E5 35 EB FF 43 D4  .... h.....5..C.
     [java] 0010: C5 00 12 62 C4 9F 8D 3E   DB 53 78 F5 01 0C 92 29  ...b...>.Sx....)
     [java] 0020: 79 B8 0D AA 18                                     y....
     [java] [Raw read]: length = 5
     [java] 0000: 14 03 01 00 01                                     .....
     [java] [Raw read]: length = 1
     [java] 0000: 01                                                 .
     [java] Remoting "config-based-naming-client-endpoint" read-1, READ: TLSv1 Change Cipher Spec, length = 1
     [java] [Raw read]: length = 5
     [java] 0000: 16 03 01 00 20                                     ....
     [java] [Raw read]: length = 32
     [java] 0000: 93 FC D6 43 CF 74 1C 77   26 A8 C6 6A 2E F8 2D 25  ...C.t.w&..j..-%
     [java] 0010: 48 DE FB 5F B0 70 32 C2   DD A9 CC 67 23 E9 3C 57  H.._.p2....g#.<W
     [java] Remoting "config-based-naming-client-endpoint" read-1, READ: TLSv1 Handshake, length = 32
     [java] Padded plaintext after DECRYPTION:  len = 32
     [java] 0000: 14 00 00 0C 4E 55 64 B3   2B BF E4 AB 01 B5 AB 14  ....NUd.+.......
     [java] 0010: 10 0C EC 73 84 96 22 FD   DA 4C 37 6F A6 5E E1 72  ...s.."..L7o.^.r
     [java] *** Finished
     [java] verify_data:  { 78, 85, 100, 179, 43, 191, 228, 171, 1, 181, 171, 20 }
     [java] ***
     [java] %% Cached client session: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
     [java] [read] MD5 and SHA1 hashes:  len = 16
     [java] 0000: 14 00 00 0C 4E 55 64 B3   2B BF E4 AB 01 B5 AB 14  ....NUd.+.......
     [java] Padded plaintext before ENCRYPTION:  len = 61
     [java] 0000: 00 00 00 29 01 00 01 01   03 23 63 6F 6E 66 69 67  ...).....#config
     [java] 0010: 2D 62 61 73 65 64 2D 6E   61 6D 69 6E 67 2D 63 6C  -based-naming-cl
     [java] 0020: 69 65 6E 74 2D 65 6E 64   70 6F 69 6E 74 82 E7 C1  ient-endpoint...
     [java] 0030: AE CB 87 4C 26 91 ED FC   F0 7B 47 27 B7           ...L&.....G'.
     [java] Remoting "config-based-naming-client-endpoint" write-1, WRITE: TLSv1 Application Data, length = 45
     [java] [Raw write (bb)]: length = 66
     [java] 0000: 17 03 01 00 3D 75 A4 86   C8 2D 71 32 D5 2C 6F 2D  ....=u...-q2.,o-
     [java] 0010: C0 DD 74 78 3A BF 10 84   3D 4C CE D7 E1 67 1A C2  ..tx:...=L...g..
     [java] 0020: 16 80 78 E8 37 ED 63 37   42 98 AC 8C CB 29 04 34  ..x.7.c7B....).4
     [java] 0030: 2C 2E 75 CD BA 2F F9 A6   32 3B 41 23 9E 09 72 F3  ,.u../..2;A#..r.
     [java] 0040: 41 AE                                              A.
     [java] [Raw read (bb)]: length = 65
     [java] 0000: 17 03 01 00 3C D8 96 6A   48 29 96 07 23 07 5C 2C  ....<..jH)..#.\,
     [java] 0010: 06 78 1B 5F B5 F5 0A EF   57 05 91 06 60 FC A1 C3  .x._....W...`...
     [java] 0020: CC EB 2A D8 60 90 1A 96   9A 0C 13 53 FE 4B 4B 51  ..*.`......S.KKQ
     [java] 0030: 67 32 1D 3C B9 3B 8F 35   15 E0 86 88 47 2A C6 BA  g2.<.;.5....G*..
     [java] 0040: B8                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 60
     [java] 0000: 00 00 00 28 01 00 01 01   03 09 6C 6F 63 61 6C 68  ...(......localh
     [java] 0010: 6F 73 74 01 10 4A 42 4F   53 53 2D 4C 4F 43 41 4C  ost..JBOSS-LOCAL
     [java] 0020: 2D 55 53 45 52 01 05 50   4C 41 49 4E 3D A2 00 21  -USER..PLAIN=..!
     [java] 0030: BF 3B 29 F3 4D C7 CD BA   5A EF 9E F0              .;).M...Z...
     [java] Padded plaintext before ENCRYPTION:  len = 39
     [java] 0000: 00 00 00 13 02 10 4A 42   4F 53 53 2D 4C 4F 43 41  ......JBOSS-LOCA
     [java] 0010: 4C 2D 55 53 45 52 00 3F   95 38 E7 C9 B4 83 AF B2  L-USER.?.8......
     [java] 0020: 8B 85 96 18 B7 0D 24                               ......$
     [java] Remoting "config-based-naming-client-endpoint" task-1, WRITE: TLSv1 Application Data, length = 23
     [java] [Raw write (bb)]: length = 44
     [java] 0000: 17 03 01 00 27 FF 53 BE   A9 F8 ED 6F 4B A1 0E 5B  ....'.S....oK..[
     [java] 0010: DB 78 8E 8A 86 F1 83 6D   9B 5E AD A0 A6 C5 3E 60  .x.....m.^....>`
     [java] 0020: 4D 3F 12 2A 23 F7 C6 4A   8E CF 05 8C              M?.*#..J....
     [java] [Raw read (bb)]: length = 107
     [java] 0000: 17 03 01 00 66 A4 08 16   81 D7 16 83 1A FC 7C E5  ....f...........
     [java] 0010: C2 10 CD 2B 82 86 56 D0   DF 4E BA A9 76 AC 3A 9C  ...+..V..N..v.:.
     [java] 0020: B6 D0 57 27 27 EC 1F DB   0B 6B FB A5 B3 9C 28 38  ..W''....k....(8
     [java] 0030: C3 FD BC B4 62 B2 93 07   BD 10 79 B9 17 24 D9 ED  ....b.....y..$..
     [java] 0040: B1 07 4D 0D E7 9B 35 98   60 9A CF C5 1D 57 AB 46  ..M...5.`....W.F
     [java] 0050: E4 36 B1 5B 74 09 D1 6A   A4 4B 22 3E 3F DD 15 24  .6.[t..j.K">?..$
     [java] 0060: 12 89 CF 8D 91 82 72 4E   BB 0C 2E                 ......rN...
     [java] Padded plaintext after DECRYPTION:  len = 102
     [java] 0000: 00 00 00 52 03 2F 4E 6F   74 42 61 63 6B 65 64 55  ...R./NotBackedU
     [java] 0010: 70 2F 4A 42 6F 73 73 5F   41 6C 6C 2F 6A 62 6F 73  p/JBoss_All/jbos
     [java] 0020: 73 2D 61 73 2D 37 2E 31   2E 31 2E 46 69 6E 61 6C  s-as-7.1.1.Final
     [java] 0030: 2F 73 74 61 6E 64 61 6C   6F 6E 65 2F 74 6D 70 2F  /standalone/tmp/
     [java] 0040: 61 75 74 68 2F 63 68 61   6C 6C 65 6E 67 65 2D 37  auth/challenge-7
     [java] 0050: 31 32 31 33 33 38 A6 85   E0 13 12 99 64 8E 55 DE  121338......d.U.
     [java] 0060: 72 E0 02 57 03 EA                                  r..W..
     [java] Padded plaintext before ENCRYPTION:  len = 37
     [java] 0000: 00 00 00 11 04 27 5C AF   3C 2F F7 0E DF 65 6A 62  .....'\.</...ejb
     [java] 0010: 55 73 65 72 00 E7 D1 02   83 DD 0A 00 76 F4 FF 8B  User........v...
     [java] 0020: 37 D7 5A 37 19                                     7.Z7.
     [java] Remoting "config-based-naming-client-endpoint" task-2, WRITE: TLSv1 Application Data, length = 21
     [java] [Raw write (bb)]: length = 42
     [java] 0000: 17 03 01 00 25 DF 28 09   7B FA 47 98 07 46 14 18  ....%.(...G..F..
     [java] 0010: BE DD 48 0F AE 89 1B CB   25 A9 14 06 F7 5E B5 0C  ..H.....%....^..
     [java] 0020: 5B 24 4E CA 59 51 38 EE   6F 7F                    [$N.YQ8.o.
     [java] [Raw read (bb)]: length = 26
     [java] 0000: 17 03 01 00 15 21 39 4C   83 1A EA 6E 4F 8A 52 A8  .....!9L...nO.R.
     [java] 0010: F5 97 65 A7 B6 EC 3A FA   93 02                    ..e...:...
     [java] Padded plaintext after DECRYPTION:  len = 21
     [java] 0000: 00 00 00 01 06 E1 D7 97   B8 A5 FE FE C8 B3 59 E5  ..............Y.
     [java] 0010: 5B C0 59 E5 C4                                     [.Y..
     [java] Padded plaintext before ENCRYPTION:  len = 61
     [java] 0000: 00 00 00 29 01 00 01 01   03 23 63 6F 6E 66 69 67  ...).....#config
     [java] 0010: 2D 62 61 73 65 64 2D 6E   61 6D 69 6E 67 2D 63 6C  -based-naming-cl
     [java] 0020: 69 65 6E 74 2D 65 6E 64   70 6F 69 6E 74 A0 47 BB  ient-endpoint.G.
     [java] 0030: 8A 13 06 99 29 6B 29 F5   A0 5C D4 C8 0B           ....)k)..\...
     [java] Remoting "config-based-naming-client-endpoint" read-1, WRITE: TLSv1 Application Data, length = 45
     [java] [Raw write (bb)]: length = 66
     [java] 0000: 17 03 01 00 3D 78 F6 AF   0E AC 21 D7 35 0A AC 0B  ....=x....!.5...
     [java] 0010: C1 E2 1B BF DB 40 AE 0A   30 35 6F 8F 33 4E 0E 7D  .....@..05o.3N..
     [java] 0020: 7B FA 3E 5F 84 DF 59 E6   2B DC 6A 27 08 63 1B 3D  ..>_..Y.+.j'.c.=
     [java] 0030: 12 CB F8 5B 46 60 F5 4D   17 C3 86 0B 28 C8 EF C5  ...[F`.M....(...
     [java] 0040: 09 BD                                              ..
     [java] [Raw read (bb)]: length = 65
     [java] 0000: 17 03 01 00 3C BB 3D 70   B6 2C DE 60 98 50 B2 47  ....<.=p.,.`.P.G
     [java] 0010: 6F 3A 7F 71 13 34 C8 A1   61 9C EB 0E 3C DA 7A 93  o:.q.4..a...<.z.
     [java] 0020: F4 BD 73 DC 82 16 43 9E   4B 47 CE 15 D9 F3 1D ED  ..s...C.KG......
     [java] 0030: 83 DF 5C 12 E6 9B B6 E0   80 42 A0 65 A2 3E A4 42  ..\......B.e.>.B
     [java] 0040: 5B                                                 [
     [java] Padded plaintext after DECRYPTION:  len = 60
     [java] 0000: 00 00 00 28 01 00 01 01   03 09 6C 6F 63 61 6C 68  ...(......localh
     [java] 0010: 6F 73 74 01 10 4A 42 4F   53 53 2D 4C 4F 43 41 4C  ost..JBOSS-LOCAL
     [java] 0020: 2D 55 53 45 52 01 05 50   4C 41 49 4E 9E 62 E4 4A  -USER..PLAIN.b.J
     [java] 0030: 3F 42 22 C1 85 70 1B DF   B9 80 B2 E9              ?B"..p......
     [java] Padded plaintext before ENCRYPTION:  len = 47
     [java] 0000: 00 00 00 1B 02 05 50 4C   41 49 4E 00 65 6A 62 55  ......PLAIN.ejbU
     [java] 0010: 73 65 72 00 65 6A 62 50   61 73 73 77 6F 72 64 F0  ser.ejbPassword.
     [java] 0020: 6B EB 0A 8B 7E E6 41 FB   DB CD D4 B1 A2 46 79     k.....A......Fy
     [java] Remoting "config-based-naming-client-endpoint" task-3, WRITE: TLSv1 Application Data, length = 31
     [java] [Raw write (bb)]: length = 52
     [java] 0000: 17 03 01 00 2F B2 75 CA   90 12 CC BA A2 51 C8 82  ..../.u......Q..
     [java] 0010: 2A 12 BB 12 4A 81 2B 9D   8B F3 DD C8 A0 BC 23 12  *...J.+.......#.
     [java] 0020: D3 0B B9 81 6E E8 7B C4   F5 41 E0 47 0A 0C DA 8D  ....n....A.G....
     [java] 0030: 61 CD FF 49                                        a..I
     [java] [Raw read (bb)]: length = 26
     [java] 0000: 17 03 01 00 15 EB F5 9F   8F 1D 42 41 A5 A7 0D FF  ..........BA....
     [java] 0010: 3A A1 F7 10 BD 69 8B 89   2A 94                    :....i..*.
     [java] Padded plaintext after DECRYPTION:  len = 21
     [java] 0000: 00 00 00 01 05 CF 4F B1   73 4C 25 16 6B 44 C8 1B  ......O.sL%.kD..
     [java] 0010: 46 C0 2B 8F D6                                     F.+..
     [java] Padded plaintext before ENCRYPTION:  len = 54
     [java] 0000: 00 00 00 22 10 89 FB 8F   55 01 06 6E 61 6D 69 6E  ..."....U..namin
     [java] 0010: 67 80 04 00 00 40 00 81   02 00 50 82 04 7F FF FF  g....@....P.....
     [java] 0020: FF 83 02 FF FF 00 21 92   8C 03 7D F4 0A 46 55 0A  ......!......FU.
     [java] 0030: F1 87 84 8D E6 C8                                  ......
     [java] main, WRITE: TLSv1 Application Data, length = 38
     [java] [Raw write (bb)]: length = 59
     [java] 0000: 17 03 01 00 36 9F E0 0B   F0 2D 06 09 EC 25 C7 80  ....6....-...%..
     [java] 0010: FD A3 DA AD 0E B8 6D 07   70 3F 37 88 28 3E 7B 25  ......m.p?7.(>.%
     [java] 0020: EA AF 4F 93 A9 74 A6 09   00 96 25 A5 46 E7 14 29  ..O..t....%.F..)
     [java] 0030: FF F6 A9 83 96 58 56 7E   71 81 34                 .....XV.q.4
     [java] [Raw read (bb)]: length = 41
     [java] 0000: 17 03 01 00 24 A1 AE 75   CA 78 DC EA 21 DD 6E B9  ....$..u.x..!.n.
     [java] 0010: BE F5 4A E1 31 ED 4D 05   A9 DE F8 75 5E 2D D0 61  ..J.1.M....u^-.a
     [java] 0020: 91 24 10 BA 76 DE 4E FD   F1                       .$..v.N..
     [java] Padded plaintext after DECRYPTION:  len = 36
     [java] 0000: 00 00 00 10 11 09 FB 8F   55 80 04 00 00 40 00 81  ........U....@..
     [java] 0010: 02 00 50 00 FE 8D 7C A1   A3 8A F2 B1 1B 80 50 06  ..P...........P.
     [java] 0020: 57 3F 5B D7                                        W?[.
     [java] [Raw read (bb)]: length = 41
     [java] 0000: 17 03 01 00 24 7E 57 CA   E6 5C BC 3E B4 A9 87 F9  ....$.W..\.>....
     [java] 0010: BC 62 E1 BE A3 7E FD 70   F2 A3 B5 A9 81 A9 48 B4  .b.....p......H.
     [java] 0020: 99 DF 62 97 CE 00 85 2E   A2                       ..b......
     [java] Padded plaintext after DECRYPTION:  len = 36
     [java] 0000: 00 00 00 10 30 09 FB 8F   55 69 72 02 6E 61 6D 69  ....0...Uir.nami
     [java] 0010: 6E 67 01 01 06 41 C1 F3   2E B0 A9 CF B8 F0 92 75  ng...A.........u
     [java] 0020: DE 6E 34 2D                                        .n4-
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C AF 18 D2   55 55 95 27 1A 93 00 97  ........UU.'....
     [java] 0010: 92 74 2E FA 26 65 96 47   F0 ED 83 76 7C 0F CF 31  .t..&e.G...v...1
     [java] 0020: C4                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 09 FB 8F   55 69 72 01 EB 9A 2F 82  ....0...Uir.../.
     [java] 0010: BE C3 91 92 A6 0B 2B C1   17 49 F5 11              ......+..I..
     [java] Padded plaintext before ENCRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 89 FB 8F   55 69 72 00 00 00 10 21  ....1...Uir....!
     [java] 0010: 44 FF 52 8E 51 EE AB 75   37 78 1F 29 3C CA 85     D.R.Q..u7x.)<..
     [java] Remoting "config-based-naming-client-endpoint" task-1, WRITE: TLSv1 Application Data, length = 15
     [java] [Raw write (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F 13 DD DD   ED 67 B3 9D 70 51 4A 1A  .........g..pQJ.
     [java] 0010: B2 02 F1 1B ED 37 F1 DA   58 0C 43 66 A0 33 74 48  .....7..X.Cf.3tH
     [java] 0020: FB F5 F8 15                                        ....
     [java] Padded plaintext before ENCRYPTION:  len = 35
     [java] 0000: 00 00 00 0F 30 89 FB 8F   55 6A E0 02 6E 61 6D 69  ....0...Uj..nami
     [java] 0010: 6E 67 01 5D C1 D3 D3 15   5D B2 71 D8 C8 F3 B8 F1  ng.]....].q.....
     [java] 0020: DB 83 DB                                           ...
     [java] main, WRITE: TLSv1 Application Data, length = 19
     [java] [Raw write (bb)]: length = 40
     [java] 0000: 17 03 01 00 23 97 D9 7C   15 4E 92 1F BA D9 46 BA  ....#....N....F.
     [java] 0010: 99 4E 57 35 33 1B 44 7B   40 2E 8F 5E E2 B9 2D 82  .NW53.D.@..^..-.
     [java] 0020: 70 BA 0D 9E 3C F4 81 BB                            p...<...
     [java] Padded plaintext before ENCRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 89 FB 8F   55 6A E0 01 10 D4 FD A2  ....0...Uj......
     [java] 0010: 33 C8 42 16 32 EB 84 89   7F F8 29 5D              3.B.2.....)]
     [java] main, WRITE: TLSv1 Application Data, length = 12
     [java] [Raw write (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C DC B6 87   31 40 6F B8 95 89 CF C8  ........1@o.....
     [java] 0010: 30 F0 09 DB CE CA 3D A3   01 92 65 D2 8E 8D CE F2  0.....=...e.....
     [java] 0020: 3C                                                 <
     [java] [Raw read (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F 55 F2 3F   1B 5B 01 AC 0E 15 00 02  .....U.?.[......
     [java] 0010: 3D 92 E8 17 98 7C 96 C1   13 1C 27 B6 CE 91 F8 DA  =.........'.....
     [java] 0020: 41 AB BB 22                                        A.."
     [java] Padded plaintext after DECRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 09 FB 8F   55 6A E0 00 00 00 0F 7F  ....1...Uj......
     [java] 0010: 9A 0D 99 A8 64 40 D1 DE   39 CF 96 16 A4 83 77     ....d@..9.....w
     [java] Using SSLEngineImpl.
     [java] %% Client cached [Session-1, SSL_RSA_WITH_RC4_128_MD5]
     [java] %% Try resuming [Session-1, SSL_RSA_WITH_RC4_128_MD5] from port -1
     [java] *** ClientHello, TLSv1
     [java] RandomCookie:  GMT: 1324357980 bytes = { 130, 188, 205, 110, 140, 21, 112, 88, 211, 129, 209, 98, 71, 129, 207, 70, 168, 102, 10, 186, 64, 77, 105, 50, 96, 173, 151, 226 }
     [java] Session ID:  {79, 240, 25, 92, 208, 245, 54, 185, 244, 167, 173, 254, 199, 156, 131, 100, 116, 186, 115, 92, 209, 1, 8, 181, 180, 136, 152, 212, 113, 81, 208, 168}
     [java] Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
     [java] Compression Methods:  { 0 }
     [java] ***
     [java] [write] MD5 and SHA1 hashes:  len = 105
     [java] 0000: 01 00 00 65 03 01 4F F0   19 5C 82 BC CD 6E 8C 15  ...e..O..\...n..
     [java] 0010: 70 58 D3 81 D1 62 47 81   CF 46 A8 66 0A BA 40 4D  pX...bG..F.f..@M
     [java] 0020: 69 32 60 AD 97 E2 20 4F   F0 19 5C D0 F5 36 B9 F4  i2`... O..\..6..
     [java] 0030: A7 AD FE C7 9C 83 64 74   BA 73 5C D1 01 08 B5 B4  ......dt.s\.....
     [java] 0040: 88 98 D4 71 51 D0 A8 00   1E 00 04 00 05 00 2F 00  ...qQ........./.
     [java] 0050: 33 00 32 00 0A 00 16 00   13 00 09 00 15 00 12 00  3.2.............
     [java] 0060: 03 00 08 00 14 00 11 01   00                       .........
     [java] Remoting "config-based-ejb-client-endpoint" read-1, WRITE: TLSv1 Handshake, length = 105
     [java] [Raw write]: length = 110
     [java] 0000: 16 03 01 00 69 01 00 00   65 03 01 4F F0 19 5C 82  ....i...e..O..\.
     [java] 0010: BC CD 6E 8C 15 70 58 D3   81 D1 62 47 81 CF 46 A8  ..n..pX...bG..F.
     [java] 0020: 66 0A BA 40 4D 69 32 60   AD 97 E2 20 4F F0 19 5C  f..@Mi2`... O..\
     [java] 0030: D0 F5 36 B9 F4 A7 AD FE   C7 9C 83 64 74 BA 73 5C  ..6........dt.s\
     [java] 0040: D1 01 08 B5 B4 88 98 D4   71 51 D0 A8 00 1E 00 04  ........qQ......
     [java] 0050: 00 05 00 2F 00 33 00 32   00 0A 00 16 00 13 00 09  .../.3.2........
     [java] 0060: 00 15 00 12 00 03 00 08   00 14 00 11 01 00        ..............
     [java] [Raw read]: length = 5
     [java] 0000: 16 03 01 00 4A                                     ....J
     [java] [Raw read]: length = 74
     [java] 0000: 02 00 00 46 03 01 4F F0   19 5C E3 AE A8 26 DF 91  ...F..O..\...&..
     [java] 0010: D2 6F 29 26 F5 FA EC 94   58 BE 2B C3 AE B3 13 4E  .o)&....X.+....N
     [java] 0020: 4B 5F 3D 82 D9 30 20 4F   F0 19 5C D0 F5 36 B9 F4  K_=..0 O..\..6..
     [java] 0030: A7 AD FE C7 9C 83 64 74   BA 73 5C D1 01 08 B5 B4  ......dt.s\.....
     [java] 0040: 88 98 D4 71 51 D0 A8 00   04 00                    ...qQ.....
     [java] Remoting "config-based-ejb-client-endpoint" write-1, READ: TLSv1 Handshake, length = 74
     [java] *** ServerHello, TLSv1
     [java] RandomCookie:  GMT: 1324357980 bytes = { 227, 174, 168, 38, 223, 145, 210, 111, 41, 38, 245, 250, 236, 148, 88, 190, 43, 195, 174, 179, 19, 78, 75, 95, 61, 130, 217, 48 }
     [java] Session ID:  {79, 240, 25, 92, 208, 245, 54, 185, 244, 167, 173, 254, 199, 156, 131, 100, 116, 186, 115, 92, 209, 1, 8, 181, 180, 136, 152, 212, 113, 81, 208, 168}
     [java] Cipher Suite: SSL_RSA_WITH_RC4_128_MD5
     [java] Compression Method: 0
     [java] ***
     [java] CONNECTION KEYGEN:
     [java] Client Nonce:
     [java] 0000: 4F F0 19 5C 82 BC CD 6E   8C 15 70 58 D3 81 D1 62  O..\...n..pX...b
     [java] 0010: 47 81 CF 46 A8 66 0A BA   40 4D 69 32 60 AD 97 E2  G..F.f..@Mi2`...
     [java] Server Nonce:
     [java] 0000: 4F F0 19 5C E3 AE A8 26   DF 91 D2 6F 29 26 F5 FA  O..\...&...o)&..
     [java] 0010: EC 94 58 BE 2B C3 AE B3   13 4E 4B 5F 3D 82 D9 30  ..X.+....NK_=..0
     [java] Master Secret:
     [java] 0000: 35 92 7D A3 EE 1F BB 07   76 8A FF 49 52 F9 0D 6E  5.......v..IR..n
     [java] 0010: D6 03 08 2C D3 1D F8 4B   E5 A8 1A 22 FA 20 A0 56  ...,...K...". .V
     [java] 0020: 69 18 08 57 99 A0 8B 9F   CA 32 1A 09 9D E9 49 BA  i..W.....2....I.
     [java] Client MAC write Secret:
     [java] 0000: 88 A4 AF 0D DE 12 24 F9   56 FE 54 B5 0D 29 35 96  ......$.V.T..)5.
     [java] Server MAC write Secret:
     [java] 0000: 3E 4C 99 6E 80 54 11 73   EA 36 0E 20 9F 51 75 FE  >L.n.T.s.6. .Qu.
     [java] Client write key:
     [java] 0000: FD 0D DE 0D 47 15 A1 25   33 CB 01 F4 FA F5 D9 36  ....G..%3......6
     [java] Server write key:
     [java] 0000: 5B 25 61 41 A1 18 73 52   A3 4D 24 97 11 DC 46 DB  [%aA..sR.M$...F.
     [java] ... no IV used for this cipher
     [java] %% Server resumed [Session-1, SSL_RSA_WITH_RC4_128_MD5]
     [java] [read] MD5 and SHA1 hashes:  len = 74
     [java] 0000: 02 00 00 46 03 01 4F F0   19 5C E3 AE A8 26 DF 91  ...F..O..\...&..
     [java] 0010: D2 6F 29 26 F5 FA EC 94   58 BE 2B C3 AE B3 13 4E  .o)&....X.+....N
     [java] 0020: 4B 5F 3D 82 D9 30 20 4F   F0 19 5C D0 F5 36 B9 F4  K_=..0 O..\..6..
     [java] 0030: A7 AD FE C7 9C 83 64 74   BA 73 5C D1 01 08 B5 B4  ......dt.s\.....
     [java] 0040: 88 98 D4 71 51 D0 A8 00   04 00                    ...qQ.....
     [java] [Raw read]: length = 5
     [java] 0000: 14 03 01 00 01                                     .....
     [java] [Raw read]: length = 1
     [java] 0000: 01                                                 .
     [java] Remoting "config-based-ejb-client-endpoint" read-1, READ: TLSv1 Change Cipher Spec, length = 1
     [java] [Raw read]: length = 5
     [java] 0000: 16 03 01 00 20                                     ....
     [java] [Raw read]: length = 32
     [java] 0000: CB 86 E3 2D 78 29 48 B5   DC E5 E2 C6 24 3C 01 0E  ...-x)H.....$<..
     [java] 0010: 8A 2C B4 B2 1B BD 93 F6   C3 ED AE 0C 3B 8D 16 40  .,..........;..@
     [java] Remoting "config-based-ejb-client-endpoint" read-1, READ: TLSv1 Handshake, length = 32
     [java] Padded plaintext after DECRYPTION:  len = 32
     [java] 0000: 14 00 00 0C A6 54 14 92   28 D8 C9 42 A0 DE 85 86  .....T..(..B....
     [java] 0010: CB D6 E6 65 17 C4 CE 01   7A 5D 8F 01 77 98 BD 79  ...e....z]..w..y
     [java] *** Finished
     [java] verify_data:  { 166, 84, 20, 146, 40, 216, 201, 66, 160, 222, 133, 134 }
     [java] ***
     [java] [read] MD5 and SHA1 hashes:  len = 16
     [java] 0000: 14 00 00 0C A6 54 14 92   28 D8 C9 42 A0 DE 85 86  .....T..(..B....
     [java] Remoting "config-based-ejb-client-endpoint" read-1, WRITE: TLSv1 Change Cipher Spec, length = 1
     [java] *** Finished
     [java] verify_data:  { 117, 252, 119, 85, 231, 194, 129, 157, 212, 138, 87, 19 }
     [java] ***
     [java] [write] MD5 and SHA1 hashes:  len = 16
     [java] 0000: 14 00 00 0C 75 FC 77 55   E7 C2 81 9D D4 8A 57 13  ....u.wU......W.
     [java] Padded plaintext before ENCRYPTION:  len = 32
     [java] 0000: 14 00 00 0C 75 FC 77 55   E7 C2 81 9D D4 8A 57 13  ....u.wU......W.
     [java] 0010: 6F CD B0 E6 95 CC 44 F9   57 C9 8F FC 1B 5D CA B8  o.....D.W....]..
     [java] Remoting "config-based-ejb-client-endpoint" read-1, WRITE: TLSv1 Handshake, length = 32
     [java] [Raw write]: length = 6
     [java] 0000: 14 03 01 00 01 01                                  ......
     [java] [Raw write]: length = 37
     [java] 0000: 16 03 01 00 20 27 82 C7   5C C8 10 23 18 69 25 7A  .... '..\..#.i%z
     [java] 0010: 9C DB C1 7B A1 9F E7 57   25 DC 19 96 77 AD BA BB  .......W%...w...
     [java] 0020: A3 77 FB B5 23                                     .w..#
     [java] Padded plaintext before ENCRYPTION:  len = 58
     [java] 0000: 00 00 00 26 01 00 01 01   03 20 63 6F 6E 66 69 67  ...&..... config
     [java] 0010: 2D 62 61 73 65 64 2D 65   6A 62 2D 63 6C 69 65 6E  -based-ejb-clien
     [java] 0020: 74 2D 65 6E 64 70 6F 69   6E 74 F4 3D E2 3A 6C E1  t-endpoint.=.:l.
     [java] 0030: 01 AE AF 29 6B 7B 4F 6A   8F 21                    ...)k.Oj.!
     [java] Remoting "config-based-ejb-client-endpoint" write-1, WRITE: TLSv1 Application Data, length = 42
     [java] [Raw write (bb)]: length = 63
     [java] 0000: 17 03 01 00 3A 32 64 61   53 71 1E C4 34 DB 3F C8  ....:2daSq..4.?.
     [java] 0010: 4A 06 04 4D 1D BC 45 6F   22 49 58 C0 37 57 84 DD  J..M..Eo"IX.7W..
     [java] 0020: 17 ED 6D 2B A1 70 66 53   5C 34 A5 C0 A8 83 00 CA  ..m+.pfS\4......
     [java] 0030: EF F3 E2 B5 00 11 44 36   93 2E 16 9C 3A 58 4A     ......D6....:XJ
     [java] [Raw read (bb)]: length = 65
     [java] 0000: 17 03 01 00 3C 64 50 68   29 8E 9B 76 65 5F 82 92  ....<dPh)..ve_..
     [java] 0010: 17 9D CE 0D 34 14 15 CA   0B 06 C3 9E E4 28 68 31  ....4........(h1
     [java] 0020: 03 D8 16 63 86 F4 A9 B1   D0 FD 4F 48 8D AB D6 BD  ...c......OH....
     [java] 0030: 4D C5 DA 60 12 FD 04 97   A2 63 D0 90 12 13 65 34  M..`.....c....e4
     [java] 0040: AD                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 60
     [java] 0000: 00 00 00 28 01 00 01 01   03 09 6C 6F 63 61 6C 68  ...(......localh
     [java] 0010: 6F 73 74 01 10 4A 42 4F   53 53 2D 4C 4F 43 41 4C  ost..JBOSS-LOCAL
     [java] 0020: 2D 55 53 45 52 01 05 50   4C 41 49 4E F0 EA 13 28  -USER..PLAIN...(
     [java] 0030: C3 98 14 5F 2C C8 8C F7   35 7B B8 60              ..._,...5..`
     [java] Jul 1, 2012 3:03:16 PM org.jboss.remoting3.remote.RemoteConnection handleException
     [java] ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Cannot get userid/password [Caused by javax.security.auth.callback.UnsupportedCallbackException]
     [java] Remoting "config-based-ejb-client-endpoint" read-1, called closeInbound()
     [java] Remoting "config-based-ejb-client-endpoint" read-1, fatal error: 80: Inbound closed before receiving peer's close_notify: possible truncation attack?
     [java] javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?
     [java] %% Invalidated:  [Session-1, SSL_RSA_WITH_RC4_128_MD5]
     [java] Remoting "config-based-ejb-client-endpoint" read-1, SEND TLSv1 ALERT:  fatal, description = internal_error
     [java] Padded plaintext before ENCRYPTION:  len = 18
     [java] 0000: 02 50 A8 09 37 E3 6B D0   95 39 50 3B 5E A8 95 FD  .P..7.k..9P;^...
     [java] 0010: 09 6D                                              .m
     [java] Remoting "config-based-ejb-client-endpoint" read-1, WRITE: TLSv1 Alert, length = 18
     [java] Padded plaintext before ENCRYPTION:  len = 57
     [java] 0000: 00 00 00 25 10 BD B6 21   6F 01 09 6A 62 6F 73 73  ...%...!o..jboss
     [java] 0010: 2E 65 6A 62 80 04 00 00   40 00 81 02 00 50 82 04  .ejb....@....P..
     [java] 0020: 7F FF FF FF 83 02 FF FF   00 FA 9E 75 C7 C5 02 96  ...........u....
     [java] 0030: BA F6 8D 4D 82 0F E2 33   34                       ...M...34
     [java] main, WRITE: TLSv1 Application Data, length = 41
     [java] [Raw write (bb)]: length = 62
     [java] 0000: 17 03 01 00 39 65 24 10   57 64 42 BB 44 00 AF 82  ....9e$.WdB.D...
     [java] 0010: 70 CE B7 9B 90 38 72 A5   6F D4 7A 5E BC 28 1B FC  p....8r.o.z^.(..
     [java] 0020: CE 88 FF C4 DA 25 7E 40   75 CA 10 EF BC 29 06 AC  .....%.@u....)..
     [java] 0030: 42 8E B0 52 15 E7 DF 0E   EE E7 1E 17 E5 19        B..R..........
     [java] [Raw read (bb)]: length = 41
     [java] 0000: 17 03 01 00 24 C4 BF BF   15 67 2E C4 F6 D1 F2 3E  ....$....g.....>
     [java] 0010: 22 D5 9F 0D 8A 5F B5 E9   2D 0D AB CC 9A 03 C8 0F  "...._..-.......
     [java] 0020: 75 A6 D6 51 31 8C AD FD   9E                       u..Q1....
     [java] Padded plaintext after DECRYPTION:  len = 36
     [java] 0000: 00 00 00 10 11 3D B6 21   6F 80 04 00 00 40 00 81  .....=.!o....@..
     [java] 0010: 02 00 50 00 F0 4C 13 50   F7 6C 9D D4 43 6F BF 1B  ..P..L.P.l..Co..
     [java] 0020: 2A 34 0E 36                                        *4.6
     [java] [Raw read (bb)]: length = 42
     [java] 0000: 17 03 01 00 25 CF 0E 4D   E1 2F DD 8F 6A 47 87 F1  ....%..M./..jG..
     [java] 0010: DC 75 68 78 C1 93 29 A7   B2 45 10 E9 01 1E B5 3B  .uhx..)..E.....;
     [java] 0020: 53 F1 81 DC 41 32 EC E4   55 21                    S...A2..U!
     [java] Padded plaintext after DECRYPTION:  len = 37
     [java] 0000: 00 00 00 11 30 3D B6 21   6F 93 64 02 01 01 00 05  ....0=.!o.d.....
     [java] 0010: 72 69 76 65 72 B7 8A 2F   AA 47 B8 2C 0B 61 8C 40  river../.G.,.a.@
     [java] 0020: DB A4 B7 72 90                                     ...r.
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C A2 36 DA   89 9A 66 06 CB 44 CE 99  ......6...f..D..
     [java] 0010: 77 C4 05 3A 61 A5 8F EC   CA F6 73 C9 08 DC 2A 30  w..:a.....s...*0
     [java] 0020: FF                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 3D B6 21   6F 93 64 01 E0 96 EB B5  ....0=.!o.d.....
     [java] 0010: B6 F5 7C ED 94 54 93 38   06 97 5C 0E              .....T.8..\.
     [java] Padded plaintext before ENCRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 BD B6 21   6F 93 64 00 00 00 11 3B  ....1..!o.d....;
     [java] 0010: B4 B4 47 F1 D2 C5 33 AC   42 B2 9F 6F F8 B7 70     ..G...3.B..o..p
     [java] Remoting "config-based-naming-client-endpoint" task-3, WRITE: TLSv1 Application Data, length = 15
     [java] [Raw write (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F 8B 71 8F   FA 1C FC AC C4 7B D7 CF  ......q.........
     [java] 0010: 23 92 CB 64 C7 B9 15 9A   B0 EF 7E 13 4A 73 FE A1  #..d........Js..
     [java] 0020: DA BD 0D 55                                        ...U
     [java] Padded plaintext before ENCRYPTION:  len = 36
     [java] 0000: 00 00 00 10 30 BD B6 21   6F 68 A2 02 01 00 05 72  ....0..!oh.....r
     [java] 0010: 69 76 65 72 AC C6 BF FE   A2 FC 7F 7E 95 5E 08 80  iver.........^..
     [java] 0020: 5D B5 5B 75                                        ].[u
     [java] Remoting "config-based-naming-client-endpoint" task-3, WRITE: TLSv1 Application Data, length = 20
     [java] [Raw write (bb)]: length = 41
     [java] 0000: 17 03 01 00 24 EE 99 F6   8E 1E ED 1B B3 30 92 6C  ....$........0.l
     [java] 0010: B5 AF 21 7E 41 38 4A 87   78 43 7A 65 A4 D6 CD 21  ..!.A8J.xCze...!
     [java] 0020: D4 01 51 57 97 35 50 61   B3                       ..QW.5Pa.
     [java] [Raw read (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F 85 30 13   2D A8 38 28 34 DE 8B 7A  ......0.-.8(4..z
     [java] 0010: DB 15 26 33 44 A4 87 BB   FB 0C 30 D8 C8 75 0E 32  ..&3D.....0..u.2
     [java] 0020: 00 D2 17 3C                                        ...<
     [java] Padded plaintext after DECRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 3D B6 21   6F 68 A2 00 00 00 10 03  ....1=.!oh......
     [java] 0010: BC 8F 14 E1 B5 DE BB BD   BC 58 70 80 BC 0D 3B     .........Xp...;
     [java] Padded plaintext before ENCRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 BD B6 21   6F 68 A2 01 1D BF 50 2A  ....0..!oh....P*
     [java] 0010: 81 79 C9 0E 69 E0 14 D2   EF 6E 0C 4D              .y..i....n.M
     [java] Remoting "config-based-naming-client-endpoint" task-3, WRITE: TLSv1 Application Data, length = 12
     [java] [Raw write (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C 08 ED 9C   D1 93 8F B2 D5 35 68 57  .............5hW
     [java] 0010: E3 29 F2 F8 46 9E 9A 0E   AB D0 3D 66 76 17 1A E9  .)..F.....=fv...
     [java] 0020: 6A                                                 j
     [java] [Raw read (bb)]: length = 219
     [java] 0000: 17 03 01 00 D6 24 6F D6   81 4E F9 CC F9 F2 09 DF  .....$o..N......
     [java] 0010: 70 52 CD 12 19 BE DB 6C   99 DD 4D 65 BD 5A 29 B7  pR.....l..Me.Z).
     [java] 0020: DB DE BF 27 F5 09 1A 0C   ED D4 D1 E7 C5 64 01 F5  ...'.........d..
     [java] 0030: 33 B1 06 DD A0 47 88 1F   CC 66 12 12 47 BA 87 B0  3....G...f..G...
     [java] 0040: E5 0A D2 27 E4 5A 03 99   EE 79 BB 29 68 AE C6 46  ...'.Z...y.)h..F
     [java] 0050: 6F 9C 32 F8 03 6F FB 42   B7 88 EE 33 2E 06 1E 29  o.2..o.B...3...)
     [java] 0060: 98 AC 2F C2 13 61 9D F8   79 0C 72 ED 8D 71 6B 5D  ../..a..y.r..qk]
     [java] 0070: 46 15 C7 2F F8 E0 F3 54   A4 AD 74 A8 21 02 E1 CB  F../...T..t.!...
     [java] 0080: 6B 44 E4 E4 01 6B ED DA   18 E9 EE 3C E7 2A B3 04  kD...k.....<.*..
     [java] 0090: 37 1F 87 E5 84 35 4E 70   84 74 F5 F9 11 D3 B9 80  7....5Np.t......
     [java] 00A0: DD EA CD 18 A0 19 D5 E7   D4 59 1C 07 EE C8 81 7D  .........Y......
     [java] 00B0: 21 A1 91 48 5D B0 D4 2E   21 74 28 0E E4 F3 4C F6  !..H]...!t(...L.
     [java] 00C0: 86 FB A1 DF 7B 38 86 85   24 91 13 33 94 29 D5 A0  .....8..$..3.)..
     [java] 00D0: EA DE 9B AB 24 33 6F 5D   A4 D7 B5                 ....$3o]...
     [java] Padded plaintext after DECRYPTION:  len = 214
     [java] 0000: 00 00 00 C2 30 3D B6 21   6F 68 4E 02 08 06 00 00  ....0=.!ohN.....
     [java] 0010: 00 19 4A 50 41 5F 57 69   74 68 5F 4A 41 58 52 53  ..JPA_With_JAXRS
     [java] 0020: 5F 42 41 53 49 43 5F 44   65 6D 6F 00 00 00 00 00  _BASIC_Demo.....
     [java] 0030: 17 41 70 70 6C 69 63 61   74 69 6F 6E 4C 65 76 65  .ApplicationLeve
     [java] 0040: 6C 4A 4D 53 44 65 6D 6F   00 00 00 06 6A 73 72 2D  lJMSDemo....jsr-
     [java] 0050: 37 37 00 06 6A 73 72 2D   37 37 00 00 00 10 54 65  77..jsr-77....Te
     [java] 0060: 73 74 52 65 6D 6F 74 65   45 4A 42 45 41 52 00 10  stRemoteEJBEAR..
     [java] 0070: 54 65 73 74 52 65 6D 6F   74 65 45 4A 42 45 41 52  TestRemoteEJBEAR
     [java] 0080: 00 00 00 10 54 65 73 74   52 65 6D 6F 74 65 45 4A  ....TestRemoteEJ
     [java] 0090: 42 45 41 52 00 09 72 65   6D 6F 74 65 45 4A 42 00  BEAR..remoteEJB.
     [java] 00A0: 00 00 00 00 1F 6D 79 73   71 6C 2D 63 6F 6E 6E 65  .....mysql-conne
     [java] 00B0: 63 74 6F 72 2D 6A 61 76   61 2D 35 2E 31 2E 31 33  ctor-java-5.1.13
     [java] 00C0: 2D 62 69 6E 00 00 E7 3A   39 59 F9 59 6C 75 B4 D9  -bin...:9Y.Ylu..
     [java] 00D0: 0A 9D EA 59 E3 40                                  ...Y.@
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C 83 19 A5   9A 47 E6 B6 2B 8B 70 AB  .........G..+.p.
     [java] 0010: DF BF 50 92 1D 7C 43 C4   BA E2 B3 F1 EC FD 98 54  ..P...C........T
     [java] 0020: 66                                                 f
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 3D B6 21   6F 68 4E 01 D0 8E E4 B2  ....0=.!ohN.....
     [java] 0010: BC 45 6B FA 6B 01 C1 5C   BE 08 FF 52              .Ek.k..\...R
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C 12 20 03   68 C3 9E 74 07 1B BA 21  ...... .h..t...!
     [java] 0010: 06 AE 3F C7 EB 38 9B E8   5D 09 8D AB 4E 13 21 09  ..?..8..]...N.!.
     [java] 0020: E8                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 3D B6 21   6F 33 AA 02 4F 99 C5 C4  ....0=.!o3..O...
     [java] 0010: AC D5 C9 16 51 2E 1D 61   6A 97 30 CB              ....Q..aj.0.
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C 70 6A E2   C8 13 80 34 D4 A6 DD 84  .....pj....4....
     [java] 0010: FD 4D F8 42 50 AE 61 6D   5B B5 1D 23 DA 2B E7 B1  .M.BP.am[..#.+..
     [java] 0020: BE                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 3D B6 21   6F 33 AA 01 1D 07 77 8D  ....0=.!o3....w.
     [java] 0010: 75 A8 BC 66 A0 5A AB EA   BA 8C 72 BF              u..f.Z....r.
     [java] Padded plaintext before ENCRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 BD B6 21   6F 68 4E 00 00 00 C2 31  ....1..!ohN....1
     [java] 0010: 35 7D 34 B2 0D A9 28 8F   DF 5F D1 41 A4 51 27     5.4...(.._.A.Q'
     [java] Remoting "config-based-naming-client-endpoint" task-4, WRITE: TLSv1 Application Data, length = 15
     [java] [Raw write (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F CA E5 C2   92 8F D3 05 0B 0B 67 20  ..............g
     [java] 0010: 75 6E D1 91 F3 59 EA F0   90 32 87 6E FD 94 9D E1  un...Y...2.n....
     [java] 0020: 15 F9 82 0A                                        ....
     [java] Padded plaintext before ENCRYPTION:  len = 27
     [java] 0000: 00 00 00 07 32 BD B6 21   6F 68 4E 0D 41 22 CB 26  ....2..!ohN.A".&
     [java] 0010: 67 1F D6 72 AC 68 B3 04   35 16 56                 g..r.h..5.V
     [java] Remoting "config-based-naming-client-endpoint" task-4, WRITE: TLSv1 Application Data, length = 11
     [java] [Raw write (bb)]: length = 32
     [java] 0000: 17 03 01 00 1B 66 A4 F8   9F 70 A5 35 8F 31 6E CE  .....f...p.5.1n.
     [java] 0010: D8 4D F4 23 81 48 B6 73   E0 0E 55 F4 91 8D 8A 93  .M.#.H.s..U.....

     [java]
     [java] 	--------------------------
     [java] Got initial Context: javax.naming.InitialContext@214a7a12

     [java] Padded plaintext before ENCRYPTION:  len = 149
     [java] 0000: 00 00 00 81 30 89 FB 8F   55 C6 F2 02 01 00 00 00  ....0...U.......
     [java] 0010: 01 02 00 04 38 00 00 00   1A 6A 61 76 61 78 2E 6E  ....8....javax.n
     [java] 0020: 61 6D 69 6E 67 2E 43 6F   6D 70 6F 73 69 74 65 4E  aming.CompositeN
     [java] 0030: 61 6D 65 17 25 1A 4B 93   D6 7A FE 00 00 00 00 16  ame.%.K..z......
     [java] 0040: 32 04 00 00 00 04 3E 10   54 65 73 74 52 65 6D 6F  2.....>.TestRemo
     [java] 0050: 74 65 45 4A 42 45 41 52   3E 09 72 65 6D 6F 74 65  teEJBEAR>.remote
     [java] 0060: 45 4A 42 3D 3E 1E 43 61   6C 6C 65 72 42 65 61 6E  EJB=>.CallerBean
     [java] 0070: 21 72 65 6D 6F 74 65 2E   43 61 6C 6C 65 72 52 65  !remote.CallerRe
     [java] 0080: 6D 6F 74 65 35 B7 90 36   A1 60 3E 4B 30 5B 74 7E  mote5..6.`>K0[t.
     [java] 0090: 6D 2E 61 1E E4                                     m.a..
     [java] main, WRITE: TLSv1 Application Data, length = 133
     [java] [Raw write (bb)]: length = 154
     [java] 0000: 17 03 01 00 95 44 79 98   7B 5F 40 57 7D 86 DA B7  .....Dy.._@W....
     [java] 0010: 83 E9 68 C4 C2 DA 13 30   07 06 1B DA 55 2E E9 2E  ..h....0....U...
     [java] 0020: 17 69 00 F2 E7 27 3B B0   6D 0B 06 A7 3A 19 12 32  .i...';.m...:..2
     [java] 0030: 26 EF 9E 20 5D 7C 85 47   7C 1E E8 D3 F5 35 45 68  &.. ]..G.....5Eh
     [java] 0040: D1 D6 72 E0 D3 83 C2 CA   AD C9 5E 3B 48 26 BE C3  ..r.......^;H&..
     [java] 0050: B3 70 62 3E 78 A9 C1 D9   2B 63 0E 9D BE F2 1C 4D  .pb>x...+c.....M
     [java] 0060: 0C DE 29 33 31 59 B5 47   99 F2 FB A7 31 18 97 74  ..)31Y.G....1..t
     [java] 0070: A8 D4 CD B4 15 E3 99 BA   E3 57 42 C0 D7 81 96 D4  .........WB.....
     [java] 0080: CF EF 33 3B EF 77 2F BA   C3 9B 3B 8E E0 9F 2B 92  ..3;.w/...;...+.
     [java] 0090: 43 8C 65 4D 15 63 5F DF   87 60                    C.eM.c_..`
     [java] Padded plaintext before ENCRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 89 FB 8F   55 C6 F2 01 DD 66 08 5B  ....0...U....f.[
     [java] 0010: 62 AA 8D CD 24 1D DB BE   74 55 D4 93              b...$...tU..
     [java] main, WRITE: TLSv1 Application Data, length = 12
     [java] [Raw write (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C 46 59 2C   19 D8 EF F1 49 E1 45 23  .....FY,....I.E#
     [java] 0010: B6 AB 60 BB F6 77 10 AF   82 57 5C F5 AD C4 00 E8  ..`..w...W\.....
     [java] 0020: 83                                                 .
     [java] [Raw read (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F F5 D3 5D   94 7C 7C 73 8B E1 6C 7C  .......]...s..l.
     [java] 0010: AE AE 6E FB 1C 88 91 06   AB DC 25 E5 BA 53 AA 05  ..n.......%..S..
     [java] 0020: CA 29 09 C4                                        .)..
     [java] Padded plaintext after DECRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 09 FB 8F   55 C6 F2 00 00 00 81 ED  ....1...U.......
     [java] 0010: E4 16 A1 5E CD 6D 16 1D   85 71 37 BC 97 C8 F7     ...^.m...q7....
     [java] [Raw read (bb)]: length = 506
     [java] 0000: 17 03 01 01 F5 26 C1 8C   8A EF 94 85 F0 30 2E 14  .....&.......0..
     [java] 0010: 55 3D D8 2E D3 8E CB 70   49 5F 2B 94 49 47 6D 6D  U=.....pI_+.IGmm
     [java] 0020: 70 95 9B CB F8 88 00 37   60 CD B6 35 1F 5B 34 6D  p......7`..5.[4m
     [java] 0030: 80 3C 52 32 60 92 49 CD   B5 FB 0E 31 06 12 10 42  .<R2`.I....1...B
     [java] 0040: F5 92 ED 89 B1 D7 F4 F6   16 52 0A 76 93 7D 23 4F  .........R.v..#O
     [java] 0050: 4D 42 A4 5D 0C 45 E2 97   24 FD A4 12 94 73 C1 17  MB.].E..$....s..
     [java] 0060: 55 2D CC 95 AC AB 8C 5F   83 9C 3D 64 51 7E 86 0F  U-....._..=dQ...
     [java] 0070: F8 CD 1D 3C 43 BA 43 AC   36 57 DD E4 E9 E1 6D D4  ...<C.C.6W....m.
     [java] 0080: 03 08 61 8D 9B F5 41 C2   DF 20 08 31 12 F9 63 36  ..a...A.. .1..c6
     [java] 0090: A5 D2 9D 8E B7 F9 A1 80   49 B8 54 CC F9 FA 70 DF  ........I.T...p.
     [java] 00A0: 36 19 E1 CE 5F 96 ED 90   CF 12 3A 51 7D 80 E8 E2  6..._.....:Q....
     [java] 00B0: CA 72 A5 3E 5A A2 25 D3   1C A8 85 A4 73 23 2C 6D  .r.>Z.%.....s#,m
     [java] 00C0: 1D AD 1D A2 6B CF 4B AB   1B 45 67 A1 48 4A 6D F0  ....k.K..Eg.HJm.
     [java] 00D0: 2A 13 5D 2B 9F 76 28 67   3C BC 23 3D A5 E4 E6 C9  *.]+.v(g<.#=....
     [java] 00E0: F2 DD 0F 65 92 F3 06 4E   C8 F8 C5 93 2E 9A 05 CB  ...e...N........
     [java] 00F0: 3A 61 68 D8 72 02 AE BD   3F 5F 43 02 CE 2D 91 23  :ah.r...?_C..-.#
     [java] 0100: 12 EE 36 E1 14 24 26 28   56 FD 3C 27 F5 47 FD B7  ..6..$&(V.<'.G..
     [java] 0110: 66 8A 08 A2 4B F3 31 C1   CE 00 CF F5 03 2E 21 1F  f...K.1.......!.
     [java] 0120: 9E 05 DF 75 61 29 7D 6F   19 7E 68 2B 12 A3 2E 31  ...ua).o..h+...1
     [java] 0130: A1 2B C3 C2 5C 32 38 46   03 4E 1D 0F 62 21 4B 3E  .+..\28F.N..b!K>
     [java] 0140: 63 9C 40 F5 A9 41 B2 D6   45 D4 EA 82 F9 32 80 39  c.@..A..E....2.9
     [java] 0150: 26 05 57 61 A5 0C EF CF   D1 91 C8 6D A9 91 73 7B  &.Wa.......m..s.
     [java] 0160: F9 16 CD 04 D4 55 4C 7D   4C 26 DE 98 81 B8 ED AF  .....UL.L&......
     [java] 0170: C5 03 C9 00 82 B7 E9 3E   F9 AB 00 E4 3B 9A 8C F1  .......>....;...
     [java] 0180: DD 9F BE A0 86 DF 94 B9   6F 8F 45 41 68 E0 F0 11  ........o.EAh...
     [java] 0190: 18 7A AA 8F F1 07 7F 66   A5 01 3E 22 63 5C 19 2E  .z.....f..>"c\..
     [java] 01A0: 66 0C BC 37 80 13 30 ED   94 32 35 A2 FA B5 A2 5C  f..7..0..25....\
     [java] 01B0: 6D 12 F1 E4 E6 81 A5 73   0E 81 73 D5 8F 43 6B C6  m......s..s..Ck.
     [java] 01C0: 8C AF F5 A6 B2 48 92 60   4C 1F D3 88 B6 EF C7 FB  .....H.`L.......
     [java] 01D0: A1 92 FE 55 27 C4 35 CA   B6 B0 D2 A0 00 D8 2C 47  ...U'.5.......,G
     [java] 01E0: C7 3B D1 16 84 70 62 E8   C0 1B B7 64 DF 07 BE 20  .;...pb....d...
     [java] 01F0: 95 03 4C DE 54 BF 36 5D   E9 59                    ..L.T.6].Y
     [java] Padded plaintext after DECRYPTION:  len = 501
     [java] 0000: 00 00 01 E1 30 09 FB 8F   55 47 5C 02 01 00 00 00  ....0...UG\.....
     [java] 0010: 01 00 01 02 04 08 00 00   00 01 00 00 00 13 72 65  ..............re
     [java] 0020: 6D 6F 74 65 2E 43 61 6C   6C 65 72 52 65 6D 6F 74  mote.CallerRemot
     [java] 0030: 65 04 0A 00 00 00 33 6F   72 67 2E 6A 62 6F 73 73  e.....3org.jboss
     [java] 0040: 2E 65 6A 62 2E 63 6C 69   65 6E 74 2E 53 65 72 69  .ejb.client.Seri
     [java] 0050: 61 6C 69 7A 65 64 45 4A   42 49 6E 76 6F 63 61 74  alizedEJBInvocat
     [java] 0060: 69 6F 6E 48 61 6E 64 6C   65 72 DF 1B 78 98 5F 16  ionHandler..x._.
     [java] 0070: BB E4 04 09 00 00 00 28   6F 72 67 2E 6A 62 6F 73  .......(org.jbos
     [java] 0080: 73 2E 65 6A 62 2E 63 6C   69 65 6E 74 2E 53 74 61  s.ejb.client.Sta
     [java] 0090: 74 65 6C 65 73 73 45 4A   42 4C 6F 63 61 74 6F 72  telessEJBLocator
     [java] 00A0: D5 CF 9C 76 5F F2 DB 52   00 00 00 00 09 00 00 00  ...v_..R........
     [java] 00B0: 1F 6F 72 67 2E 6A 62 6F   73 73 2E 65 6A 62 2E 63  .org.jboss.ejb.c
     [java] 00C0: 6C 69 65 6E 74 2E 45 4A   42 4C 6F 63 61 74 6F 72  lient.EJBLocator
     [java] 00D0: 9A 9A F5 E4 24 8F EC 1C   00 00 00 06 00 00 00 08  ....$...........
     [java] 00E0: 61 66 66 69 6E 69 74 79   09 00 00 00 1D 6F 72 67  affinity.....org
     [java] 00F0: 2E 6A 62 6F 73 73 2E 65   6A 62 2E 63 6C 69 65 6E  .jboss.ejb.clien
     [java] 0100: 74 2E 41 66 66 69 6E 69   74 79 D6 92 81 EA 9B 17  t.Affinity......
     [java] 0110: 7C F3 00 00 00 00 16 00   00 00 00 07 61 70 70 4E  ............appN
     [java] 0120: 61 6D 65 14 00 00 00 00   08 62 65 61 6E 4E 61 6D  ame......beanNam
     [java] 0130: 65 14 00 00 00 00 0C 64   69 73 74 69 6E 63 74 4E  e......distinctN
     [java] 0140: 61 6D 65 14 00 00 00 00   0A 6D 6F 64 75 6C 65 4E  ame......moduleN
     [java] 0150: 61 6D 65 14 00 00 00 00   08 76 69 65 77 54 79 70  ame......viewTyp
     [java] 0160: 65 15 00 16 04 09 00 00   00 28 6F 72 67 2E 6A 62  e........(org.jb
     [java] 0170: 6F 73 73 2E 65 6A 62 2E   63 6C 69 65 6E 74 2E 41  oss.ejb.client.A
     [java] 0180: 66 66 69 6E 69 74 79 24   4E 6F 41 66 66 69 6E 69  ffinity$NoAffini
     [java] 0190: 74 79 E3 83 D7 FB CD 1D   A3 64 00 00 00 00 3B FE  ty.......d....;.
     [java] 01A0: 3E 10 54 65 73 74 52 65   6D 6F 74 65 45 4A 42 45  >.TestRemoteEJBE
     [java] 01B0: 41 52 3E 0A 43 61 6C 6C   65 72 42 65 61 6E 3D 3E  AR>.CallerBean=>
     [java] 01C0: 09 72 65 6D 6F 74 65 45   4A 42 04 15 07 00 00 00  .remoteEJB......
     [java] 01D0: 13 72 65 6D 6F 74 65 2E   43 61 6C 6C 65 72 52 65  .remote.CallerRe
     [java] 01E0: 6D 6F 74 65 35 1C 38 19   31 AC D0 1E 09 22 D9 DE  mote5.8.1...."..
     [java] 01F0: 19 17 F3 64 9C                                     ...d.
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C 38 60 9F   87 E1 25 46 D1 5C FE 37  .....8`...%F.\.7
     [java] 0010: E0 A1 EF 65 C3 C9 2F 6A   D2 76 98 44 D4 DA 77 E1  ...e../j.v.D..w.
     [java] 0020: 4F                                                 O
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 09 FB 8F   55 47 5C 01 5B 9B 83 37  ....0...UG\.[..7
     [java] 0010: 72 9F 11 14 92 D6 95 01   0F 5D D1 73              r........].s
     [java] Padded plaintext before ENCRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 89 FB 8F   55 47 5C 00 00 01 E1 43  ....1...UG\....C
     [java] 0010: 02 71 58 93 8E BD D0 5A   DC 7C A8 51 48 70 6A     .qX....Z...QHpj
     [java] naming-client-message-receiver-1-thread-1, WRITE: TLSv1 Application Data, length = 15
     [java] [Raw write (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F CB B0 45   F0 FE 66 22 CC 4F 4E 9B  .......E..f".ON.
     [java] 0010: 12 9F 40 F8 EA 07 BC B4   B4 9A 30 D1 71 93 F4 5E  ..@.......0.q..^
     [java] 0020: 05 9D 6F 3D                                        ..o=
     [java] Padded plaintext before ENCRYPTION:  len = 163
     [java] 0000: 00 00 00 8F 30 BD B6 21   6F 8E E0 03 03 00 00 00  ....0..!o.......
     [java] 0010: 0A 74 65 73 74 4D 65 74   68 6F 64 00 10 6A 61 76  .testMethod..jav
     [java] 0020: 61 2E 6C 61 6E 67 2E 53   74 72 69 6E 67 02 3E 10  a.lang.String.>.
     [java] 0030: 54 65 73 74 52 65 6D 6F   74 65 45 4A 42 45 41 52  TestRemoteEJBEAR
     [java] 0040: 3E 09 72 65 6D 6F 74 65   45 4A 42 3D 3E 0A 43 61  >.remoteEJB=>.Ca
     [java] 0050: 6C 6C 65 72 42 65 61 6E   04 10 02 10 00 16 03 01  llerBean........
     [java] 0060: 39 FC 39 FE 3D 39 FD 04   15 07 00 00 00 13 72 65  9.9.=9........re
     [java] 0070: 6D 6F 74 65 2E 43 61 6C   6C 65 72 52 65 6D 6F 74  mote.CallerRemot
     [java] 0080: 65 3E 0F 4D 69 64 64 6C   65 77 61 72 65 4D 61 67  e>.MiddlewareMag
     [java] 0090: 69 63 00 49 9B 7E 78 77   8D 6C DA 1D 7E 38 1F 02  ic.I..xw.l...8..
     [java] 00A0: 71 79 6E                                           qyn
     [java] main, WRITE: TLSv1 Application Data, length = 147
     [java] [Raw write (bb)]: length = 168
     [java] 0000: 17 03 01 00 A3 B1 A6 99   93 12 98 81 2B E5 8E F7  ............+...
     [java] 0010: 94 2E E5 1A 89 B6 92 A4   2E 85 8C AA 92 DD 38 09  ..............8.
     [java] 0020: EF 06 EE 2F C2 97 57 DE   82 15 A8 6E DE 77 F1 F6  .../..W....n.w..
     [java] 0030: 2D 6D 71 1B D8 F1 65 F5   20 80 12 BA 4A D1 2E 74  -mq...e. ...J..t
     [java] 0040: 5F EB 2F 72 5D 4A 3B 49   67 C7 B4 1B F3 8E 3C 6F  _./r]J;Ig.....<o
     [java] 0050: D1 87 EF 65 3A 8B 14 E0   74 77 66 D6 20 0F 0E B4  ...e:...twf. ...
     [java] 0060: 2C 34 35 F6 AF 43 0F EB   44 4C FE 65 E7 21 85 F4  ,45..C..DL.e.!..
     [java] 0070: 92 3C DF 15 F3 7F 71 49   9C 5C 32 DC 0D 04 51 4B  .<....qI.\2...QK
     [java] 0080: 90 83 5B 1C AD F8 8F A5   9D 89 5D 70 B8 BA FD 8D  ..[.......]p....
     [java] 0090: 5B 20 11 C1 F7 9E F5 E9   1F C3 C6 B1 E1 A3 68 87  [ ............h.
     [java] 00A0: 2B 12 F3 E1 40 28 D9 20                            +...@(.
     [java] [Raw read (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F 4C F2 AD   06 0D 28 4A A0 86 A4 FE  .....L....(J....
     [java] 0010: 94 D8 0D 64 D0 06 F9 FC   E6 C3 22 2B 62 03 FC 9E  ...d......"+b...
     [java] 0020: 70 E0 1F E2                                        p...
     [java] Padded plaintext after DECRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 3D B6 21   6F 8E E0 00 00 00 8F CD  ....1=.!o.......
     [java] 0010: 05 3B 87 AD E1 47 09 86   EC 79 86 AF 4D 2A 6B     .;...G...y..M*k
     [java] [Raw read (bb)]: length = 96
     [java] 0000: 17 03 01 00 5B A9 AC 91   5F 8B 52 95 60 B7 52 8D  ....[..._.R.`.R.
     [java] 0010: 60 F8 CD 2E 78 ED C3 12   BC 52 BB BA 48 27 0C A7  `...x....R..H'..
     [java] 0020: CE 7E 1A 02 C6 C2 C3 4D   70 B2 FF A2 63 7F DC B7  .......Mp...c...
     [java] 0030: 25 2C 55 E1 4B 73 3C 3F   EF 16 A5 E5 0B 8A 6A 65  %,U.Ks<?......je
     [java] 0040: 7C BA 37 E2 23 B2 4C 38   6F 2F 76 97 AE 6D DC D8  ..7.#.L8o/v..m..
     [java] 0050: 35 91 F4 9E C7 C2 99 B5   14 21 70 C2 E7 9D 7C 0D  5........!p.....
     [java] Padded plaintext after DECRYPTION:  len = 91
     [java] 0000: 00 00 00 47 30 3D B6 21   6F 30 28 02 05 00 00 02  ...G0=.!o0(.....
     [java] 0010: 3E 38 5B 43 61 6C 6C 65   72 42 65 61 6E 5D 20 74  >8[CallerBean] t
     [java] 0020: 65 73 74 4D 65 74 68 6F   64 28 29 20 72 65 74 75  estMethod() retu
     [java] 0030: 72 6E 65 64 20 48 65 6C   6C 6F 20 4D 69 64 64 6C  rned Hello Middl
     [java] 0040: 65 77 61 72 65 4D 61 67   69 63 00 1F 6B D4 71 EA  ewareMagic..k.q.
     [java] 0050: 70 D3 E9 21 E4 9B B2 98   9D BD 50                 p..!......P
     [java] [Raw read (bb)]: length = 33
     [java] 0000: 17 03 01 00 1C ED D6 DC   6B C7 7D 02 82 42 83 39  ........k....B.9
     [java] 0010: D7 B1 99 8F 33 6C B1 AE   42 6E 24 A0 C9 47 C8 36  ....3l..Bn$..G.6
     [java] 0020: 11                                                 .
     [java] Padded plaintext after DECRYPTION:  len = 28
     [java] 0000: 00 00 00 08 30 3D B6 21   6F 30 28 01 05 E0 4B C3  ....0=.!o0(...K.
     [java] 0010: 02 B9 7C 9F 9E 49 57 B2   DF 53 C7 26              .....IW..S.&
     [java] Padded plaintext before ENCRYPTION:  len = 31
     [java] 0000: 00 00 00 0B 31 BD B6 21   6F 30 28 00 00 00 47 17  ....1..!o0(...G.
     [java] 0010: 3C 86 72 1B F6 5B A4 85   77 F4 CD C7 7A F4 66     <.r..[..w...z.f
     [java] main, WRITE: TLSv1 Application Data, length = 15
     [java] [Raw write (bb)]: length = 36
     [java] 0000: 17 03 01 00 1F BC 11 5E   8B 5B 80 45 77 BA BA D8  .......^.[.Ew...
     [java] 0010: 00 B8 33 56 2A C9 7E 17   68 F3 93 0C 92 78 AE F5  ..3V*...h....x..
     [java] 0020: 2E 12 F2 35                                        ...5

     [java]
     [java] 	 remote.testMethod("MiddlewareMagic") = [CallerBean] testMethod() returned Hello MiddlewareMagic

     [java] Padded plaintext before ENCRYPTION:  len = 21
     [java] 0000: 00 00 00 01 FF 6E 9D 38   AE 68 B7 24 3D 4B EF F6  .....n.8.h.$=K..
     [java] 0010: 1C 60 6E 5A A1                                     .`nZ.
     [java] Thread-1, WRITE: TLSv1 Application Data, length = 5
     [java] [Raw write (bb)]: length = 26
     [java] 0000: 17 03 01 00 15 DD A3 60   0C F1 FF 4C 02 39 37 B2  .......`...L.97.
     [java] 0010: DC 02 35 54 C7 F1 5F 51   54 FA                    ..5T.._QT.
     [java] Thread-1, called closeOutbound()
     [java] Thread-1, closeOutboundInternal()
     [java] Thread-1, SEND TLSv1 ALERT:  warning, description = close_notify
     [java] Padded plaintext before ENCRYPTION:  len = 18
     [java] 0000: 01 00 BE E2 AF A9 25 00   1B E1 4D 5E 96 94 31 3E  ......%...M^..1>
     [java] 0010: D4 5D                                              .]
     [java] Thread-1, WRITE: TLSv1 Alert, length = 18
     [java] [Raw write]: length = 23
     [java] 0000: 15 03 01 00 12 41 91 C7   E8 FC ED 72 7A 48 3A 84  .....A.....rzH:.
     [java] 0010: C3 1F AD 31 0F 91 A4                               ...1...
     [java] [Raw read (bb)]: length = 26
     [java] 0000: 17 03 01 00 15 00 6F 70   FC E5 99 D2 D3 A5 EB 12  ......op........
     [java] 0010: B3 D4 C6 9C F4 F7 DA 23   3F 68                    .......#?h
     [java] Padded plaintext after DECRYPTION:  len = 21
     [java] 0000: 00 00 00 01 FF E5 6D 43   49 4B 74 D5 5E 90 8A 7A  ......mCIKt.^..z
     [java] 0010: D7 1B 0A 79 CB                                     ...y.
     [java] [Raw read]: length = 5
     [java] 0000: 15 03 01 00 12                                     .....
     [java] [Raw read]: length = 18
     [java] 0000: 82 B9 69 EA A4 F3 9C 6E   18 9E 5F D6 E5 99 08 00  ..i....n.._.....
     [java] 0010: 9D 4B                                              .K
     [java] Remoting "config-based-naming-client-endpoint" read-1, READ: TLSv1 Alert, length = 18
     [java] Padded plaintext after DECRYPTION:  len = 18
     [java] 0000: 01 00 88 AF 54 6A 19 F4   56 80 9B 0F 40 45 20 0C  ....Tj..V...@E .
     [java] 0010: 0F 6D                                              .m
     [java] Remoting "config-based-naming-client-endpoint" read-1, RECV TLSv1 ALERT:  warning, close_notify
     [java] Remoting "config-based-naming-client-endpoint" read-1, closeInboundInternal()
     [java] Remoting "config-based-naming-client-endpoint" read-1, closeOutboundInternal()

BUILD SUCCESSFUL
Total time: 5 seconds

.
.
Thanks :)
Middleware Magic Team


Custom Security-Domain and RolesAllowed EJB3 on JBossAS7.1.1Final

Hi,

In our previous demos we have already seen that how to remotely access the EJBs deployed on “JBoss AS 7.1.1.Final”. So in this example we will see how to invoke an EJB which is secured. Here we will use the “jboss-ejb3.xml” file which is a new container specific deployment descriptor for the EJBs. Also we will an alternative option of defining the security domain for our ejbs using annotation “@org.jboss.ejb3.annotation.SecurityDomain”

In this article we are going to see an easiest way to lookup a Secured EJBs remotely in >”JBoss AS7.1.1.Final”

Point-1). How to create a separate Security Realm for our EJBs inside “standalone-full.xml”.

Point-2). How to create a separate Security Domain for our EJBs inside “standalone-full.xml”.

Point-3). How to use the “jboss-ejb3.xml” file inside the EJB jar file in order to associate it with the security domain?

Point-4). How to use the annotation “@org.jboss.ejb3.annotation.SecurityDomain” sothat we will not need to write the addiaional deployment descriptor “jboss-ejb3.xml”

Point-5). A properties file need to be placed in the Clients CLASSPATH with name “jboss-ejb-client.properties”, with some additional properties.

The whole article will be divided into two Parts 1) the Server side configuration and 2). the Application Level Settings from the Client side.

Source Code (Git Repo) Source Code for this Demo Can be downloaded from GIT Repository:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/Custom_SecurtyDomain_EJB3_AS711

JBossAS7 side configuration changes

Here we will first see what all changes are required from the JBoss side in order to create a separate Security Realm and Security Domain for our EJBs.
Step-1). Open the “$JBOSS_HOME/standaone/configuration/standalone-full.xml” file and then add a new Security Realm there inside the tag as following:

   <security-realm name="EJBRealm">
      <authentication>
         <jaas name="ejb-security-domain"/>
      </authentication>
   </security-realm>

Step-2). As the above Security Realm is pointing to a security Domain “ejb-security-domain” so let’s create a new Security Realm inside the [subsystem xmlns="urn:jboss:domain:security:1.1"] subsystem as following:

     <security-domain name="ejb-security-domain" cache-type="default">
         <authentication>
           <login-module code="Remoting" flag="optional">
             <module-option name="password-stacking" value="useFirstPass"/>
           </login-module>
           <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
             <module-option name="defaultUsersProperties" value="${jboss.server.config.dir}/ejb-users.properties"/>
             <module-option name="defaultRolesProperties" value="${jboss.server.config.dir}/ejb-roles.properties"/>
             <module-option name="usersProperties" value="${jboss.server.config.dir}/ejb-users.properties"/>
             <module-option name="rolesProperties" value="${jboss.server.config.dir}/ejb-roles.properties"/>
             <module-option name="password-stacking" value="useFirstPass"/>
           </login-module>
         </authentication>
     </security-domain>

Step-3). Also as we know that the EJBs are accessed remotely using the JBoss Remoting so we will need to make sure that the remoting subsystem is also using the Security Realm (EJBRealm) which we created as following:

    <subsystem xmlns="urn:jboss:domain:remoting:1.1">
       <connector name="remoting-connector" socket-binding="remoting" security-realm="EJBRealm"/>
    </subsystem>

Step-4). As our Security domain is using two properties file so we will need to create those properties file as well inside “$JBOSS_HOME/standaone/configuration/” as following:

ejb-users.properties

ejbUser=ejbPassword

ejb-roles.properties

ejbUser=ejbRole

Step-5). Now start the JBoss AS7.1.1.Final as following:

./standalone.sh -c standalone-full.xml

Developing Secure EJB3 Application

As the Server side configurations are done so now we will proceed with developing the Secure EJB3 application.

Step-6). Create a directory somewhere in your file system like “/home/userone/Custom_SecurtyDomain_EJB3_AS711″ and then create another directory with name “src” inside the “/home/userone/Custom_SecurtyDomain_EJB3_AS711″ directory.

Step-7). Write the EJB Stateless Bean class “CallerBean.java” as following inside the directory “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src”:

package remote;
import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import javax.annotation.Resource;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed;
import javax.ejb.LocalBean;
import javax.ejb.SessionContext;

@Stateless
@Remote(CallerRemote.class)

/*
   If you dont want to use "META-INF/jboss-ejb3.xml" then you can use
   the following annotation to defing your security-domain
   @org.jboss.ejb3.annotation.SecurityDomain("ejb-security-domain")
*/

public class CallerBean implements CallerRemote
 {
     @Resource
     private SessionContext sessionContext;

     @RolesAllowed("ejbRole")
     public String testMethod(String name)
	    {
		   System.out.println("\n\n\tBean's testMethod(String name) called....");
                   System.out.println("\n\n\tUserName: '" + sessionContext.getCallerPrincipal().getName() + "' is able to access testMethod()");
                   if (sessionContext.isCallerInRole("ejbRole"))
                         System.out.println("\tUser is in   \"ejbRole\"   ");
                   else
                         System.out.println("\tUser is NOT in an allowed role");
		   return "[CallerBean] testMethod() returned Hello "+name;
	    }

     public String commonMethod(String name)
	    {
		   System.out.println("\n\n\tBean's commonMethod(String name) called....");
                   System.out.println("\n\nUser " + sessionContext.getCallerPrincipal().getName() + " is able to access commonMethod()");
                   if (sessionContext.isCallerInRole("ejbRole"))
                         System.out.println("\t##### commonMethod()  User is in ejbRole");
                   else
                         System.out.println("\t##### commonMethod()  User is NOT in ejbRole");
		   return "[CallerBean] commonMethod() returned Hello "+name;
	    }
 }

Step-8). Write the EJB Remote Interface “CallerRemote.java” as following inside the directory “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src”:

package remote;
public interface CallerRemote
{
     public String testMethod(String name);
     public String commonMethod(String name);
}

Step-9). In order to secure the EJB we will define the security domain inside the “jboss-ejb3.xml” file. Spo create a file with this name inside “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src” as following:


<?xml version="1.0"?>
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:s="urn:security"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
   http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
   version="3.1"
   impl-version="2.0">
  <assembly-descriptor>
    <s:security>
      <ejb-name>*</ejb-name>
          <s:security-domain>ejb-security-domain</s:security-domain>
    </s:security>
  </assembly-descriptor>

</jboss:ejb-jar>

Step-10). As we are going to create an EAR file containing the above Stateless Session Bean so We will write the “application.xml” as following inside the directory “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src”:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID" version="5">
  <module>
    <ejb>remoteEJB.jar</ejb>
  </module>
</application>

Developing EJB3 Remote Client

Step-11). Now we will write the Client side code to access the Above mentioned EJB Remotely so create a class “TestRemoteClientA.java” as following inside the directory “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src”:

package client;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import remote.CallerRemote;
public class TestRemoteClientA
  {
      public static void main(String ar[]) throws Exception
       {
          Context context=null;
       try
         {
                Properties props = new Properties();
                props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
                props.put(Context.PROVIDER_URL, "remote://localhost:4447");
                props.put(Context.SECURITY_PRINCIPAL, "ejbUser");
                props.put(Context.SECURITY_CREDENTIALS, "ejbPassword");

                //props.put("jboss.naming.client.remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED","true");
                //props.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_STARTTLS","true");

                props.put("jboss.naming.client.ejb.context", true);
                props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
                context = new InitialContext(props);
	        System.out.println("\n\t--------------------------\nGot initial Context: "+context);
         }
       catch (Exception e)
         {
                e.printStackTrace();
          }

         // Lookup Format will be
         // <app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>

         CallerRemote remote=(CallerRemote)context.lookup("TestRemoteEJBEAR/remoteEJB//CallerBean!remote.CallerRemote");
         //System.out.println("\n\t remote.testMethod(\"Common-MiddlewareMagic\") = "+remote.commonMethod("Common-MiddlewareMagic"));

         System.out.println("\n\t remote.testMethod(\"MiddlewareMagic\") = "+remote.testMethod("MiddlewareMagic"));
       }
  }

Step-12). Now we will need to create a properties file “jboss-ejb-client.properties” as following inside the directory “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src”:


remote.connections=testEJB
#endpoint.name=client-endpoint
remote.connection.testEJB.port=4447
remote.connection.testEJB.host=localhost
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connection.testEJB.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.testEJB.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false 

NOTE: The above properties file need to be present inside the client’s classpath. In our case we are going to put this file inside a JAR file “remoteEJBClient.jar” and then we will add this JAR inside the client’s classpath.

Step-13). Almost everything is done, so we will create a client side logging file sothat we will get the desired logging at the Remote EJB Client side. So lets create a file “logging.properties” inside “/home/userone/Custom_SecurtyDomain_EJB3_AS711/src” as following:


# Logging
handlers =  java.util.logging.ConsoleHandler
.level = ALL
INFO

# Console Logging
java.util.logging.ConsoleHandler.level=SEVERE

Step-14). Now the most important part of building / deploying and running the application so in order to achieve that we will create a simple ant build script, So Create a “build.xml” file inside the “/home/userone/Custom_SecurtyDomain_EJB3_AS711″ directory as following:

<project name="EJB3_SecurityDomain_Service" default="all">
<property name="jboss.home" value="/NotBackedUp/JBoss_All/jboss-as-7.1.1.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="src.dir" value="src" />
<property name="output.dir" value="build" />
<property name="ear.name" value="TestRemoteEJBEAR.ear" />
<property name="ejb.jar" value="remoteEJB.jar" />
<property name="client.jar.name" value="remoteEJBClient.jar" />

        <path id="jboss.classpath">
           <fileset dir="${jboss.module.dir}">
               <include name="**/*.jar"/>
           </fileset>
        </path>

        <!-- Client Needs the following Jar to be present in the CLASSPATH including -->
        <path id="jboss.new.client.classpath">
           <fileset dir="${jboss.home}/bin/client" >
               <include name="jboss-client.jar" />
           </fileset>
        </path>

        <target name="all" depends="deploy" />

        <target name="build_ear">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}/META-INF" />
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="*.java" excludes="TestRemoteClientA.java" classpathref="jboss.classpath"/>
           <copy file="${src.dir}/jboss-ejb3.xml" todir="${tmp.dir}/META-INF"/>
           <jar jarfile="${tmp.dir}/${ejb.jar}" basedir="${tmp.dir}" compress="true" />

           <delete file="${tmp.dir}/ejb-users.properties"/>
           <delete file="${tmp.dir}/ejb-roles.properties"/>
           <delete file="${tmp.dir}/META-INF/jboss-ejb3.xml"/>

           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/remote"/>
           </delete>
           <mkdir dir="${tmp.dir}/META-INF"/>
           <copy todir="${tmp.dir}/META-INF">
                <fileset dir="${src.dir}/">
                  <include name="application.xml"/>
                </fileset>
           </copy>
           <jar jarfile="${tmp.dir}/${ear.name}" basedir="${tmp.dir}" compress="true" />
           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/META-INF"/>
           </delete>
           <delete file="${tmp.dir}/${ejb.jar}"/>

           <copy file="${tmp.dir}/${ear.name}" tofile="${output.dir}/${ear.name}"/>
           <delete file="${tmp.dir}/${ear.name}"/>
        </target>

        <target name="deploy" depends="build_ear">
            <echo message="*******************  Deploying the EAR file ${ear.name} *********************" />
            <echo message="********** ${output.dir}/${ear.name} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${ear.name}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
        </target>

        <target name="run">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <copy file="${src.dir}/jboss-ejb-client.properties" toDir="${tmp.dir}"/>
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="CallerRemote.java,TestRemoteClientA.java" classpathref="jboss.classpath"/>
           <jar jarfile="${output.dir}/${client.jar.name}" basedir="${tmp.dir}" compress="true" />
           <delete dir="${tmp.dir}"/>
           <java classname="client.TestRemoteClientA" fork="true">
               <classpath>
                  <pathelement location="${output.dir}/${client.jar.name}"/>
                  <path refid="jboss.new.client.classpath"/>
               </classpath>

               <!-- Note Here we are passing the Client side logging related file to the JVM -->
               <sysproperty key="java.util.logging.manager" value="java.util.logging.LogManager"/>
               <sysproperty key="java.util.logging.config.file" value="${src.dir}/logging.properties"/>
               <sysproperty key="java.util.logging.ConsoleHandler.level" value="SEVERE" />
           </java>
        </target>        

</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory.

Step-15). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step-16). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/userone/Custom_SecurtyDomain_EJB3_AS711″ and then run the ant to build and deploy the EJB based EAR applicationon your JBoss Standalone full profile, by running the command “ant deploy”

[userone@localhost Custom_SecurtyDomain_EJB3_AS711]$ ant deploy
Buildfile: build.xml

build_ear:
    [mkdir] Created dir: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/META-INF
    [javac] Compiling 2 source files to /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp
     [copy] Copying 1 file to /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/META-INF
      [jar] Building jar: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/remoteEJB.jar
   [delete] Deleting: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/META-INF/jboss-ejb3.xml
     [copy] Copying 1 file to /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/META-INF
      [jar] Building jar: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/TestRemoteEJBEAR.ear
   [delete] Deleting: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/remoteEJB.jar
     [copy] Copying 1 file to /home/userone/Custom_SecurtyDomain_EJB3_AS711/build
   [delete] Deleting: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp/TestRemoteEJBEAR.ear

deploy:
     [echo] *******************  Deploying the EAR file TestRemoteEJBEAR.ear *********************
     [echo] ********** build/TestRemoteEJBEAR.ear to /home/userone/jboss-as-7.1.1.Final//standalone/deployments **********
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.1.Final//standalone/deployments
     [echo] *******************  Deployed Successfully   *********************

BUILD SUCCESSFUL
Total time: 2 seconds

Step-17). Now we will try to compile and run the EJB3 remote Client application by running the command “ant run”

[userone@localhost Custom_SecurtyDomain_EJB3_AS711]$ ant run
Buildfile: build.xml

run:
   [delete] Deleting directory /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp
    [mkdir] Created dir: /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp
     [copy] Copying 1 file to /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp
    [javac] Compiling 2 source files to /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp
      [jar] Building jar: /home/userone/Custom_SecurtyDomain_EJB3_AS711/build/remoteEJBClient.jar
   [delete] Deleting directory /home/userone/Custom_SecurtyDomain_EJB3_AS711/tmp
     [java]
     [java] 	--------------------------
     [java] Got initial Context: javax.naming.InitialContext@5ff3ce5c
     [java]
     [java] 	 remote.testMethod("MiddlewareMagic") = [CallerBean] testMethod() returned Hello MiddlewareMagic

BUILD SUCCESSFUL
Total time: 3 seconds

.
.
Thanks :)
Middleware Magic Team


JPA2 with OpenJPA 2.2.0 in JBossAS7.1.1

Hi,

In Our previous demo we saw how we can use Oracle TopLink 12c with JBossAS7 as persistence provider. http://middlewaremagic.com/jboss/?p=1983
Here in this example we will see how we can use the Open JPA in JBossAS7 as a persistence provider.

As we already know that the JBoss Application Server7 JPA subsystem implements the JPA 2.0 container-managed requirements. JPA Applications use the Hibernate (core) 4.0 persistence provider, that is included with JBoss AS7. Hibernate 4 is packaged with the AS and is the default persistence provider. The JPA 2.0 Specifications can be found in the following link: http://jcp.org/aboutJava/communityprocess/pfd/jsr317/index.html

However in this current Demo we will just create a Simple JPA persistence unit With the help of “Open JPA 2.2.0″ and then we will try to insert some employee detils inside the DataBase. So basically this is just as a startup.

In this example we will mainly focus on following points

Point-1). We will see how to use “Open JPA 2.2.0″ with JBossAS7.1.1.Final.

Point-2). For Web Applications we should put the “persistence.xml” file inside “${WEB_APPLICATION}/WEB-INF/classes/META-INF/persistence.xml” AND For EJB Applications we should put the “persistence.xml” file inside “${EJB_JAR}/META-INF”

Point-3). To inject the EntityManager inside our Web Components we can use the annotation @javax.persistence.PersistenceContext(unitName=”name”)

Point-4). We can use the @javax.ejb.EJB annotation to inject an Enterprise Java Bean inside our app components. Like @EJB(lookup=”jndiName”)

Point-5). We will also see how to create a openJPA custom module and how to use the “jboss-deployment-structure.xml” file.

Point-6). We will see what error we get when we dont define following property in our “persistence.xml” file while using OpenJPA .

           <property name="openjpa.DynamicEnhancementAgent" value="false"/>
           <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />

Point-7). The Full Demo can be downloaded from the following Github repository:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/JPA2_And_OpenJPA_On_AS7

Creating DataSource On JBossAS7

Step-1). Here we are using JBoss AS7 latest build “jboss-as-7.1.1.Final” which can be downloaded from the following link: http://www.jboss.org/jbossas/downloads

Step-2). In order to get more details on how to create MySQL DataSource in JBoss AS7 you can refer to the following article: http://middlewaremagic.com/jboss/?p=872
Just place the “mysql-connector-java-5.1.13-bin.jar” MySQL Jdbc driver in your JBoss Deployments directory, Then create a DataSource inside “${JBOSS_HOME}/standalone/configuration/standalone-full.xml” file as following:

        <subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasources>

                <!-- Below is the DataSource Configuration which we added for our JPA TestCase-->
                <datasource jta="false" jndi-name="java:/MySqlDS" pool-name="MySqlDS_Pool" enabled="true" use-ccm="false">
                    <connection-url>jdbc:mysql://localhost:3306/testDB</connection-url>
                    <driver-class>com.mysql.jdbc.Driver</driver-class>
                    <driver>mysql-connector-java-5.1.13-bin.jar</driver>
                    <security>
                        <user-name>someDBUserName</user-name>
                        <password>someDBPassword</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

Creating OpenJPA 2.2.0 Module In JBossAS7

Step-3). Download the “OpenJPA 2.2.0″ (apache-openjpa-2.2.0-binary.zip) from the following link:
http://openjpa.apache.org/downloads.html

Step-4). Extract the downloaded “apache-openjpa-2.2.0-binary.zip” and then copy the two Jars “apache-openjpa-2.2.0/lib/serp-1.13.1.jar” And “apache-openjpa-2.2.0/openjpa-all-2.2.0.jar”

Step-5). Create the following directory structure [jboss-as-7.1.1.Final/modules/org/eclipse/persistence/jpa/main] in your file system so that the OpenJPA 2.2.0 Module can be created.

     .
     .  
     jboss-as-7.1.1.Final/modules/
     │  
     ├──org
     │   │  
     │   ├── apache
     │   │   │ 
     │   │   ├── openjpa
                    │ 
                      ── main
                         ├── module.xml
                         ├
                         ├── openjpa-all-2.2.0.jar
                         ├
                         ├── serp-1.13.1.jar

Paste the “openjpa-all-2.2.0.jar” And “serp-1.13.1.jar” from downloaded OpenJPA s/w into the “jboss-as-7.1.1.Final/modules/org/apache/openjpa/main” and then write the following kind of “module.xml” file:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa">
    <resources>
        <resource-root path="openjpa-all-2.2.0.jar"/>
        <resource-root path="serp-1.13.1.jar"/>
    </resources>

        <dependencies>
            <module name="javax.persistence.api"/>
            <module name="javax.transaction.api"/>
            <module name="javax.validation.api"/>
        </dependencies>
</module>

Step-6). Restart your JBoss AS7 from inside “/home/userone/jboss-as-7.1.1.Final/bin” directory as following:

.
 ./standalone.sh -c standalone-full.xml
.

Developing OpenJPA 2.2.0 JPA Demo

Step1). Create a directory somewhere in your filesystem like “/home/userone/JPA2_And_OpenJPA_On_AS7″ where we will place our application build related stuff. Then create another directory “src” inside “/home/userone/JPA2_And_OpenJPA_On_AS7″ where we will be placing our source codes and JSPs.

Step2). Now first of all we will create an Entity “Employee.java” as following inside the “/home/userone/JPA2_And_OpenJPA_On_AS7/src” directory.

package jpa;
import java.io.Serializable;
import javax.persistence.*;
import java.lang.Integer;

@Entity
@Table(name="Employee")
public class Employee implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private Integer empno;

	private String ename;

    public Employee() {
    	System.out.println("Employee Object Created. this: "+this);
    }

	public Integer getEmpno() {
		return this.empno;
	}

	public void setEmpno(Integer empno) {
		this.empno = empno;
	}

	public String getEname() {
		return this.ename;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

}

Step3). Now we will create a Simple Stateless SessionBean remote Interface “EmployeeServiceRemote.java” inside “/home/userone/JPA2_And_OpenJPA_On_AS7/src” directory as following:

package jpa;
import java.lang.Integer;
import java.util.Collection;
import javax.ejb.Remote;
@Remote

public interface EmployeeServiceRemote{
  public void doAction();
  public Employee createEmployee(Integer id, String name);
  public void removeEmployee(Integer id);
  public Employee findEmployee(Integer id);
  public Collection<Employee> findAllEmployees() ;

}

Step4). Now we will Stateless Session Bean class “EmployeeService.java” by implementing the interface “EmployeeServiceRemote.java”. Place this file as well inside the “/home/userone/JPA2_And_OpenJPA_On_AS7/src” directory as following:

package jpa;
import java.lang.Integer;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import javax.persistence.EntityTransaction;
import javax.ejb.*;

@Stateless
public class EmployeeService implements EmployeeServiceRemote {
  @PersistenceContext(unitName="EmployeeService")
  EntityManager em;

  public EmployeeService() {
	  System.out.println("\n\tEmployeeService  Object Created. this: "+this);
  }

  @TransactionAttribute (TransactionAttributeType.REQUIRED)
  public Employee createEmployee(Integer id, String name) {
    Employee emp = new Employee();
    emp.setEmpno(id);
    emp.setEname(name);
    System.out.println("\n\t[EmployeeService] Before em.persist(emp)");

    try{ 

         //em.getTransaction().begin();
         em.persist(emp);
         //em.flush();
         //em.getTransaction().commit();
       }
    catch(Exception e)
       {
          e.printStackTrace();
          try{   em.getTransaction().rollback();   } catch(Exception ee)  {  ee.printStackTrace();  }
       }

     System.out.println("\n\t[EmployeeService] Before findEmployee(id)");
     emp = findEmployee(id);
     System.out.println("\n\t[EmployeeService] Inside createEmployee() findEmployee result: "+emp);
     return emp;
  }

  public void removeEmployee(Integer id) {
	System.out.println("\n\t Inside removeEmployee("+id+")");
    Employee emp = findEmployee(id);
    if (emp != null) {
       try{
            //em.getTransaction().begin();
            em.remove(emp);
            //em.getTransaction().commit();
          }
       catch(Exception e)
          {
             e.printStackTrace();
             try{   em.getTransaction().rollback();   } catch(Exception ee)  {  ee.printStackTrace();  }
          }
    }
  }

  public Employee findEmployee(Integer id) {
	System.out.println("\n\t Inside findEmployee("+id+")");
    return em.find(Employee.class, id);
  }

  @SuppressWarnings("unchecked")
  public Collection<Employee> findAllEmployees()
     {
	System.out.println("\n\t Inside findAllEmployees()");
        Query query = em.createQuery("SELECT e FROM Employee e");
        return (Collection<Employee>) query.getResultList();
     }

  public void doAction(){
       System.out.println("\n\t Hello World...");
  }
}

Step5). Now we will write the “persistence.xml” file inside the “/home/userone/JPA2_And_OpenJPA_On_AS7/src” directory as following:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="EmployeeService">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
       <jta-data-source>java:/MySqlDS</jta-data-source>
       <class>jpa.Employee</class>

      <properties>
          <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa" />
          <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=INFO"/>

           <!--   IMPORTANT PROPERTIES   -->
           <property name="openjpa.DynamicEnhancementAgent" value="false"/>
           <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
      </properties>
  </persistence-unit>
</persistence>

NOTE: We need to make sure that this “persistence.xml” file goes inside the “${war.name}/WEB-INF/classes/META-INF” directory of our WAR file. Note jboss.as.jpa.providerModule property is very important

Step6). Now we will write a simple “index.jsp” page to just provide a some input forms so that a user can enter the employee name and id details , Place this file as well inside the “/home/userone/JPA2_And_OpenJPA_On_AS7/src” directory as following:

<html>
<head>
<title>JPA Demo In JBoss AS7</title>
</head>
<body>
   <form action="TestServlet">
   Enter Employee ID : <input name="empId" type="text" value="" /> <BR/>
   Enter Employee Name : <input name="empName" type="text" value="" /> <BR/>
   <input type="submit" value="Store" />
   </form>
</body>
</html>

Step7). We will write the “TestServlet.java” inside the “/home/userone/JPA2_And_OpenJPA_On_AS7/src” as following in order to insert the details entered by the user in previous index.jsp page.


package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.Integer;
import javax.ejb.EJB;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.*;
import javax.transaction.*;
import javax.annotation.*;
import jpa.Employee;

@WebServlet(value="/TestServlet")
public class TestServlet extends HttpServlet
  {
	private static final long serialVersionUID = 1L;

        @PersistenceContext(unitName="EmployeeService")
	EntityManager em;

        @EJB(lookup="java:global/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote")
        jpa.EmployeeServiceRemote remote;

	public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                PrintWriter out=null;
		try {
			System.out.println("inside TestServlet service()");
			System.out.println("Got jpa.EmployeeServiceRemote :  "+remote);
			out=response.getWriter();			

                        out.println("<html><head><title>JPA Insert</title></head><body>");
			out.println("<BR>Employee Record Inserted in the Database.<BR>");
                        remote.createEmployee(new Integer(request.getParameter("empId")),request.getParameter("empName"));
                        out.println("Record Inserted.....");

                        /*
                          //  If i call the "remote.findAllEmployees()" Now then i get an Exception here .... Only with OpenJPA
                          //  (where as it works well with TopLink and Hibernate) 

                        Collection<Employee> employees=remote.findAllEmployees();
                        out.println("<TABLE border=\"10%\">");
                        out.println("<TR><TD>EmpID</TD><TD>EmpName</TD></TR>");
			for(Employee tmp : employees)
			{
			   out.println("<TR><TD>"+tmp.getEmpno()+"</TD><TD>"+tmp.getEname()+"</TD></TR>");
			}
                        out.println("</TABLE>");
                        */
                        remote.doAction();
                        out.println("<BR><BR><a href=\"index.jsp\"> Want to insert Some More Employee Records ?</a></body></html>");
		     }
                 catch (Exception e)
                     {
			e.printStackTrace();
		     }
	}
}

Step8). As we created a module “org.eclipse.persistence.jpa” earlier which we are going to use in our web application. So we will need to create a “jboss-deployment-structure.xml” file as following:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
  <deployment>
    <dependencies>
      <module name="org.apache.openjpa" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>

NOTE: Once our application is build then we should be able to see this file present inside our WebApplication “WEB-INF/jboss-deployment-structure.xml”.

Step9). Now the most important part, here we are going to develop “build.xml” ANT file, which will build, deploy our web application on the JBoss AS7.1 Beta Server, so write the following “build.xml” file inside “/home/userone/JPA2_And_OpenJPA_On_AS7″ directory.


<project name="JPA_BASIC_Demo" default="deploy">
<property name="jboss.home" value="/NotBackedUp/JBoss_All/jboss-as-7.1.1.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="output.dir" value="build" />
<property name="src.dir" value="src" />
<property name="war.name" value="JPA_BASIC_Demo.war" />

   <path id="jboss.classpath">
     <fileset dir="${jboss.module.dir}">
        <include name="**/*.jar"/>
     </fileset>
   </path>

        <target name="init">
           <delete dir="${output.dir}" />
           <mkdir dir="${output.dir}" />
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}/WEB-INF/classes/META-INF"/>
        </target>

        <target name="build" depends="init">
           <javac srcdir="${src.dir}" destdir="${tmp.dir}/WEB-INF/classes"  includes="*.java" classpathref="jboss.classpath" />
           <copy todir="${tmp.dir}/WEB-INF/classes">
                <fileset dir="${src.dir}" includes="**/*.java"/>
           </copy>
           <copy file="${src.dir}/index.jsp" tofile="${tmp.dir}/index.jsp"/>
           <copy file="${src.dir}/jboss-deployment-structure.xml" tofile="${tmp.dir}/WEB-INF/jboss-deployment-structure.xml"/>

           <!-- Make Sure that the persistence.xml file is placed inside "${war.name}/WEB-INF/classes/META-INF" directory -->
           <copy file="${src.dir}/persistence.xml" tofile="${tmp.dir}/WEB-INF/classes/META-INF/persistence.xml"/>

           <jar jarfile="${tmp.dir}/${war.name}" basedir="${tmp.dir}" compress="true" />
           <copy file="${tmp.dir}/${war.name}" tofile="${output.dir}/${war.name}"/>

           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}"/>
           </delete>
        </target>

        <target name="deploy" depends="build">
            <echo message="*******************  Deploying the WAR file ${war.name} *********************" />
            <echo message="********** ${output.dir}/${war.name} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${war.name}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
        </target>
</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory.

Step9). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step10). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/userone/JPA2_And_OpenJPA_On_AS7″ and then run the ant to build the webservice. by running the command “ant deploy”

Buildfile: build.xml

init:
   [delete] Deleting directory /home/userone/JPA2_And_OpenJPA_On_AS7/build
    [mkdir] Created dir: /home/userone/JPA2_And_OpenJPA_On_AS7/build
    [mkdir] Created dir: /home/userone/JPA2_And_OpenJPA_On_AS7/tmp
    [mkdir] Created dir: /home/userone/JPA2_And_OpenJPA_On_AS7/tmp/WEB-INF/classes/META-INF

build:
    [javac] Compiling 4 source files to /home/userone/JPA2_And_OpenJPA_On_AS7/tmp/WEB-INF/classes
     [copy] Copying 4 files to /home/userone/JPA2_And_OpenJPA_On_AS7/tmp/WEB-INF/classes
     [copy] Copying 1 file to /home/userone/JPA2_And_OpenJPA_On_AS7/tmp
     [copy] Copying 1 file to /home/userone/JPA2_And_OpenJPA_On_AS7/tmp/WEB-INF
     [copy] Copying 1 file to /home/userone/JPA2_And_OpenJPA_On_AS7/tmp/WEB-INF/classes/META-INF
      [jar] Building jar: /home/userone/JPA2_And_OpenJPA_On_AS7/tmp/JPA_BASIC_Demo.war
     [copy] Copying 1 file to /home/userone/JPA2_And_OpenJPA_On_AS7/build

deploy:
     [echo] *******************  Deploying the WAR file JPA_BASIC_Demo.war *********************
     [echo] ********** build/JPA_BASIC_Demo.war to /home/userone/jboss-as-7.1.1.Final/standalone/deployments **********
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.1.Final/standalone/deployments
     [echo] *******************  Deployed Successfully   *********************

BUILD SUCCESSFUL
Total time: 2 seconds

Step11). Now you will see the following kind of output on your JBoss AS7.1 console which means the application is deployed successfully:


22:31:20,023 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011403: Stopping Persistence Unit Service 'JPA_BASIC_Demo.war#EmployeeService'
22:31:20,024 ERROR [stderr] (MSC service thread 1-4) 1670729  EmployeeService  TRACE  [MSC service thread 1-4] openjpa.Runtime - org.apache.openjpa.persistence.EntityManagerFactoryImpl@eed9a0e.close() invoked.
22:31:20,025 ERROR [stderr] (MSC service thread 1-4) 1670730  EmployeeService  TRACE  [MSC service thread 1-4] openjpa.MetaData - Clearing metadata repository "org.apache.openjpa.jdbc.meta.MappingRepository@151c6810".
22:31:20,050 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment JPA_BASIC_Demo.war in 40ms
22:31:20,051 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "JPA_BASIC_Demo.war"
22:31:20,060 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for EmployeeService
22:31:20,093 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings for session bean named EmployeeService in deployment unit deployment "JPA_BASIC_Demo.war" are as follows:

	java:global/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote
	java:app/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote
	java:module/EmployeeService!jpa.EmployeeServiceRemote
	java:jboss/exported/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote
	java:global/JPA_BASIC_Demo/EmployeeService
	java:app/JPA_BASIC_Demo/EmployeeService
	java:module/EmployeeService

22:31:20,181 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'JPA_BASIC_Demo.war#EmployeeService'
22:31:20,221 ERROR [stderr] (MSC service thread 1-1) 0  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.Runtime - Setting the following properties from "?" into configuration: {javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl, openjpa.RuntimeUnenhancedClasses=supported, javax.persistence.sharedCache.mode=UNSPECIFIED, PersistenceVersion=2.0, openjpa.Log=DefaultLevel=TRACE, Tool=INFO, openjpa.Id=EmployeeService, openjpa.ConnectionFactoryMode=managed, openjpa.ConnectionFactory=org.jboss.jca.adapters.jdbc.WrapperDataSource@36cb1594, javax.persistence.validation.mode=AUTO, javax.persistence.validation.factory=org.jboss.as.jpa.validator.SerializableValidatorFactory@4600f385, jboss.as.jpa.providerModule=org.apache.openjpa, openjpa.TransactionMode=managed, openjpa.MetaDataFactory=jpa(URLs=vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/, Types=jpa.Employee), openjpa.ClassResolver=org.apache.openjpa.persistence.PersistenceUnitInfoImpl$ClassResolverImpl@269be988, openjpa.DynamicEnhancementAgent=false}
22:31:20,227 ERROR [stderr] (MSC service thread 1-1) 6  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.Runtime - No cache marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
22:31:20,228 ERROR [stderr] (MSC service thread 1-1) 7  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - Scanning URL "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" for persistent types.
22:31:20,229 ERROR [stderr] (MSC service thread 1-1) 8  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - Scan of "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" found persistent types [].
22:31:20,229 ERROR [stderr] (MSC service thread 1-1) 8  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - Skipping persistent type location association for location "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" since it is a directory.
22:31:20,230 ERROR [stderr] (MSC service thread 1-1) 9  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - Scanning resource "META-INF/orm.xml" for persistent types.
22:31:20,230 ERROR [stderr] (MSC service thread 1-1) 9  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - The persistent unit root url is "null"
22:31:20,230 ERROR [stderr] (MSC service thread 1-1) 9  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - parsePersistentTypeNames() found [jpa.Employee].
22:31:20,231 ERROR [stderr] (MSC service thread 1-1) 10  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.MetaData - Found 1 classes with metadata in 3 milliseconds.
22:31:20,235 ERROR [stderr] (MSC service thread 1-1) 0  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.Runtime - Setting the following properties from "?" into configuration: {openjpa.BrokerFactory=jdbc, javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl, openjpa.RuntimeUnenhancedClasses=supported, javax.persistence.sharedCache.mode=UNSPECIFIED, PersistenceVersion=2.0, openjpa.Log=DefaultLevel=TRACE, Tool=INFO, openjpa.Id=EmployeeService, openjpa.ConnectionFactoryMode=managed, openjpa.ConnectionFactory=org.jboss.jca.adapters.jdbc.WrapperDataSource@36cb1594, javax.persistence.validation.mode=AUTO, javax.persistence.validation.factory=org.jboss.as.jpa.validator.SerializableValidatorFactory@4600f385, jboss.as.jpa.providerModule=org.apache.openjpa, openjpa.TransactionMode=managed, openjpa.BrokerImpl=non-finalizing, openjpa.MetaDataFactory=jpa(URLs=vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/, Types=jpa.Employee), openjpa.ClassResolver=org.apache.openjpa.persistence.PersistenceUnitInfoImpl$ClassResolverImpl@269be988, openjpa.DynamicEnhancementAgent=false}
22:31:20,237 ERROR [stderr] (MSC service thread 1-1) 2  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.Runtime - Trying to load javax.validation APIs based on the ValidationMode=AUTO
22:31:20,241 ERROR [stderr] (MSC service thread 1-1) 6  EmployeeService  INFO   [MSC service thread 1-1] openjpa.Runtime - OpenJPA dynamically loaded a validation provider.
22:31:20,241 ERROR [stderr] (MSC service thread 1-1) 6  EmployeeService  TRACE  [MSC service thread 1-1] openjpa.Runtime - org.apache.openjpa.persistence.PersistenceProviderImpl@6873c4aa creating container org.apache.openjpa.persistence.EntityManagerFactoryImpl@874aa79 for PU EmployeeService.
22:31:20,256 INFO  [org.jboss.web] (MSC service thread 1-5) JBAS018210: Registering web context: /JPA_BASIC_Demo
22:31:20,373 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565: Replaced deployment "JPA_BASIC_Demo.war" with deployment "JPA_BASIC_Demo.war"

NOTE: When OpenJPA displays TRACE Logging message above then …JBoss Incorrectly showing ERROR Message.

Step12). Now access the WebApplication like following and then fill the form :

http://localhost:8080/JPA_BASIC_Demo/index.jsp

Once you hit the above URL you will see thew following kind of output in oyur JBossAS7 console:

.
22:33:39,382 INFO  [stdout] (http--127.0.0.1-8080-2) inside TestServlet service()
22:33:39,382 INFO  [stdout] (http--127.0.0.1-8080-2) Got jpa.EmployeeServiceRemote :  Proxy for remote EJB StatelessEJBLocator{appName='', moduleName='JPA_BASIC_Demo', distinctName='', beanName='EmployeeService', view='interface jpa.EmployeeServiceRemote'}
22:33:39,384 INFO  [stdout] (http--127.0.0.1-8080-2)
22:33:39,384 INFO  [stdout] (http--127.0.0.1-8080-2) 	EmployeeService  Object Created. this: jpa.EmployeeService@598427a0
22:33:39,385 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: jpa.Employee@7345a749
22:33:39,385 INFO  [stdout] (http--127.0.0.1-8080-2)
22:33:39,385 INFO  [stdout] (http--127.0.0.1-8080-2) 	[EmployeeService] Before em.persist(emp)
22:33:39,385 ERROR [stderr] (http--127.0.0.1-8080-2) 139150  EmployeeService  INFO   [http--127.0.0.1-8080-2] openjpa.Runtime - Starting OpenJPA 2.2.0
22:33:39,386 ERROR [stderr] (http--127.0.0.1-8080-2) 139151  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Runtime - Properties: javax.persistence.lock.timeout: 0
22:33:39,386 ERROR [stderr] (http--127.0.0.1-8080-2) javax.persistence.query.timeout: 0
22:33:39,386 ERROR [stderr] (http--127.0.0.1-8080-2) javax.persistence.sharedCache.mode: UNSPECIFIED
22:33:39,387 ERROR [stderr] (http--127.0.0.1-8080-2) javax.persistence.validation.group.pre-persist: javax.validation.groups.Default
22:33:39,387 ERROR [stderr] (http--127.0.0.1-8080-2) javax.persistence.validation.group.pre-update: javax.validation.groups.Default
22:33:39,387 ERROR [stderr] (http--127.0.0.1-8080-2) javax.persistence.validation.mode: AUTO
22:33:39,387 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.AutoClear: 0
22:33:39,387 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.AutoDetach: []
22:33:39,388 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.BrokerFactory: jdbc
22:33:39,388 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.BrokerImpl: non-finalizing
22:33:39,388 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.CacheDistributionPolicy: default
22:33:39,388 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Callbacks: default
22:33:39,388 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.ClassResolver: org.apache.openjpa.persistence.PersistenceUnitInfoImpl$ClassResolverImpl
22:33:39,388 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Compatibility: default
22:33:39,389 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.ConnectionFactoryMode: true
22:33:39,389 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.ConnectionRetainMode: 0
22:33:39,389 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.DataCache: false
22:33:39,389 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.DataCacheManager: default
22:33:39,389 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.DataCacheTimeout: -1
22:33:39,389 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.DetachState: loaded
22:33:39,390 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.DynamicDataStructs: false
22:33:39,390 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.DynamicEnhancementAgent: false
22:33:39,390 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.EntityManagerFactory: default
22:33:39,390 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.FetchBatchSize: -1
22:33:39,390 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.FetchGroups: [default]
22:33:39,390 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.FlushBeforeQueries: 0
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Id: EmployeeService
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.IgnoreChanges: false
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.InitializeEagerly: false
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.InstrumentationManager: default
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.InverseManager: false
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.LifecycleEventManager: validating
22:33:39,391 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.LockManager: mixed
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Log: true(DefaultLevel=TRACE, Tool=INFO)
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.ManagedRuntime: auto
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.MaxFetchDepth: -1
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.MetaDataFactory: jpa(URLs=vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/, Types=jpa.Employee)
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.MetaDataRepository: default
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Multithreaded: false
22:33:39,392 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.NontransactionalRead: true
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.NontransactionalWrite: true
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Optimistic: true
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.OptimizeIdCopy: false
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.OrphanedKeyAction: log
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.PostLoadOnMerge: false
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.ProxyManager: default
22:33:39,393 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.QueryCache: false
22:33:39,394 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.QueryCompilationCache: true
22:33:39,394 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.ReadLockLevel: 10
22:33:39,394 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.RefreshFromDataCache: false
22:33:39,394 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.RestoreState: 1
22:33:39,394 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.RetainState: true
22:33:39,394 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.RetryClassRegistration: false
22:33:39,395 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.RuntimeUnenhancedClasses: 0
22:33:39,395 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.SavepointManager: in-mem
22:33:39,395 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.Sequence: table
22:33:39,395 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.TransactionMode: true
22:33:39,395 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.WriteLockLevel: 20
22:33:39,396 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.DriverDataSource: auto
22:33:39,396 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.EagerFetchMode: 2
22:33:39,396 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.FetchDirection: 1000
22:33:39,396 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.FinderCache: true
22:33:39,396 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.IdentifierUtil: default
22:33:39,397 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.LRSSize: 2
22:33:39,397 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.MappingDefaults: jpa
22:33:39,397 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.QuerySQLCache: true
22:33:39,397 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.ResultSetType: 1003
22:33:39,397 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.SQLFactory: default
22:33:39,398 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.SchemaFactory: dynamic
22:33:39,398 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.Schemas: []
22:33:39,398 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.SubclassFetchMode: 1
22:33:39,398 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.SynchronizeMappings: null
22:33:39,398 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.TransactionIsolation: -1
22:33:39,398 ERROR [stderr] (http--127.0.0.1-8080-2) openjpa.jdbc.UpdateManager: default
22:33:39,399 ERROR [stderr] (http--127.0.0.1-8080-2) 139164  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Runtime - No cache marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
22:33:39,399 ERROR [stderr] (http--127.0.0.1-8080-2) 139164  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Using metadata factory "org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory@61e9e4be".
22:33:39,400 ERROR [stderr] (http--127.0.0.1-8080-2) 139165  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - OpenJPA will now connect to the database to attempt to determine what type of database dictionary to use. You may prevent this connection in the future by setting your openjpa.jdbc.DBDictionary configuration property to the appropriate value for your database (see the documentation for available values).
22:33:39,400 ERROR [stderr] (http--127.0.0.1-8080-2) 139165  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - createConnectionFactory: DataSource:org.jboss.jca.adapters.jdbc.WrapperDataSource@36cb1594
22:33:39,401 ERROR [stderr] (http--127.0.0.1-8080-2) 139166  EmployeeService  INFO   [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.5.20 ,MySQL-AB JDBC Driver mysql-connector-java-5.1.13 ( Revision: ${bzr.revision-id} )).
22:33:39,405 ERROR [stderr] (http--127.0.0.1-8080-2) 139170  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - catalogSeparator: .
22:33:39,405 ERROR [stderr] (http--127.0.0.1-8080-2) catalogTerm: database
22:33:39,405 ERROR [stderr] (http--127.0.0.1-8080-2) databaseProductName: MySQL
22:33:39,405 ERROR [stderr] (http--127.0.0.1-8080-2) databaseProductVersion: 5.5.20
22:33:39,405 ERROR [stderr] (http--127.0.0.1-8080-2) driverName: MySQL-AB JDBC Driver
22:33:39,405 ERROR [stderr] (http--127.0.0.1-8080-2) driverVersion: mysql-connector-java-5.1.13 ( Revision: ${bzr.revision-id} )
22:33:39,406 ERROR [stderr] (http--127.0.0.1-8080-2) extraNameCharacters: #@
22:33:39,406 ERROR [stderr] (http--127.0.0.1-8080-2) identifierQuoteString: `
22:33:39,406 ERROR [stderr] (http--127.0.0.1-8080-2) numericFunctions: ABS,ACOS,ASIN,ATAN,ATAN2,BIT_COUNT,CEILING,COS,COT,DEGREES,EXP,FLOOR,LOG,LOG10,MAX,MIN,MOD,PI,POW,POWER,RADIANS,RAND,ROUND,SIN,SQRT,TAN,TRUNCATE
22:33:39,406 ERROR [stderr] (http--127.0.0.1-8080-2) procedureTerm: PROCEDURE
22:33:39,406 ERROR [stderr] (http--127.0.0.1-8080-2) schemaTerm:
22:33:39,406 ERROR [stderr] (http--127.0.0.1-8080-2) searchStringEscape: \
22:33:39,407 ERROR [stderr] (http--127.0.0.1-8080-2) sqlKeywords: ACCESSIBLE,ANALYZE,ASENSITIVE,BEFORE,BIGINT,BINARY,BLOB,CALL,CHANGE,CONDITION,DATABASE,DATABASES,DAY_HOUR,DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DELAYED,DETERMINISTIC,DISTINCTROW,DIV,DUAL,EACH,ELSEIF,ENCLOSED,ESCAPED,EXIT,EXPLAIN,FLOAT4,FLOAT8,FORCE,FULLTEXT,HIGH_PRIORITY,HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,IF,IGNORE,INFILE,INOUT,INT1,INT2,INT3,INT4,INT8,ITERATE,KEYS,KILL,LEAVE,LIMIT,LINEAR,LINES,LOAD,LOCALTIME,LOCALTIMESTAMP,LOCK,LONG,LONGBLOB,LONGTEXT,LOOP,LOW_PRIORITY,MEDIUMBLOB,MEDIUMINT,MEDIUMTEXT,MIDDLEINT,MINUTE_MICROSECOND,MINUTE_SECOND,MOD,MODIFIES,NO_WRITE_TO_BINLOG,OPTIMIZE,OPTIONALLY,OUT,OUTFILE,PURGE,RANGE,READS,READ_ONLY,READ_WRITE,REGEXP,RELEASE,RENAME,REPEAT,REPLACE,REQUIRE,RETURN,RLIKE,SCHEMAS,SECOND_MICROSECOND,SENSITIVE,SEPARATOR,SHOW,SPATIAL,SPECIFIC,SQLEXCEPTION,SQL_BIG_RESULT,SQL_CALC_FOUND_ROWS,SQL_SMALL_RESULT,SSL,STARTING,STRAIGHT_JOIN,TERMINATED,TINYBLOB,TINYINT,TINYTEXT,TRIGGER,UNDO,UNLOCK,UNSIGNED,USE,UTC_DATE,UTC_TIME,UTC_TIMESTAMP,VARBINARY,VARCHARACTER,WHILE,X509,XOR,YEAR_MONTH,ZEROFILL
22:33:39,408 ERROR [stderr] (http--127.0.0.1-8080-2) stringFunctions: ASCII,BIN,BIT_LENGTH,CHAR,CHARACTER_LENGTH,CHAR_LENGTH,CONCAT,CONCAT_WS,CONV,ELT,EXPORT_SET,FIELD,FIND_IN_SET,HEX,INSERT,INSTR,LCASE,LEFT,LENGTH,LOAD_FILE,LOCATE,LOCATE,LOWER,LPAD,LTRIM,MAKE_SET,MATCH,MID,OCT,OCTET_LENGTH,ORD,POSITION,QUOTE,REPEAT,REPLACE,REVERSE,RIGHT,RPAD,RTRIM,SOUNDEX,SPACE,STRCMP,SUBSTRING,SUBSTRING,SUBSTRING,SUBSTRING,SUBSTRING_INDEX,TRIM,UCASE,UPPER
22:33:39,409 ERROR [stderr] (http--127.0.0.1-8080-2) systemFunctions: DATABASE,USER,SYSTEM_USER,SESSION_USER,PASSWORD,ENCRYPT,LAST_INSERT_ID,VERSION
22:33:39,409 ERROR [stderr] (http--127.0.0.1-8080-2) timeDateFunctions: DAYOFWEEK,WEEKDAY,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,PERIOD_ADD,PERIOD_DIFF,TO_DAYS,FROM_DAYS,DATE_FORMAT,TIME_FORMAT,CURDATE,CURRENT_DATE,CURTIME,CURRENT_TIME,NOW,SYSDATE,CURRENT_TIMESTAMP,UNIX_TIMESTAMP,FROM_UNIXTIME,SEC_TO_TIME,TIME_TO_SEC
22:33:39,410 ERROR [stderr] (http--127.0.0.1-8080-2) url: jdbc:mysql://localhost:3306/testDB
22:33:39,410 ERROR [stderr] (http--127.0.0.1-8080-2) userName: root@localhost
22:33:39,410 ERROR [stderr] (http--127.0.0.1-8080-2) defaultTransactionIsolation: 2
22:33:39,410 ERROR [stderr] (http--127.0.0.1-8080-2) driverMajorVersion: 5
22:33:39,410 ERROR [stderr] (http--127.0.0.1-8080-2) driverMinorVersion: 1
22:33:39,411 ERROR [stderr] (http--127.0.0.1-8080-2) maxBinaryLiteralLength: 16777208
22:33:39,411 ERROR [stderr] (http--127.0.0.1-8080-2) maxCatalogNameLength: 32
22:33:39,411 ERROR [stderr] (http--127.0.0.1-8080-2) maxCharLiteralLength: 16777208
22:33:39,411 ERROR [stderr] (http--127.0.0.1-8080-2) maxColumnNameLength: 64
22:33:39,411 ERROR [stderr] (http--127.0.0.1-8080-2) maxColumnsInGroupBy: 64
22:33:39,412 ERROR [stderr] (http--127.0.0.1-8080-2) maxColumnsInIndex: 16
22:33:39,412 ERROR [stderr] (http--127.0.0.1-8080-2) maxColumnsInOrderBy: 64
22:33:39,412 ERROR [stderr] (http--127.0.0.1-8080-2) maxColumnsInSelect: 256
22:33:39,412 ERROR [stderr] (http--127.0.0.1-8080-2) maxColumnsInTable: 512
22:33:39,412 ERROR [stderr] (http--127.0.0.1-8080-2) maxConnections: 0
22:33:39,413 ERROR [stderr] (http--127.0.0.1-8080-2) maxCursorNameLength: 64
22:33:39,413 ERROR [stderr] (http--127.0.0.1-8080-2) maxIndexLength: 256
22:33:39,413 ERROR [stderr] (http--127.0.0.1-8080-2) maxProcedureNameLength: 0
22:33:39,413 ERROR [stderr] (http--127.0.0.1-8080-2) maxRowSize: 2147483639
22:33:39,413 ERROR [stderr] (http--127.0.0.1-8080-2) maxSchemaNameLength: 0
22:33:39,413 ERROR [stderr] (http--127.0.0.1-8080-2) maxStatementLength: 65531
22:33:39,414 ERROR [stderr] (http--127.0.0.1-8080-2) maxStatements: 0
22:33:39,414 ERROR [stderr] (http--127.0.0.1-8080-2) maxTableNameLength: 64
22:33:39,414 ERROR [stderr] (http--127.0.0.1-8080-2) maxTablesInSelect: 256
22:33:39,414 ERROR [stderr] (http--127.0.0.1-8080-2) maxUserNameLength: 16
22:33:39,414 ERROR [stderr] (http--127.0.0.1-8080-2) isCatalogAtStart: true
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) isReadOnly: false
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) nullPlusNonNullIsNull: true
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) nullsAreSortedAtEnd: false
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) nullsAreSortedAtStart: false
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) nullsAreSortedHigh: false
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) nullsAreSortedLow: true
22:33:39,415 ERROR [stderr] (http--127.0.0.1-8080-2) storesLowerCaseIdentifiers: false
22:33:39,416 ERROR [stderr] (http--127.0.0.1-8080-2) storesLowerCaseQuotedIdentifiers: false
22:33:39,416 ERROR [stderr] (http--127.0.0.1-8080-2) storesMixedCaseIdentifiers: true
22:33:39,416 ERROR [stderr] (http--127.0.0.1-8080-2) storesMixedCaseQuotedIdentifiers: true
22:33:39,416 ERROR [stderr] (http--127.0.0.1-8080-2) storesUpperCaseIdentifiers: false
22:33:39,416 ERROR [stderr] (http--127.0.0.1-8080-2) storesUpperCaseQuotedIdentifiers: true
22:33:39,416 ERROR [stderr] (http--127.0.0.1-8080-2) supportsAlterTableWithAddColumn: true
22:33:39,417 ERROR [stderr] (http--127.0.0.1-8080-2) supportsAlterTableWithDropColumn: true
22:33:39,417 ERROR [stderr] (http--127.0.0.1-8080-2) supportsANSI92EntryLevelSQL: true
22:33:39,417 ERROR [stderr] (http--127.0.0.1-8080-2) supportsANSI92FullSQL: false
22:33:39,417 ERROR [stderr] (http--127.0.0.1-8080-2) supportsANSI92IntermediateSQL: false
22:33:39,417 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCatalogsInDataManipulation: true
22:33:39,417 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCatalogsInIndexDefinitions: true
22:33:39,418 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCatalogsInPrivilegeDefinitions: true
22:33:39,418 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCatalogsInProcedureCalls: true
22:33:39,418 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCatalogsInTableDefinitions: true
22:33:39,419 ERROR [stderr] (http--127.0.0.1-8080-2) supportsColumnAliasing: true
22:33:39,419 ERROR [stderr] (http--127.0.0.1-8080-2) supportsConvert: false
22:33:39,419 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCoreSQLGrammar: true
22:33:39,419 ERROR [stderr] (http--127.0.0.1-8080-2) supportsCorrelatedSubqueries: true
22:33:39,419 ERROR [stderr] (http--127.0.0.1-8080-2) supportsDataDefinitionAndDataManipulationTransactions: false
22:33:39,420 ERROR [stderr] (http--127.0.0.1-8080-2) supportsDataManipulationTransactionsOnly: false
22:33:39,420 ERROR [stderr] (http--127.0.0.1-8080-2) supportsDifferentTableCorrelationNames: true
22:33:39,420 ERROR [stderr] (http--127.0.0.1-8080-2) supportsExpressionsInOrderBy: true
22:33:39,420 ERROR [stderr] (http--127.0.0.1-8080-2) supportsExtendedSQLGrammar: false
22:33:39,420 ERROR [stderr] (http--127.0.0.1-8080-2) supportsFullOuterJoins: false
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsGroupBy: true
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsGroupByBeyondSelect: true
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsGroupByUnrelated: true
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsIntegrityEnhancementFacility: false
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsLikeEscapeClause: true
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsLimitedOuterJoins: true
22:33:39,421 ERROR [stderr] (http--127.0.0.1-8080-2) supportsMinimumSQLGrammar: true
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsMixedCaseIdentifiers: true
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsMixedCaseQuotedIdentifiers: true
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsMultipleResultSets: false
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsMultipleTransactions: true
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsNonNullableColumns: true
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsOpenCursorsAcrossCommit: false
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsOpenCursorsAcrossRollback: false
22:33:39,422 ERROR [stderr] (http--127.0.0.1-8080-2) supportsOpenStatementsAcrossCommit: false
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsOpenStatementsAcrossRollback: false
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsOrderByUnrelated: false
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsOuterJoins: true
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsPositionedDelete: false
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsPositionedUpdate: false
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSchemasInDataManipulation: false
22:33:39,423 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSchemasInIndexDefinitions: false
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSchemasInPrivilegeDefinitions: false
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSchemasInProcedureCalls: false
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSchemasInTableDefinitions: false
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSelectForUpdate: true
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsStoredProcedures: true
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSubqueriesInComparisons: true
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSubqueriesInExists: true
22:33:39,424 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSubqueriesInIns: true
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) supportsSubqueriesInQuantifieds: true
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) supportsTableCorrelationNames: true
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) supportsTransactions: true
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) supportsUnion: true
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) supportsUnionAll: true
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) usesLocalFilePerTable: false
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) usesLocalFiles: false
22:33:39,425 ERROR [stderr] (http--127.0.0.1-8080-2) allProceduresAreCallable: false
22:33:39,426 ERROR [stderr] (http--127.0.0.1-8080-2) allTablesAreSelectable: false
22:33:39,426 ERROR [stderr] (http--127.0.0.1-8080-2) dataDefinitionCausesTransactionCommit: true
22:33:39,426 ERROR [stderr] (http--127.0.0.1-8080-2) dataDefinitionIgnoredInTransactions: false
22:33:39,426 ERROR [stderr] (http--127.0.0.1-8080-2) doesMaxRowSizeIncludeBlobs: true
22:33:39,426 ERROR [stderr] (http--127.0.0.1-8080-2) supportsBatchUpdates: true
22:33:39,426 ERROR [stderr] (http--127.0.0.1-8080-2) 139191  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - Initial connection autoCommit: true, holdability: 2, TransactionIsolation: 4
22:33:39,427 ERROR [stderr] (http--127.0.0.1-8080-2) 139192  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - <t 1160114731, conn 1118349354> [0 ms] close
22:33:39,427 ERROR [stderr] (http--127.0.0.1-8080-2) 139192  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - createConnectionFactory: DataSource:org.jboss.jca.adapters.jdbc.WrapperDataSource@36cb1594
22:33:39,428 ERROR [stderr] (http--127.0.0.1-8080-2) 139193  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - <t 1160114731, conn 1607615466> [0 ms] close
22:33:39,430 ERROR [stderr] (http--127.0.0.1-8080-2) 139195  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Runtime - Found datasource1: datasource 919278996 from configuration. StoreContext: org.apache.openjpa.kernel.BrokerImpl@4a8b9b70
22:33:39,432 ERROR [stderr] (http--127.0.0.1-8080-2) 139197  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Scanning URL "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" for persistent types.
22:33:39,433 ERROR [stderr] (http--127.0.0.1-8080-2) 139198  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Scan of "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" found persistent types [].
22:33:39,433 ERROR [stderr] (http--127.0.0.1-8080-2) 139198  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Skipping persistent type location association for location "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" since it is a directory.
22:33:39,434 ERROR [stderr] (http--127.0.0.1-8080-2) 139199  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Scanning resource "META-INF/orm.xml" for persistent types.
22:33:39,435 ERROR [stderr] (http--127.0.0.1-8080-2) 139200  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - The persistent unit root url is "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/"
22:33:39,436 ERROR [stderr] (http--127.0.0.1-8080-2) 139201  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - parsePersistentTypeNames() found [jpa.Employee].
22:33:39,436 ERROR [stderr] (http--127.0.0.1-8080-2) 139201  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Found 1 classes with metadata in 4 milliseconds.
22:33:39,439 ERROR [stderr] (http--127.0.0.1-8080-2) 139204  EmployeeService  WARN   [http--127.0.0.1-8080-2] openjpa.Enhance - Creating subclass for "[class jpa.Employee]". This means that your application will be less efficient and will consume more memory than it would if you ran the OpenJPA enhancer. Additionally, lazy loading will not be available for one-to-one and many-to-one persistent attributes in types using field access; they will be loaded eagerly instead.
22:33:39,441 ERROR [stderr] (http--127.0.0.1-8080-2) 139206  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Runtime - No cache marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
22:33:39,441 ERROR [stderr] (http--127.0.0.1-8080-2) 139206  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Using metadata factory "org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory@4812eb99".
22:33:39,442 ERROR [stderr] (http--127.0.0.1-8080-2) 139207  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Loading metadata for "class jpa.Employee" under mode "[META]".
22:33:39,442 ERROR [stderr] (http--127.0.0.1-8080-2) 139207  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Scanning URL "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" for persistent types.
22:33:39,443 ERROR [stderr] (http--127.0.0.1-8080-2) 139208  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Scan of "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" found persistent types [].
22:33:39,443 ERROR [stderr] (http--127.0.0.1-8080-2) 139208  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Skipping persistent type location association for location "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/" since it is a directory.
22:33:39,443 ERROR [stderr] (http--127.0.0.1-8080-2) 139208  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Scanning resource "META-INF/orm.xml" for persistent types.
22:33:39,444 ERROR [stderr] (http--127.0.0.1-8080-2) 139209  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - The persistent unit root url is "vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/"
22:33:39,444 ERROR [stderr] (http--127.0.0.1-8080-2) 139209  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - parsePersistentTypeNames() found [jpa.Employee].
22:33:39,444 ERROR [stderr] (http--127.0.0.1-8080-2) 139209  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Found 1 classes with metadata in 2 milliseconds.
22:33:39,445 ERROR [stderr] (http--127.0.0.1-8080-2) 139210  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Parsing class "jpa.Employee".
22:33:39,445 ERROR [stderr] (http--127.0.0.1-8080-2) 139210  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Parsing package "jpa.Employee".
22:33:39,448 ERROR [stderr] (http--127.0.0.1-8080-2) 139213  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Generating default metadata for type "jpa.Employee".
22:33:39,449 ERROR [stderr] (http--127.0.0.1-8080-2) 139214  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Using reflection for metadata generation.
22:33:39,451 ERROR [stderr] (http--127.0.0.1-8080-2) 139216  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Set persistence-capable superclass of "jpa.Employee" to "null".
22:33:39,451 ERROR [stderr] (http--127.0.0.1-8080-2) 139216  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Resolving metadata for "jpa.Employee@1378463430".
22:33:39,451 ERROR [stderr] (http--127.0.0.1-8080-2) 139216  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@1378463430.empno".
22:33:39,452 ERROR [stderr] (http--127.0.0.1-8080-2) 139217  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@1378463430.ename".
22:33:39,452 ERROR [stderr] (http--127.0.0.1-8080-2) 139217  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Preparing mapping for "jpa.Employee".
22:33:39,452 ERROR [stderr] (http--127.0.0.1-8080-2) 139217  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@1378463430.empno".
22:33:39,453 ERROR [stderr] (http--127.0.0.1-8080-2) 139218  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	"empno" has mapping strategy "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
22:33:39,453 ERROR [stderr] (http--127.0.0.1-8080-2) 139218  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@1378463430.ename".
22:33:39,453 ERROR [stderr] (http--127.0.0.1-8080-2) 139218  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	"ename" has mapping strategy "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
22:33:39,454 ERROR [stderr] (http--127.0.0.1-8080-2) 139219  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - "jpa.Employee<discriminator>" has mapping strategy "none".
22:33:39,454 ERROR [stderr] (http--127.0.0.1-8080-2) 139219  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - "jpa.Employee<version>" has mapping strategy "none".
22:33:39,454 ERROR [stderr] (http--127.0.0.1-8080-2) 139219  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Resolving mapping for "jpa.Employee@1378463430".
22:33:39,455 ERROR [stderr] (http--127.0.0.1-8080-2) 139220  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - "jpa.Employee" has mapping strategy "full".
22:33:39,455 ERROR [stderr] (http--127.0.0.1-8080-2) 139220  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Enhance - Enhancing type "class jpa.Employee" loaded by ModuleClassLoader for Module "deployment.JPA_BASIC_Demo.war:main" from Service Module Loader.
22:33:39,475 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@206ab4f
22:33:39,477 ERROR [stderr] (http--127.0.0.1-8080-2) 139242  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Loading metadata for "class jpa.Employee" under mode "[META][QUERY]".
22:33:39,477 ERROR [stderr] (http--127.0.0.1-8080-2) 139242  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Parsing class "jpa.Employee".
22:33:39,477 ERROR [stderr] (http--127.0.0.1-8080-2) 139242  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Parsing package "jpa.Employee".
22:33:39,478 ERROR [stderr] (http--127.0.0.1-8080-2) 139243  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Generating default metadata for type "jpa.Employee".
22:33:39,480 ERROR [stderr] (http--127.0.0.1-8080-2) 139245  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Set persistence-capable superclass of "jpa.Employee" to "null".
22:33:39,480 ERROR [stderr] (http--127.0.0.1-8080-2) 139245  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Resolving metadata for "jpa.Employee@64540819".
22:33:39,481 ERROR [stderr] (http--127.0.0.1-8080-2) 139246  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@64540819.empno".
22:33:39,481 ERROR [stderr] (http--127.0.0.1-8080-2) 139246  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@64540819.ename".
22:33:39,481 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@f6564de
22:33:39,481 ERROR [stderr] (http--127.0.0.1-8080-2) 139246  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Preparing mapping for "jpa.Employee".
22:33:39,482 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@49c132b7
22:33:39,482 ERROR [stderr] (http--127.0.0.1-8080-2) 139247  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,482 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@2ae8b235
22:33:39,483 ERROR [stderr] (http--127.0.0.1-8080-2) 139248  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,483 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@130bcb95
22:33:39,483 ERROR [stderr] (http--127.0.0.1-8080-2) 139248  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,484 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@6b62acf7
22:33:39,484 ERROR [stderr] (http--127.0.0.1-8080-2) 139249  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,484 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@1b49c335
22:33:39,485 ERROR [stderr] (http--127.0.0.1-8080-2) 139250  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,485 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@7aeda92
22:33:39,486 ERROR [stderr] (http--127.0.0.1-8080-2) 139251  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,486 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@688fab2e
22:33:39,486 ERROR [stderr] (http--127.0.0.1-8080-2) 139251  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,487 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@302f8ea3
22:33:39,487 ERROR [stderr] (http--127.0.0.1-8080-2) 139252  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,488 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@23d880c
22:33:39,488 ERROR [stderr] (http--127.0.0.1-8080-2) 139253  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,488 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@15aeccfa
22:33:39,489 ERROR [stderr] (http--127.0.0.1-8080-2) 139254  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,489 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@7133c35
22:33:39,489 ERROR [stderr] (http--127.0.0.1-8080-2) 139254  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,490 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@7fd5bf33
22:33:39,490 ERROR [stderr] (http--127.0.0.1-8080-2) 139255  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,490 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@29fbeed6
22:33:39,490 ERROR [stderr] (http--127.0.0.1-8080-2) 139255  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,491 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@5afd3922
22:33:39,491 ERROR [stderr] (http--127.0.0.1-8080-2) 139256  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,491 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@26b215d9
22:33:39,492 ERROR [stderr] (http--127.0.0.1-8080-2) 139257  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,492 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@75b86d67
22:33:39,492 ERROR [stderr] (http--127.0.0.1-8080-2) 139257  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,492 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@1f16c192
22:33:39,493 ERROR [stderr] (http--127.0.0.1-8080-2) 139258  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,493 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@efe6830
22:33:39,493 ERROR [stderr] (http--127.0.0.1-8080-2) 139258  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,496 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@606a2f00
22:33:39,496 ERROR [stderr] (http--127.0.0.1-8080-2) 139261  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,497 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@5b33da73
22:33:39,497 ERROR [stderr] (http--127.0.0.1-8080-2) 139262  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Processing registered persistence-capable class "class jpa.Employee".
22:33:39,497 ERROR [stderr] (http--127.0.0.1-8080-2) 139262  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@64540819.empno".
22:33:39,498 ERROR [stderr] (http--127.0.0.1-8080-2) 139263  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	"empno" has mapping strategy "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
22:33:39,499 ERROR [stderr] (http--127.0.0.1-8080-2) 139264  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@64540819.ename".
22:33:39,499 ERROR [stderr] (http--127.0.0.1-8080-2) 139264  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	"ename" has mapping strategy "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
22:33:39,500 ERROR [stderr] (http--127.0.0.1-8080-2) 139265  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - "jpa.Employee<discriminator>" has mapping strategy "none".
22:33:39,500 ERROR [stderr] (http--127.0.0.1-8080-2) 139265  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - "jpa.Employee<version>" has mapping strategy "none".
22:33:39,501 ERROR [stderr] (http--127.0.0.1-8080-2) 139266  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Resolving mapping for "jpa.Employee@64540819".
22:33:39,501 ERROR [stderr] (http--127.0.0.1-8080-2) 139266  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - "jpa.Employee" has mapping strategy "full".
22:33:39,501 ERROR [stderr] (http--127.0.0.1-8080-2) 139266  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - Initializing mapping for "jpa.Employee@64540819".
22:33:39,501 ERROR [stderr] (http--127.0.0.1-8080-2) 139266  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@64540819.empno".
22:33:39,502 ERROR [stderr] (http--127.0.0.1-8080-2) 139267  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.MetaData - 	Resolving field "jpa.Employee@64540819.ename".
22:33:39,502 ERROR [stderr] (http--127.0.0.1-8080-2) 139267  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Runtime - org.apache.openjpa.persistence.EntityManagerFactoryImpl@874aa79 created EntityManager org.apache.openjpa.persistence.EntityManagerImpl@4a8b9b70.
22:33:39,503 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@294ae2cc
22:33:39,505 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: org.apache.openjpa.enhance.jpa$Employee$pcsubclass@4555333c
22:33:39,506 INFO  [stdout] (http--127.0.0.1-8080-2)
22:33:39,506 INFO  [stdout] (http--127.0.0.1-8080-2) 	[EmployeeService] Before findEmployee(id)
22:33:39,507 INFO  [stdout] (http--127.0.0.1-8080-2)
22:33:39,507 INFO  [stdout] (http--127.0.0.1-8080-2) 	 Inside findEmployee(67)
22:33:39,507 INFO  [stdout] (http--127.0.0.1-8080-2)
22:33:39,507 INFO  [stdout] (http--127.0.0.1-8080-2) 	[EmployeeService] Inside createEmployee() findEmployee result: jpa.Employee@7345a749
22:33:39,507 ERROR [stderr] (http--127.0.0.1-8080-2) 139272  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.SQLDiag - flush: org.apache.openjpa.kernel.PNewState for oid=67
22:33:39,508 ERROR [stderr] (http--127.0.0.1-8080-2) 139273  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - The batch limit is set to 0.
22:33:39,508 ERROR [stderr] (http--127.0.0.1-8080-2) 139273  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.SQL - <t 1160114731, conn 1553386419> executing prepstmnt 1335485472 INSERT INTO Employee (empno, ename) VALUES (?, ?) [params=?, ?]
22:33:39,579 ERROR [stderr] (http--127.0.0.1-8080-2) 139344  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.SQL - <t 1160114731, conn 1553386419> [70 ms] spent
22:33:39,580 ERROR [stderr] (http--127.0.0.1-8080-2) 139345  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.Runtime - org.apache.openjpa.persistence.EntityManagerImpl@4a8b9b70.close() invoked.
22:33:39,580 ERROR [stderr] (http--127.0.0.1-8080-2) 139345  EmployeeService  TRACE  [http--127.0.0.1-8080-2] openjpa.jdbc.JDBC - <t 1160114731, conn 1553386419> [0 ms] close
22:33:39,600 INFO  [stdout] (http--127.0.0.1-8080-2) Employee Object Created. this: jpa.Employee@42c16479
22:33:39,601 INFO  [stdout] (http--127.0.0.1-8080-2)
22:33:39,601 INFO  [stdout] (http--127.0.0.1-8080-2) 	 Hello World...

.

=======================================================================

Some Issues You Might Face

=======================================================================

Issue-1

If you dont declare the property name=”jboss.as.jpa.providerModule” value=”org.apache.openjpa” in your “persistence.xml” file then you might see following exception while deploying your OpenJPA JPA:

22:39:34,646 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."JPA_BASIC_Demo.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."JPA_BASIC_Demo.war".INSTALL: Failed to process phase INSTALL of deployment "JPA_BASIC_Demo.war"
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_24]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_24]
	at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
Caused by: javax.persistence.PersistenceException: JBAS011466: PersistenceProvider 'org.apache.openjpa.persistence.PersistenceProviderImpl' not found
	at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.lookupProvider(PersistenceUnitDeploymentProcessor.java:555)
	at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:295)
	at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
	at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleWarDeployment(PersistenceUnitDeploymentProcessor.java:194)
	at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:118)
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	... 5 more

Issue-2

If the above code “TestServlet.java” If you will invoke two Operations on the entity then you may get following exceptions. To reproduce this issue just uncomment the following section in the “TestServlet.java”:


                        remote.createEmployee(new Integer(request.getParameter("empId")),request.getParameter("empName"));
                        out.println("Everything is OK till Here ...");

                        /*
                         If i call the "remote.findAllEmployees()" Now then i get an Exception here .... Only with OpenJPA
                         (where as it works well with TopLink and Hibernate)
                        */                   

                        Collection<Employee> employees=remote.findAllEmployees();   //----> This line throws the following exception

You will see the following kind of “ClassNotFoundException”

23:00:04,399 ERROR [stderr] (http--127.0.0.1-8080-1) java.lang.RuntimeException: ClassNotFoundException marshaling EJB parameters
23:00:04,400 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:229)
23:00:04,400 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:216)
23:00:04,400 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:188)
23:00:04,400 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)
23:00:04,401 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)
23:00:04,401 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
23:00:04,401 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
23:00:04,402 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
23:00:04,402 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
23:00:04,402 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
23:00:04,402 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
23:00:04,403 ERROR [stderr] (http--127.0.0.1-8080-1) 	at $Proxy19.findAllEmployees(Unknown Source)
23:00:04,403 ERROR [stderr] (http--127.0.0.1-8080-1) 	at servlets.TestServlet.service(Unknown Source)
23:00:04,403 ERROR [stderr] (http--127.0.0.1-8080-1) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
23:00:04,403 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
23:00:04,403 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
23:00:04,404 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
23:00:04,404 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
23:00:04,404 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
23:00:04,404 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
23:00:04,405 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
23:00:04,405 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
23:00:04,405 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
23:00:04,405 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
23:00:04,406 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
23:00:04,406 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
23:00:04,406 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
23:00:04,406 ERROR [stderr] (http--127.0.0.1-8080-1) 	at java.lang.Thread.run(Thread.java:679)
23:00:04,407 ERROR [stderr] (http--127.0.0.1-8080-1) Caused by: java.lang.ClassNotFoundException: org.apache.openjpa.enhance.jpa$Employee$pcsubclass from [Module "deployment.JPA_BASIC_Demo.war:main" from Service Module Loader]
23:00:04,407 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
23:00:04,407 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
23:00:04,408 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
23:00:04,408 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
23:00:04,408 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
23:00:04,408 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
23:00:04,408 ERROR [stderr] (http--127.0.0.1-8080-1) 	at java.lang.Class.forName0(Native Method)
23:00:04,409 ERROR [stderr] (http--127.0.0.1-8080-1) 	at java.lang.Class.forName(Class.java:264)
23:00:04,409 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.cloner.ClassLoaderClassCloner.clone(ClassLoaderClassCloner.java:46)
23:00:04,409 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:158)
23:00:04,409 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)
23:00:04,409 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:187)
23:00:04,410 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)
23:00:04,410 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.cloner.SerializingCloner$StepObjectInput.doReadObject(SerializingCloner.java:738)
23:00:04,410 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
23:00:04,410 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:57)

Issue-3

If you wont Specify the following properties in your “persistence.xml” file then you may encounter the following exceptions:

           <!--   IMPORTANT PROPERTIES FOR openJPA -->
           <property name="openjpa.DynamicEnhancementAgent" value="false"/>
           <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />

Following exceptions you will encounter …

22:43:47,285 ERROR [org.jboss.ejb3.invocation] (http--127.0.0.1-8080-1) JBAS014134: EJB Invocation failed on component EmployeeService for method public abstract jpa.Employee jpa.EmployeeServiceRemote.createEmployee(java.lang.Integer,java.lang.String): javax.ejb.EJBException: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class jpa.Employee" has not been enhanced.

	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:80) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:179) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
	at $Proxy15.createEmployee(Unknown Source)	at servlets.TestServlet.service(Unknown Source) [classes:]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
	at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
	at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]

Caused by: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class jpa.Employee" has not been enhanced.
	at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1823) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1797) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:822) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:719) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:643) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:411) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:384) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1262) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:316) [openjpa-all-2.2.0.jar:2.2.0]
	at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:486) [openjpa-all-2.2.0.jar:2.2.0]
	at org.jboss.as.jpa.container.AbstractEntityManager.find(AbstractEntityManager.java:193) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
	at jpa.EmployeeService.findEmployee(Unknown Source) [classes:]
	at jpa.EmployeeService.createEmployee(Unknown Source) [classes:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_24]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.6.0_24]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.6.0_24]
	at java.lang.reflect.Method.invoke(Method.java:616) [rt.jar:1.6.0_24]
	at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
	... 43 more

22:43:47,461 ERROR [stderr] (http--127.0.0.1-8080-1) javax.ejb.EJBException: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class jpa.Employee" has not been enhanced.

22:43:47,462 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
22:43:47,462 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
22:43:47,462 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
22:43:47,462 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
22:43:47,463 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,463 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:80)
22:43:47,463 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,463 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
22:43:47,464 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,464 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
22:43:47,464 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,464 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
22:43:47,465 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,465 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32)
22:43:47,465 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,465 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
22:43:47,466 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
22:43:47,466 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
22:43:47,466 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
22:43:47,466 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:179)
22:43:47,467 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)
22:43:47,467 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)
22:43:47,467 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
22:43:47,468 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
22:43:47,468 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
22:43:47,468 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
22:43:47,469 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
22:43:47,469 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
22:43:47,469 ERROR [stderr] (http--127.0.0.1-8080-1) 	at $Proxy15.createEmployee(Unknown Source)
22:43:47,469 ERROR [stderr] (http--127.0.0.1-8080-1) 	at servlets.TestServlet.service(Unknown Source)
22:43:47,469 ERROR [stderr] (http--127.0.0.1-8080-1) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
22:43:47,470 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
22:43:47,470 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
22:43:47,470 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
22:43:47,470 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
22:43:47,471 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
22:43:47,471 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
22:43:47,471 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
22:43:47,471 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
22:43:47,472 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
22:43:47,472 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
22:43:47,472 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
22:43:47,472 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
22:43:47,473 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
22:43:47,473 ERROR [stderr] (http--127.0.0.1-8080-1) 	at java.lang.Thread.run(Thread.java:679)

22:43:47,473 ERROR [stderr] (http--127.0.0.1-8080-1) Caused by: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class jpa.Employee" has not been enhanced.
22:43:47,474 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1823)
22:43:47,474 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1797)
22:43:47,474 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:822)
22:43:47,475 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:719)
22:43:47,475 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:643)
22:43:47,475 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:411)
22:43:47,475 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:384)
22:43:47,475 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1262)
22:43:47,476 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:316)
22:43:47,476 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:486)
22:43:47,476 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.jpa.container.AbstractEntityManager.find(AbstractEntityManager.java:193)
22:43:47,476 ERROR [stderr] (http--127.0.0.1-8080-1) 	at jpa.EmployeeService.findEmployee(Unknown Source)
22:43:47,477 ERROR [stderr] (http--127.0.0.1-8080-1) 	at jpa.EmployeeService.createEmployee(Unknown Source)

Issue-4

In the above JBoss Console Outputs you will notice that JBoss is showing “ERROR” for most of the things where the Open JPA TRACE log is showing a successful execution,. Means Even if the Execution is successful JBoss is showing ERROR.

.
.
Thanks
Middleware Magic Team :)


JPA2 with Oracle TopLink 12c (12.1.1) in JBossAS7.1.1

Hi,

The Java Persistence Architecture API (JPA) is a Java specification for accessing, persisting, and managing data between Java objects / classes and a relational database. JPA was defined as part of the EJB 3.0 specification as a replacement for the EJB 2 CMP Entity Beans specification. JPA is now considered the standard industry approach for Object to Relational Mapping (ORM) in the Java Industry.

The JBoss Application Server JPA subsystem implements the JPA 2.0 container-managed requirements. JPA Applications use the Hibernate (core) 4.0 persistence provider, that is included with JBoss AS. Hibernate 4 is packaged with the AS and is the default persistence provider. The JPA 2.0 Specifications can be found in the following link: http://jcp.org/aboutJava/communityprocess/pfd/jsr317/index.html

A Best reference for JPA features inside JBoss AS7 can be foun in the following link: https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide

However in this current Demo we will just create a Simple JPA persistence unit With the help of “Oracle TopLink 12c (12.1.1)” and then we will try to insert some employee detils insie the DataBase. So basically this is just as a startup.

In this example we will mainly focus on following points

Point-1). We will see how to use “Oracle TopLink 12c (12.1.1)” with JBossAS7.1.1.Final.

Point-2). For Web Applications we should put the “persistence.xml” file inside “${WEB_APPLICATION}/WEB-INF/classes/META-INF/persistence.xml” AND For EJB Applications we should put the “persistence.xml” file inside “${EJB_JAR}/META-INF”

Point-3). To inject the EntityManager inside our Web Components we can use the annotation @javax.persistence.PersistenceContext(unitName=”name”)

Point-4). We can use the @javax.ejb.EJB annotation to inject an Enterprise Java Bean inside our app components. Like @EJB(lookup=”jndiName”)

Point-5). We will see what error we get when we dont define following property in our “persistence.xml” file while using Oracle topLink. < property name=”jboss.as.jpa.providerModule” value=”org.eclipse.persistence.jpa” />

Point-6). The Full Demo can be downloaded from the following Github repository:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/JPA2_And_Toplink_On_AS7

Creating DataSource On JBossAS7

Step-1). Here we are using JBoss AS7 latest build “jboss-as-7.1.1.Final” which can be downloaded from the following link: http://www.jboss.org/jbossas/downloads

Step-2). In order to get more details on how to create MySQL DataSource in JBoss AS7 you can refer to the following article: http://middlewaremagic.com/jboss/?p=872
Just place the “mysql-connector-java-5.1.13-bin.jar” MySQL Jdbc driver in your JBoss Deployments directory, Then create a DataSource inside “${JBOSS_HOME}/standalone/configuration/standalone-full.xml” file as following:

        <subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasources>

                <!-- Below is the DataSource Configuration which we added for our JPA TestCase-->
                <datasource jta="false" jndi-name="java:/MySqlDS" pool-name="MySqlDS_Pool" enabled="true" use-ccm="false">
                    <connection-url>jdbc:mysql://localhost:3306/testDB</connection-url>
                    <driver-class>com.mysql.jdbc.Driver</driver-class>
                    <driver>mysql-connector-java-5.1.13-bin.jar</driver>
                    <security>
                        <user-name>someDBUserName</user-name>
                        <password>someDBPassword</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

Creating Oracle Toplink Module In JBossAS7

Step-3). Download the “Oracle TopLink 12c (12.1.1)” toplink.zip (25,456,648 bytes) from the following link:
http://www.oracle.com/technetwork/middleware/toplink/downloads/index.html

Step-4). Extract the downloaded “toplink.zip” and then copy the two Jars placed insie the extracted “toplink/jlib” directory. The Jar names will be “toplink-grid.jar” And “eclipselink.jar”

Step-5). Create the following directory structure [jboss-as-7.1.1.Final/modules/org/eclipse/persistence/jpa/main] in your file system so that the Oracle TopLink Module can be created.

     .
     .  
     jboss-as-7.1.1.Final/modules/
     │  
     ├──org
     │   │  
     │   ├── eclipse
     │   │   └── persistence
     │   │       └── jpa
     │   │           └── main
     │   │               ├── eclipselink.jar
     │   │               ├
     │   │               ├── toplink-grid.jar
     │   │               ├
     │   │               ├── module.xml
     .
     .

Paste the “toplink-grid.jar” And “eclipselink.jar” from downloaded toplink s/w into the “jboss-as-7.1.1.Final/modules/org/eclipse/persistence/jpa/main” and then write the following kind of “module.xml” file:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence.jpa">
    <resources>
        <resource-root path="eclipselink.jar"/>
        <resource-root path="toplink-grid.jar"/>
    </resources>

        <dependencies>
            <module name="javax.persistence.api"/>
            <module name="javax.transaction.api"/>
            <module name="javax.validation.api"/>
        </dependencies>
</module>

Step-6). Restart your JBoss AS7 from inside “/home/userone/jboss-as-7.1.1.Final/bin” directory as following:

.
 ./standalone.sh -c standalone-full.xml
.

Developing Oracle Toplink JPA Demo

Step1). Create a directory somewhere in your filesystem like “/home/userone/JPA2_And_Toplink_On_AS7″ where we will place our application build related stuff. Then create another directory “src” inside “/home/userone/JPA2_And_Toplink_On_AS7″ where we will be placing our source codes and JSPs.

Step2). Now first of all we will create an Entity “Employee.java” as following inside the “/home/userone/JPA2_And_Toplink_On_AS7/src” directory.

package jpa;
import java.io.Serializable;
import javax.persistence.*;
import java.lang.Integer;

@Entity
@Table(name="Employee")
public class Employee implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private Integer empno;

	private String ename;

    public Employee() {
    	System.out.println("Employee Object Created. this: "+this);
    }

	public Integer getEmpno() {
		return this.empno;
	}

	public void setEmpno(Integer empno) {
		this.empno = empno;
	}

	public String getEname() {
		return this.ename;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

}

Step3). Now we will create a Simple Stateless SessionBean remote Interface “EmployeeServiceRemote.java” inside “/home/userone/JPA2_And_Toplink_On_AS7/src” directory as following:

package jpa;
import java.lang.Integer;
import java.util.Collection;
import javax.ejb.Remote;
@Remote

public interface EmployeeServiceRemote{
  public void doAction();
  public Employee createEmployee(Integer id, String name);
  public void removeEmployee(Integer id);
  public Employee findEmployee(Integer id);
  public Collection<Employee> findAllEmployees() ;

}

Step4). Now we will Stateless Session Bean class “EmployeeService.java” by implementing the interface “EmployeeServiceRemote.java”. Place this file as well inside the “/home/userone/JPA2_And_Toplink_On_AS7/src” directory as following:

package jpa;
import java.lang.Integer;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import javax.persistence.EntityTransaction;
import javax.ejb.*;

@Stateless
public class EmployeeService implements EmployeeServiceRemote {
  @PersistenceContext(unitName="EmployeeService")
  EntityManager em;

  public EmployeeService() {
	  System.out.println("\n\tEmployeeService  Object Created. this: "+this);
  }

  @TransactionAttribute (TransactionAttributeType.REQUIRED)
  public Employee createEmployee(Integer id, String name) {
    Employee emp = new Employee();
    emp.setEmpno(id);
    emp.setEname(name);
    System.out.println("\n\t[EmployeeService] Before em.persist(emp)");

    try{
         em.getTransaction().begin();
         em.persist(emp);
         em.flush();
         em.getTransaction().commit();
       }
    catch(Exception e)
       {
          e.printStackTrace();
          try{   em.getTransaction().rollback();   } catch(Exception ee)  {  ee.printStackTrace();  }
       }

    System.out.println("\n\t[EmployeeService] Before findEmployee(id)");
    emp = findEmployee(id);
    System.out.println("\n\t[EmployeeService] Inside createEmployee() findEmployee result: "+emp);
    return emp;
  }

  public void removeEmployee(Integer id) {
	System.out.println("\n\t Inside removeEmployee("+id+")");
    Employee emp = findEmployee(id);
    if (emp != null) {
       try{
            em.getTransaction().begin();
            em.remove(emp);
            em.getTransaction().commit();
          }
       catch(Exception e)
          {
             e.printStackTrace();
             try{   em.getTransaction().rollback();   } catch(Exception ee)  {  ee.printStackTrace();  }
          }
    }
  }

  public Employee findEmployee(Integer id) {
	System.out.println("\n\t Inside findEmployee("+id+")");
    return em.find(Employee.class, id);
  }

  @SuppressWarnings("unchecked")
  public Collection<Employee> findAllEmployees() {
	System.out.println("\n\t Inside findAllEmployees()");
    Query query = em.createQuery("SELECT e FROM Employee e");
    return (Collection<Employee>) query.getResultList();
  }

  public void doAction(){
  }
}

Step5). Now we will write the “persistence.xml” file inside the “/home/userone/JPA2_And_Toplink_On_AS7/src” directory as following:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="EmployeeService">
       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
       <jta-data-source>java:/MySqlDS</jta-data-source>
       <class>jpa.Employee</class>

       <properties>
          <!-- Note jboss.as.jpa.providerModule property is very important -->
          <property name="jboss.as.jpa.providerModule" value="org.eclipse.persistence.jpa" />
       </properties>
  </persistence-unit>
</persistence>

NOTE: We need to make sure that this “persistence.xml” file goes inside the “${war.name}/WEB-INF/classes/META-INF” directory of our WAR file. Note jboss.as.jpa.providerModule property is very important

Step6). Now we will write a simple “index.jsp” page to just provide a some input forms so that a user can enter the employee name and id details , Place this file as well inside the “/home/userone/JPA2_And_Toplink_On_AS7/src” directory as following:

<html>
<head>
<title>JPA Demo In JBoss AS7</title>
</head>
<body>
   <form action="TestServlet">
   Enter Employee ID : <input name="empId" type="text" value="" /> <BR/>
   Enter Employee Name : <input name="empName" type="text" value="" /> <BR/>
   <input type="submit" value="Store" />
   </form>
</body>
</html>

Step7). We will write the “TestServlet.java” inside the “/home/userone/JPA2_And_Toplink_On_AS7/src” as following in order to insert the details entered by the user in previous index.jsp page.

package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.Integer;
import javax.ejb.EJB;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.transaction.*;
import javax.annotation.*;
import jpa.Employee;

@WebServlet(value="/TestServlet")
public class TestServlet extends HttpServlet
  {
	private static final long serialVersionUID = 1L;

        @Resource private UserTransaction
        utx;

        @PersistenceContext(unitName="EmployeeService")
	EntityManager em;

        @EJB(lookup="java:global/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote")
        jpa.EmployeeServiceRemote remote;

	public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                PrintWriter out=null;
		try {
			System.out.println("inside TestServlet service()");
			System.out.println("GOT the UserTransaction       :  "+utx);
			System.out.println("Got jpa.EmployeeServiceRemote :  "+remote);
			out=response.getWriter();			

                        remote.createEmployee(new Integer(request.getParameter("empId")),request.getParameter("empName"));

                        out.println("<html><head><title>JPA Insert</title></head><body>");
			out.println("<BR>Employee Record Inserted in the Database.<BR>");
                        out.println("<TABLE border=\"10%\">");
                        out.println("<TR><TD>EmpID</TD><TD>EmpName</TD></TR>");
			for(Employee tmp:remote.findAllEmployees())
			{
			   out.println("<TR><TD>"+tmp.getEmpno()+"</TD><TD>"+tmp.getEname()+"</TD></TR>");
			}
                        out.println("</TABLE>");
                        out.println("<BR><BR><a href=\"index.jsp\"> Want to insert Some More Employee Records ?</a></body></html>");
		     }
                 catch (Exception e)
                     {
			e.printStackTrace();
		     }
	}
}

Step8). As we created a module “org.eclipse.persistence.jpa” earlier which we are going to use in our web application. So we will need to create a “jboss-deployment-structure.xml” file as following:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
  <deployment>
    <dependencies>
      <module name="org.eclipse.persistence.jpa" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>

NOTE: Once our application is build then we should be able to see this file present inside our WebApplication “WEB-INF/jboss-deployment-structure.xml”.

Step9). Now the most important part, here we are going to develop “build.xml” ANT file, which will build, deploy our web application on the JBoss AS7.1 Beta Server, so write the following “build.xml” file inside “/home/userone/JPA2_And_Toplink_On_AS7″ directory.

<project name="JPA_BASIC_Demo" default="deploy">
<property name="jboss.home" value="/NotBackedUp/JBoss_All/jboss-as-7.1.1.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="output.dir" value="build" />
<property name="src.dir" value="src" />
<property name="war.name" value="JPA_BASIC_Demo.war" />

   <path id="jboss.classpath">
     <fileset dir="${jboss.module.dir}">
        <include name="**/*.jar"/>
     </fileset>
   </path>

        <target name="init">
           <delete dir="${output.dir}" />
           <mkdir dir="${output.dir}" />
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}/WEB-INF/classes/META-INF"/>
        </target>

        <target name="build" depends="init">
           <javac srcdir="${src.dir}" destdir="${tmp.dir}/WEB-INF/classes"  includes="*.java" classpathref="jboss.classpath" />
           <copy todir="${tmp.dir}/WEB-INF/classes">
                <fileset dir="${src.dir}" includes="**/*.java"/>
           </copy>
           <copy file="${src.dir}/index.jsp" tofile="${tmp.dir}/index.jsp"/>
           <copy file="${src.dir}/jboss-deployment-structure.xml" tofile="${tmp.dir}/WEB-INF/jboss-deployment-structure.xml"/>

           <!-- Make Sure that the persistence.xml file is placed inside "${war.name}/WEB-INF/classes/META-INF" directory -->
           <copy file="${src.dir}/persistence.xml" tofile="${tmp.dir}/WEB-INF/classes/META-INF/persistence.xml"/>

           <jar jarfile="${tmp.dir}/${war.name}" basedir="${tmp.dir}" compress="true" />
           <copy file="${tmp.dir}/${war.name}" tofile="${output.dir}/${war.name}"/>

           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}"/>
           </delete>
        </target>

        <target name="deploy" depends="build">
            <echo message="*******************  Deploying the WAR file ${war.name} *********************" />
            <echo message="********** ${output.dir}/${war.name} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${war.name}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
        </target>
</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory.

Step9). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step10). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/userone/JPA2_And_Toplink_On_AS7″ and then run the ant to build the webservice. by running the command “ant deploy”

Buildfile: build.xml

init:
   [delete] Deleting directory /home/userone/JPA2_And_Toplink_On_AS7/build
    [mkdir] Created dir: /home/userone/JPA2_And_Toplink_On_AS7/build
    [mkdir] Created dir: /home/userone/JPA2_And_Toplink_On_AS7/tmp
    [mkdir] Created dir: /home/userone/JPA2_And_Toplink_On_AS7/tmp/WEB-INF/classes/META-INF

build:
    [javac] Compiling 4 source files to /home/userone/JPA2_And_Toplink_On_AS7/tmp/WEB-INF/classes
     [copy] Copying 4 files to /home/userone/JPA2_And_Toplink_On_AS7/tmp/WEB-INF/classes
     [copy] Copying 1 file to /home/userone/JPA2_And_Toplink_On_AS7/tmp
     [copy] Copying 1 file to /home/userone/JPA2_And_Toplink_On_AS7/tmp/WEB-INF
     [copy] Copying 1 file to /home/userone/JPA2_And_Toplink_On_AS7/tmp/WEB-INF/classes/META-INF
      [jar] Building jar: /home/userone/JPA2_And_Toplink_On_AS7/tmp/JPA_BASIC_Demo.war
     [copy] Copying 1 file to /home/userone/JPA2_And_Toplink_On_AS7/build

deploy:
     [echo] *******************  Deploying the WAR file JPA_BASIC_Demo.war *********************
     [echo] ********** build/JPA_BASIC_Demo.war to /home/userone/jboss-as-7.1.1.Final/standalone/deployments **********
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.1.Final/standalone/deployments
     [echo] *******************  Deployed Successfully   *********************

BUILD SUCCESSFUL
Total time: 2 seconds

Step11). Now you will see the following kind of output on your JBoss AS7.1 console which means the application is deployed successfully:

17:50:06,477 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "JPA_BASIC_Demo.war"
17:50:06,513 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for EmployeeService
17:50:06,548 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named EmployeeService in deployment unit deployment "JPA_BASIC_Demo.war" are as follows:

	java:global/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote
	java:app/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote
	java:module/EmployeeService!jpa.EmployeeServiceRemote
	java:jboss/exported/JPA_BASIC_Demo/EmployeeService!jpa.EmployeeServiceRemote
	java:global/JPA_BASIC_Demo/EmployeeService
	java:app/JPA_BASIC_Demo/EmployeeService
	java:module/EmployeeService

17:50:06,608 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011402: Starting Persistence Unit Service 'JPA_BASIC_Demo.war#EmployeeService'
17:50:06,633 INFO  [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /JPA_BASIC_Demo
17:50:06,744 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565: Replaced deployment "JPA_BASIC_Demo.war" with deployment "JPA_BASIC_Demo.war"

Step12). Now access the WebApplication like following and then fill the form :

http://localhost:8080/JPA_BASIC_Demo/index.jsp

Once you hit the above URL you will see thew following kind of output in oyur JBossAS7 console:

17:52:52,442 INFO  [stdout] (http--127.0.0.1-8080-1) inside TestServlet service()
17:52:52,443 INFO  [stdout] (http--127.0.0.1-8080-1) GOT the UserTransaction       :  org.jboss.tm.usertx.client.ServerVMClientUserTransaction@566f0962
17:52:52,443 INFO  [stdout] (http--127.0.0.1-8080-1) Got jpa.EmployeeServiceRemote :  Proxy for remote EJB StatelessEJBLocator{appName='', moduleName='JPA_BASIC_Demo', distinctName='', beanName='EmployeeService', view='interface jpa.EmployeeServiceRemote'}
17:52:52,459 INFO  [stdout] (http--127.0.0.1-8080-1)
17:52:52,459 INFO  [stdout] (http--127.0.0.1-8080-1) 	EmployeeService  Object Created. this: jpa.EmployeeService@498eba23
17:52:52,460 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@395e758f
17:52:52,460 INFO  [stdout] (http--127.0.0.1-8080-1)
17:52:52,461 INFO  [stdout] (http--127.0.0.1-8080-1) 	[EmployeeService] Before em.persist(emp)
17:52:52,481 INFO  [stdout] (http--127.0.0.1-8080-1) [EL Info]: 2012-06-10 17:52:52.481--ServerSession(631563432)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
17:52:52,509 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@4a44db2a
17:52:52,510 INFO  [stdout] (http--127.0.0.1-8080-1) [EL Info]: 2012-06-10 17:52:52.51--ServerSession(631563432)--vfs:/content/JPA_BASIC_Demo.war/WEB-INF/classes/_EmployeeService login successful
17:52:52,515 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@4542ca0
17:52:52,686 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@43458a40
17:52:52,687 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@3022eec5
17:52:52,687 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@4569e033
17:52:52,687 INFO  [stdout] (http--127.0.0.1-8080-1)
17:52:52,687 INFO  [stdout] (http--127.0.0.1-8080-1) 	[EmployeeService] Before findEmployee(id)
17:52:52,688 INFO  [stdout] (http--127.0.0.1-8080-1)
17:52:52,688 INFO  [stdout] (http--127.0.0.1-8080-1) 	 Inside findEmployee(2223)
17:52:52,688 INFO  [stdout] (http--127.0.0.1-8080-1)
17:52:52,689 INFO  [stdout] (http--127.0.0.1-8080-1) 	[EmployeeService] Inside createEmployee() findEmployee result: jpa.Employee@395e758f
17:52:52,690 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@1ee69bc3
17:52:52,691 INFO  [stdout] (http--127.0.0.1-8080-1)
17:52:52,691 INFO  [stdout] (http--127.0.0.1-8080-1) 	 Inside findAllEmployees()
17:52:52,694 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@1b3cbd53
17:52:52,694 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@30b1a21d
17:52:52,695 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@5e0a36e4
17:52:52,696 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@7099e2f7
17:52:52,696 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@703ffe2
17:52:52,697 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@71f1584a
17:52:52,697 INFO  [stdout] (http--127.0.0.1-8080-1) Employee Object Created. this: jpa.Employee@1bdb9cb7
.

=======================================================================

Some Issues You Might Face

=======================================================================

Issue-1

If you dont declare the property name=”jboss.as.jpa.providerModule” value=”org.eclipse.persistence.jpa” in your “persistence.xml” file then you might see following exception while deploying your Toplink JPA:

17:55:32,081 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "JPA_BASIC_Demo.war"
17:55:32,081 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015863: Replacement of deployment "JPA_BASIC_Demo.war" by deployment "JPA_BASIC_Demo.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.module.service.\"deployment.JPA_BASIC_Demo.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.JPA_BASIC_Demo.war\".main: Failed to load module: deployment.JPA_BASIC_Demo.war:main"}}
17:55:32,095 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) JBAS011401: Read persistence.xml for EmployeeService
17:55:32,101 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.module.service."deployment.JPA_BASIC_Demo.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.JPA_BASIC_Demo.war".main: Failed to load module: deployment.JPA_BASIC_Demo.war:main
	at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_24]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_24]
	at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
Caused by: org.jboss.modules.ModuleNotFoundException: Module org.eclipse.persistence:main is not found in local module loader @6da28362 (roots: /NotBackedUp/JBoss_All/jboss-as-7.1.1.Final/modules)
	at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.Module.addPaths(Module.java:841) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.Module.link(Module.java:1181) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.Module.relinkIfNecessary(Module.java:1207) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	... 5 more

Issue-2

If you wont start a transaction like following inside your code before persisting an entity in your Database then you will see the following kind of exception in your logs (EmployeeService.java snippet):

    try{
         em.getTransaction().begin();
         em.persist(emp);
         em.flush();
         em.getTransaction().commit();
       }
    catch(Exception e)
       {
          e.printStackTrace();
          try{   em.getTransaction().rollback();   } catch(Exception ee)  {  ee.printStackTrace();  }
       }

Following exceptions you will encounter …

17:57:56,475 ERROR [stderr] (http--127.0.0.1-8080-1) javax.persistence.TransactionRequiredException:
17:57:56,476 ERROR [stderr] (http--127.0.0.1-8080-1) Exception Description: No transaction is currently active
17:57:56,476 ERROR [stderr] (http--127.0.0.1-8080-1) 	at  org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper.throwCheckTransactionFailedException(EntityTransactionWrapper.java:113)
17:57:56,476 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper.checkForTransaction(EntityTransactionWrapper.java:50)
17:57:56,477 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.checkForTransaction(EntityManagerImpl.java:1776)
17:57:56,477 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:780)
17:57:56,477 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.jboss.as.jpa.container.AbstractEntityManager.flush(AbstractEntityManager.java:439)
17:57:56,477 ERROR [stderr] (http--127.0.0.1-8080-1) 	at jpa.EmployeeService.createEmployee(Unknown Source)
.
.
17:57:56,493 ERROR [stderr] (http--127.0.0.1-8080-1) java.lang.IllegalStateException:
17:57:56,494 ERROR [stderr] (http--127.0.0.1-8080-1) Exception Description: No transaction is currently active
17:57:56,494 ERROR [stderr] (http--127.0.0.1-8080-1) 	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.rollback(EntityTransactionImpl.java:122)

<property name=”eclipselink.ddl-generation” value=”create-tables” />
.
.
Thanks
Middleware Magic Team :)


How to configure EJB3 MDBs on JBoss AS 7 for remote IBM Websphere MQ 7 ?

Almost a month back we had written an article Steps to Create A Remote Queue in WebSphere MQ 7 in which we had given the steps to configure a remote queue in WebSphere MQ and in the article How to configure EJB3 MDBs on JBoss AS 5.1 for remote IBM Websphere MQ 7? which showed the steps to connect with WebSphere MQ using AS 5.1.

However in this article we would be doing the same but using JBoss AS 7.1.1 final which is the latest version of JBoss AS 7.  We would be sharing the configuration from JBoss AS 7.1.1 final side which would help everyone to consume messages from Websphere MQ 7 which is residing on a remote box. We will also see how can one send messages (i.e. using a JAVA standalone code) to a remote queue on Box-1 having Websphere MQ 7 and those messages can be received by the consumer (i.e. using EJB3 MDB deployed on JBoss) from Box-2 which is a very basic scenario in most of the people.

The main concept for this is that we would be sending messages to the remote queue of Websphere MQ 7 on box-1 and on box-2 we would be creating a resource adapter which would be using wmq.jmsra.rar to communicate with Websphere MQ having the queue on box-1. Using the same resource adapter and Websphere MQ’s hostName, port, queueManager, destination and transportType in the MDB we would be able to consume message from box-2 easily.

In Box-1 (10.10.10.10)

Lets say you have your Websphere MQ 7 running in this box and you can configure the remote queue in MQ 7 by following the steps given in the below article

Steps to Create A Remote Queue in WebSphere MQ 7

In Box-2 (20.20.20.20)

Below are the steps to consume messages from WebShere MQ using a MDB deployed on JBoss AS 7.1.1 final and we would be using the “standalone-full.xml”

  1. In “standalone-full.xml” following things has to be done
    1. Need to add the resource adapter under subsystem
    2. Replace

       <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
      

      With

      <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
      	<resource-adapters>
      		<resource-adapter>
      			<archive>
      				wmq.jmsra.rar
      			</archive>
      		</resource-adapter>
      	</resource-adapters>
      </subsystem>
      
    3. Need to add the resource adapter reference under mdb
    4. Replace

      <mdb>
      	<resource-adapter-ref resource-adapter-name="hornetq-ra"/>
      	<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
      </mdb>
      

      With

      <mdb>
      	<resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>
      	<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
      </mdb>
      
  2. Deploy “wmq.jmsra.rar” in the “/jboss-as-7.1.1.Final/standalone/deployments/” folder
  3. We would create a MDB now having the following ActivationConfigProperty and ResourceAdapter, which has to be kept “MDB_30.jar” file in the “/jboss-as-7.1.1.Final/standalone/deployments/” folder
    1. Create a folder called “MDB_30.jar
    2. Inside “MDB_30.jar” create a “MyMDB.java” file and update this file with the below details
    3. import javax.ejb.*;
      import javax.jms.Message;
      import javax.jms.TextMessage;
      import javax.jms.JMSException;
      import javax.ejb.MessageDriven;
      import javax.jms.MessageListener;
      import javax.ejb.ActivationConfigProperty;
      import org.jboss.ejb3.annotation.ResourceAdapter;
      
      @MessageDriven( name="MyMDB",
              activationConfig =
              {
                  @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
                  @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
                  @ActivationConfigProperty(propertyName = "hostName", propertyValue = "MQ.HOST.NAME"),
                  @ActivationConfigProperty(propertyName = "port", propertyValue = "MQ.PORT"),
                  @ActivationConfigProperty(propertyName = "channel", propertyValue = "MQ.CHANNEL.NAME"),
                  @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "MQ.QUEUE.MANAGER"),
                  @ActivationConfigProperty(propertyName = "destination", propertyValue = "MQ.QUEUE.NAME"),
                  @ActivationConfigProperty(propertyName = "transportType", propertyValue = "MQ.CLIENT")
              })
      @ResourceAdapter(value = "wmq.jmsra.rar")
      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
      
      public class MyMDB implements MessageListener{
      
          public void onMessage(Message message) {
              TextMessage textMessage = (TextMessage) message;
              try {
                  System.out.println("\n\n\t Message Received by MDB : "+ textMessage.getText());
              } catch (JMSException e) {
                  e.printStackTrace();
              }
          }
      }
      
    4. Once every thing has been put at its place, then you compile the MyMDB.java code and if you want then you can also create an JAR archive file for above folder

After following the above given steps, we have successfully configured all the setting from JBoss end. Now its time to test our configuration by following the below steps.

Testing

  1. Create a Directory somewhere in your file system like: “/urs/JBoss/Queue” to write the QueueSend.java and as we have an MDB we would not need a QueueReceive.java programs.
  2. In QueueSend.java copy the below program
    import java.io.*;
    import java.io.*;
    import java.util.Hashtable;
    import javax.jms.JMSException;
    import javax.jms.Queue;
    import javax.jms.QueueConnection;
    import javax.jms.QueueConnectionFactory;
    import javax.jms.QueueSender;
    import javax.jms.QueueSession;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    
    public class QueueSend
    {
    public final static String JNDI_FACTORY="com.ibm.mq.jms.context.WMQInitialContextFactory";
    
    //*************** Connection Factory JNDI name *************************
    public final static String JMS_FACTORY="MyRemoteMQMgr"; 
    
    //*************** Queue Factory JNDI name *************************
    public final static String QUEUE="MyRemoteQueue";
    
    private QueueConnectionFactory qconFactory;
    private QueueConnection qcon;
    private QueueSession qsession;
    private QueueSender qsender;
    private Queue queue;
    private TextMessage msg;
    
    public void init(Context ctx, String queueName)throws NamingException, JMSException
    {
    qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
    qcon = qconFactory.createQueueConnection();
    qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    queue = (Queue) ctx.lookup(queueName);
    qsender = qsession.createSender(queue);
    msg = qsession.createTextMessage();
    qcon.start();
    }
    
    public void send(String message) throws JMSException {
    msg.setText(message);
    qsender.send(msg);
    }
    
    public void close() throws JMSException {
    qsender.close();
    qsession.close();
    qcon.close();
    }
    
    public static void main(String[] args) throws Exception {
    if (args.length != 1) {
    System.out.println("Usage: java QueueSend URL");
    return;
    }
    InitialContext ic = getInitialContext(args[0]);
    QueueSend qs = new QueueSend();
    qs.init(ic, QUEUE);
    readAndSend(qs);
    qs.close();
    }
    
    private static void readAndSend(QueueSend qs) throws IOException, JMSException
    {
    String line="Test Message Body with counter = ";
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    boolean readFlag=true;
    System.out.println("\n\tStart Sending Messages (Enter QUIT to Stop):\n");
    while(readFlag)
    {
    System.out.print("<Msg_Sender> ");
    String msg=br.readLine();
    if(msg.equals("QUIT") || msg.equals("quit"))
    {
    qs.send(msg);
    System.exit(0);
    }
    qs.send(msg);
    System.out.println();
    }
    br.close();
    }
    
    private static InitialContext getInitialContext(String url) throws NamingException
    {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
    env.put(Context.PROVIDER_URL, url);
    return new InitialContext(env);
    }
    }
    
  3. Now open just 1 – command prompt and run the “. ./setMQ_CLASSPATH.sh” by adding two DOTs separated by a single space, in both the prompts to set the Environment (PATH & CLASSPATH).
  4. Note: You would need the following jar files from Websphere MQ side to run the above program, hence change the path given in the below script under MQ_LIB

    1. dhbcore.jar
    2. mqcontext.jar
    3. com.ibm.mq.jar
    4. com.ibm.mqjms.jar
    5. com.ibm.mq.pcf.jar
    6. com.ibm.mq.jmqi.jar
    7. com.ibm.mq.headers.jar
    8. com.ibm.mq.commonservices.jar

    setMQ_CLASSPATH.sh

    #!/bin/sh
    
    echo "Exporting CLASSPATH for IBM MQ...."
    
    MQ_LIB=/home/urs/Remote_MQ/lib
    
    export CLASSPATH=$CLASSPATH:$MQ_LIB/com.ibm.mq.commonservices.jar:$MQ_LIB/com.ibm.mq.headers.jar:$MQ_LIB/com.ibm.mq.jmqi.jar:$MQ_LIB/com.ibm.mq.pcf.jar:$MQ_LIB/com.ibm.mqjms.jar:$MQ_LIB/dhbcore.jar:$MQ_LIB/mqcontext.jar:$MQ_LIB/com.ibm.mq.jar:.:
    echo "====================================="
    echo "CLASSPATH =" $CLASSPATH
    echo "====================================="
    
  5. Then compile the QueueSend.java programs.
  6. Now run the code with the following command
  7. Prompt-1

    java QueueSend 10.10.10.10:1415/MyRemoteChannel
     

Once everything is up and running properly you just have to send around few messages in “Prompt-1” and you would notice that those messages would be shown in shell on which the standalone-full is running which is on Box-2. Hence when you are sending a messages to the Websphere MQ 7 queue which is on Box-1 the same messages are been consumed by the MDB which is been deployed on standalone-full shell is running on Box-2.


How to configure EJB3 MDBs on JBoss AS 5.1 for remote IBM Websphere MQ 7?

As promised in our previous article we have come up with the configuration from JBoss AS 5.1 side which would help everyone to consume messages from Websphere MQ 7 which is residing on a remote box. In this article we will see how can one send messages (i.e. using a JAVA standalone code) to a remote queue on Box-1 having Websphere MQ 7 and those messages can be received by the consumer (i.e. using EJB3 MDB deployed on JBoss) from Box-2 which is a very basic scenario in most of the people.

The main concept for this is that we would be sending messages to the remote queue of Websphere MQ 7 on box-1 and on box-2 we would be creating a Websphere MQ provider which would have the URL and InitialContextFactory of the Websphere MQ having the queue on box-1 and using that Websphere MQ provider we would connect to the connection factory and would connect to the queue for Websphere MQ which is on box-1. Once we get the access of connection factory and queue we would just create an MDB which would using the Websphere MQ provider details and would be able to consume message from box-2 easily.

In Box-1 (10.10.10.10)

Lets say you have your Websphere MQ 7 running in this box and you can configure the remote queue in MQ 7 by following the steps given in the below article

Steps to Create A Remote Queue in WebSphere MQ 7

In Box-2 (20.20.20.20)

In this box we have a JBoss node called Node-1 and following things has to be done on this box.

Note: You would need the following jar files from Websphere MQ side to put in the /Node-1/lib directory

  • dhbcore.jar
  • mqcontext.jar
  • com.ibm.mq.jar
  • com.ibm.mqjms.jar
  • com.ibm.mq.pcf.jar
  • com.ibm.mq.jmqi.jar
  • com.ibm.mq.headers.jar
  • com.ibm.mq.commonservices.jar

.

  1. Put the “wsIBMmq-provider-service.xml” file in the “Node-1/deploy” folder
  2. wsIBMmq-provider-service.xml

    <server>
     <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.jms:service=JMSProviderLoader,name=WSIBMMQJMSProvider">
     <attribute name="ProviderName">WSIBMMQJMSProvider</attribute>
     <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
    <!-- Connection Factories name created on MQ, "JMS Administered Objects => <IP_ADDRESS>:<PORT>/<CHANNELS_NAME> => Connection Factoiries => <CONNECTION_FACTOIRIES_NAME> "-->
     <attribute name="FactoryRef">MyRemoteMQMgr</attribute>
     <attribute name="QueueFactoryRef">MyRemoteMQMgr</attribute>
     <attribute name="TopicFactoryRef">MyRemoteMQMgr</attribute>
     <attribute name="Properties">
          java.naming.factory.initial=com.ibm.mq.jms.context.WMQInitialContextFactory
          java.naming.provider.url=10.10.10.10:1415/MyRemoteChannel
          java.naming.security.authentication=none
     </attribute>
     </mbean>
     </server>
    

    Note: In “wsIBMmq-provider-service.xml” file you have to change the 10.10.10.10 with the your remote server name/IP address of the remote server on which MQ 7 is running and same goes for 1415 and MyRemoteChannel.

  3. Put the “MDB_30.ear” files in the “Node-1/deploy” folder
    1. Create a folder called “MDB_30.ear
    2. Under it create 2 folders called “MDB_30.jar” and “META-INF
    3. Inside “META-INF” create a “application.xml” file and update this file with the below details
    4. <?xml version="1.0" encoding="UTF-8"?>
      <application version="5" xmlns="http://java.sun.com/xml/ns/javaee"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
      
      http://java.sun.com/xml/ns/javaee/application_5.xsd">
      
         <module>
             <ejb>MDB_30.jar</ejb>
         </module>
      </application>
      
    5. Inside “MDB_30.jar” create a “MyMDB.java” file and update this file with the below details
    6. import javax.ejb.MessageDriven;
      import javax.jms.JMSException;
      import javax.jms.Message;
      import javax.jms.MessageListener;
      import javax.jms.TextMessage;
      import javax.ejb.ActivationConfigProperty;
      
      @MessageDriven(
          activationConfig={
              @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="WSIBMMQJMSProvider"),
              @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
              @ActivationConfigProperty(propertyName="destination", propertyValue="MyRemoteQueue"),
              @ActivationConfigProperty(propertyName="useDLQ", propertyValue="false"),
      	@ActivationConfigProperty(propertyName="reconnectAttempts", propertyValue="60"),
      	@ActivationConfigProperty(propertyName="reconnectInterval", propertyValue="10")
          }
      )
      
      public class MyMDB implements MessageListener{
      
          public void onMessage(Message message) {
              TextMessage textMessage = (TextMessage) message;
              try {
                  System.out.println("\n\n\t Message Received by MDB : "+ textMessage.getText());
              } catch (JMSException e) {
                  e.printStackTrace();
              }
          }
      }
      
    7. Once every thing has been put at its place, then you compile the MyMDB.java code and if you want then you can also create an EAR archive file for above folder
  4. After following the above given steps, we have successfully configured all the setting from JBoss end. Now its time to test our configuration by following the below steps.

    Testing

    1. Create a Directory somewhere in your file system like: “/urs/JBoss/JBM/Queue” to write the QueueSend.java and as we have an MDB we would not need a QueueReceive.java programs.
    2. In QueueSend.java copy the below program
      import java.io.*;
      import java.io.*;
      import java.util.Hashtable;
      import javax.jms.JMSException;
      import javax.jms.Queue;
      import javax.jms.QueueConnection;
      import javax.jms.QueueConnectionFactory;
      import javax.jms.QueueSender;
      import javax.jms.QueueSession;
      import javax.jms.Session;
      import javax.jms.TextMessage;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      
      public class QueueSend
      {
      public final static String JNDI_FACTORY="com.ibm.mq.jms.context.WMQInitialContextFactory";
      
      //*************** Connection Factory JNDI name *************************
      public final static String JMS_FACTORY="MyRemoteMQMgr"; 
      
      //*************** Queue Factory JNDI name *************************
      public final static String QUEUE="MyRemoteQueue";
      
      private QueueConnectionFactory qconFactory;
      private QueueConnection qcon;
      private QueueSession qsession;
      private QueueSender qsender;
      private Queue queue;
      private TextMessage msg;
      
      public void init(Context ctx, String queueName)throws NamingException, JMSException
      {
      qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
      qcon = qconFactory.createQueueConnection();
      qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      queue = (Queue) ctx.lookup(queueName);
      qsender = qsession.createSender(queue);
      msg = qsession.createTextMessage();
      qcon.start();
      }
      
      public void send(String message) throws JMSException {
      msg.setText(message);
      qsender.send(msg);
      }
      
      public void close() throws JMSException {
      qsender.close();
      qsession.close();
      qcon.close();
      }
      
      public static void main(String[] args) throws Exception {
      if (args.length != 1) {
      System.out.println("Usage: java QueueSend URL");
      return;
      }
      InitialContext ic = getInitialContext(args[0]);
      QueueSend qs = new QueueSend();
      qs.init(ic, QUEUE);
      readAndSend(qs);
      qs.close();
      }
      
      private static void readAndSend(QueueSend qs) throws IOException, JMSException
      {
      String line="Test Message Body with counter = ";
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      boolean readFlag=true;
      System.out.println("\n\tStart Sending Messages (Enter QUIT to Stop):\n");
      while(readFlag)
      {
      System.out.print("<Msg_Sender> ");
      String msg=br.readLine();
      if(msg.equals("QUIT") || msg.equals("quit"))
      {
      qs.send(msg);
      System.exit(0);
      }
      qs.send(msg);
      System.out.println();
      }
      br.close();
      }
      
      private static InitialContext getInitialContext(String url) throws NamingException
      {
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
      env.put(Context.PROVIDER_URL, url);
      return new InitialContext(env);
      }
      }
      
    3. Now open just 1 – command prompt and run the “. ./setMQ_CLASSPATH.sh” by adding two DOTs separated by a single space, in both the prompts to set the Environment (PATH & CLASSPATH).
    4. Note: The same jar files shown above would be required here as well, hence change the path given in the below script under MQ_LIB

      setMQ_CLASSPATH.sh

      #!/bin/sh
      
      echo "Exporting CLASSPATH for IBM MQ...."
      
      MQ_LIB=/home/urs/Remote_MQ/lib
      
      export CLASSPATH=$CLASSPATH:$MQ_LIB/com.ibm.mq.commonservices.jar:$MQ_LIB/com.ibm.mq.headers.jar:$MQ_LIB/com.ibm.mq.jmqi.jar:$MQ_LIB/com.ibm.mq.pcf.jar:$MQ_LIB/com.ibm.mqjms.jar:$MQ_LIB/dhbcore.jar:$MQ_LIB/mqcontext.jar:$MQ_LIB/com.ibm.mq.jar:.:
      echo "====================================="
      echo "CLASSPATH =" $CLASSPATH
      echo "====================================="
      
    5. Then compile the QueueSend.java programs.
    6. Now run the code with the following command
    7. Prompt-1

      java QueueSend 10.10.10.10:1415/MyRemoteChannel
       

    Once everything is up and running properly you just have to send around few messages in “Prompt-1” and you would notice that those messages would be shown in shell on which the Node-1 is running which is on Box-2. Hence when you are sending a messages to the Websphere MQ 7 queue which is on Box-1 the same messages are been consumed by the MDB which is been deployed on Node-1 running on Box-2.


Simplified way of EJB Remote Lookup in JBoss AS7.1.0.Final

Hi,

Until “JBoss AS7.1.0 CR1b” We saw a very combersome way of looking up an EJB from a remote client. But based on the demand of the community guys Now the “JBoss AS 7.1.0.Final” provides a very easy way of invoking the EJBs remotely from the client side.

We discussed the previous option of looking up EJB remotely till “JBoss AS7.1.0 CR1b” as described in the following link: “Minimum Jars Required for Client app to remotely Invoke EJBs in JBoss AS7″

.
.

What’s New in JBoss AS7.1.0.Final?

In this article we are going to see an Easiest way to lookup the EJBs remotely in >”JBoss AS7.1.0.Final”

Point-1). JBoss AS7.1.0.Final provides a new Jar file for the Client side in order to perform remote lookup’s of JMS and EJB components “jboss-as-7.1.0.Final/bin/client/jboss-client-7.1.0.Final.jar”. This jar should be used with standalone clients only, not with deployments are that deployed to an AS7 instance.

Point-2). What will be the syntax of the JNDI name while invoking a Stateless SessionBean?
For Stateless EJBs Beans JNDI Naming will be in following format:

                 .
<app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>
                 .

Example: “TestRemoteEJBEAR/remoteEJB//CallerBean!remote.CallerRemote”

Point-3). On the client side we will need to use a new Protocul “remote://” as following:

.

  String JBOSS_CONTEXT="org.jboss.naming.remote.client.InitialContextFactory";;
  Properties props = new Properties();
  props.put(Context.INITIAL_CONTEXT_FACTORY, JBOSS_CONTEXT);
  props.put(Context.PROVIDER_URL, "remote://localhost:4447");
  props.put(Context.SECURITY_PRINCIPAL, "testuser");
  props.put(Context.SECURITY_CREDENTIALS, "testpassword");
  context = new InitialContext(props);
.

Point-4). A properties file need to be placed in the Clients CLASSPATH with name “jboss-ejb-client.properties”

Point-5): [ IMPORTANT ] Security is the main focus now so before running “JBoss AS7.1.0.Final” we will need to create a new Application User by running “${JBOSS_HOME}/bin/add-user.sh” script as following :

[userone@localhost bin]$ ./add-user.sh 

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Realm (ApplicationRealm) :  ApplicationRealm
Username : testuser
Password : testpassword
Re-enter Password : testpassword

What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none) : testrole
About to add user 'testuser' for realm 'ApplicationRealm'

Is this correct yes/no? yes

Added user 'testuser' to file '/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-users.properties'
Added user 'testuser' to file '/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-users.properties'
Added user 'testuser' with roles testrole to file '/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-roles.properties'
Added user 'testuser' with roles testrole to file '/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-roles.properties'
.
.

.
.

Source Code (Git Repo) Source Code for this Demo Can be downloaded from GIT Repository:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/New_EJB3_Remote_Lookup

Once you have gone through the above mentioned 4- Points we can now begin writing our EJB Based application.

Developing Simple EJB3 Application

Step-1). Create a directory somewhere in your file system like “/home/userone/New_EJB3_Remote_Lookup” and then create another directory with name “src” inside the “/home/userone/New_EJB3_Remote_Lookup” directory.

Step-2). Write the EJB Stateless Bean class “CallerBean.java” as following inside the directory “/home/userone/New_EJB3_Remote_Lookup/src”:

package remote;
import javax.ejb.*;
import javax.naming.*;
import java.util.*;

@Stateless
@Remote(CallerRemote.class)
public class CallerBean implements CallerRemote
 {
     public String testMethod(String name)
	    {
		   System.out.println("\n\n\t Bean's testMethod(String name) called....");
		   return "[CallerBean] returned Hello "+name;
	    }
 }

Step-3). Write the EJB Remote Interface “CallerRemote.java” as following inside the directory “/home/userone/New_EJB3_Remote_Lookup/src”:

package remote;
public interface CallerRemote
{
     public String testMethod(String name);
}

Step-4). As we are going to create an EAR file containing the above Stateless Session Bean so We will write the “application.xml” as following inside the directory “/home/userone/New_EJB3_Remote_Lookup/src”:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID" version="5">
  <module>
    <ejb>remoteEJB.jar</ejb>
  </module>
</application>

Developing EJB3 Remote Client

Step-5). Now we will write the Client side code to access the Above mentioned EJB Remotely so create a class “TestRemoteClientA.java” as following inside the directory “/home/userone/New_EJB3_Remote_Lookup/src”:

package client;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import remote.CallerRemote;
public class TestRemoteClientA
  {
      public static void main(String ar[]) throws Exception
       {
          Context context=null;
       try
         {
                Properties props = new Properties();
                props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
                props.put(Context.PROVIDER_URL, "remote://localhost:4447");
                props.put(Context.SECURITY_PRINCIPAL, "testuser");
                props.put(Context.SECURITY_CREDENTIALS, "testpassword");
                context = new InitialContext(props);
	        System.out.println("\n\tGot initial Context: "+context);
         }
       catch (Exception e)
         {
                e.printStackTrace();
          }

         // Lookup Format will be
         // <app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>

         CallerRemote remote=(CallerRemote)context.lookup("TestRemoteEJBEAR/remoteEJB//CallerBean!remote.CallerRemote");
         System.out.println("\n\t remote.testMethod(\"MiddlewareMagic\") = "+remote.testMethod("MiddlewareMagic"));
       }
  }

Step-6). Now we will need to create a properties file “jboss-ejb-client.properties” as following inside the directory “/home/userone/New_EJB3_Remote_Lookup/src”:


remote.connections=default
endpoint.name=client-endpoint
remote.connection.default.port = 4447
remote.connection.default.host=localhost
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

NOTE: The above properties file need to be present inside the client’s classpath. In our case we are going to put this file inside a JAR file “remoteEJBClient.jar” and then we will add this JAR inside the client’s classpath.

Step-7). Now Start your JBoss Profile as following from inside the directory “/home/userone/jboss-as-7.1.0.Final/bin”:

.
 ./standalone.sh -c standalone-full.xml
.

Step-8). Now the most important part of building / deploying and running the application so in order to achieve that we will create a simple ant build script, So Create a “build.xml” file inside the “/home/userone/New_EJB3_Remote_Lookup” directory as following:

<project name="SingletonStartupService" default="all">
<property name="jboss.home" value="/home/userone/jboss-as-7.1.0.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="src.dir" value="src" />
<property name="output.dir" value="build" />
<property name="ear.name" value="TestRemoteEJBEAR.ear" />
<property name="ejb.jar" value="remoteEJB.jar" />
<property name="client.jar.name" value="remoteEJBClient.jar" />

        <path id="jboss.classpath">
           <fileset dir="${jboss.module.dir}">
               <include name="**/*.jar"/>
           </fileset>
        </path>

        <!-- Client Needs the following Jar to be present in the CLASSPATH including -->
        <path id="jboss.new.client.classpath">
           <fileset dir="${jboss.home}/bin/client">
               <include name="jboss-client-7.1.0.Final.jar" />
           </fileset>
        </path>

        <target name="all" depends="deploy" />

        <target name="build_ear">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="*.java" classpathref="jboss.classpath"/>

           <jar jarfile="${tmp.dir}/${ejb.jar}" basedir="${tmp.dir}" compress="true" />

           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/remote"/>
           </delete>
           <mkdir dir="${tmp.dir}/META-INF"/>
           <copy todir="${tmp.dir}/META-INF">
                <fileset dir="${src.dir}/">
                  <include name="application.xml"/>
                </fileset>
           </copy>
           <jar jarfile="${tmp.dir}/${ear.name}" basedir="${tmp.dir}" compress="true" />
           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/META-INF"/>
           </delete>
           <delete file="${tmp.dir}/${ejb.jar}"/>

           <copy file="${tmp.dir}/${ear.name}" tofile="${output.dir}/${ear.name}"/>
           <delete file="${tmp.dir}/${ear.name}"/>
        </target>

        <target name="deploy" depends="build_ear">
            <echo message="*******************  Deploying the EAR file ${ear.name} *********************" />
            <echo message="********** ${output.dir}/${ear.name} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${ear.name}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
        </target>

        <target name="run">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <copy file="${src.dir}/jboss-ejb-client.properties" toDir="${tmp.dir}"/> 

           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="CallerRemote.java,TestRemoteClientA.java" classpathref="jboss.classpath"/>
           <jar jarfile="${output.dir}/${client.jar.name}" basedir="${tmp.dir}" compress="true" />
           <delete dir="${tmp.dir}"/>

           <java classname="client.TestRemoteClientA" fork="true">
               <classpath>
                  <pathelement location="${output.dir}/${client.jar.name}"/>
                  <path refid="jboss.new.client.classpath"/>
               </classpath>
           </java>
        </target>        

</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory.

Step-9). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step-10). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/userone/New_EJB3_Remote_Lookup” and then run the ant to build and deploy the EJB based EAR applicationon your JBoss Standalone full profile, by running the command “ant deploy”

[userone@localhost New_EJB3_Remote_Lookup]$ ant deploy
ant deploy
Buildfile: build.xml

build_ear:
    [mkdir] Created dir: /home/userone/New_EJB3_Remote_Lookup/tmp
    [javac] Compiling 3 source files to /home/userone/New_EJB3_Remote_Lookup/tmp
      [jar] Building jar: /home/userone/New_EJB3_Remote_Lookup/tmp/remoteEJB.jar
    [mkdir] Created dir: /home/userone/New_EJB3_Remote_Lookup/tmp/META-INF
     [copy] Copying 1 file to /home/userone/New_EJB3_Remote_Lookup/tmp/META-INF
      [jar] Building jar: /home/userone/New_EJB3_Remote_Lookup/tmp/TestRemoteEJBEAR.ear
   [delete] Deleting: /home/userone/New_EJB3_Remote_Lookup/tmp/remoteEJB.jar
     [copy] Copying 1 file to /home/userone/New_EJB3_Remote_Lookup/build
   [delete] Deleting: /home/userone/New_EJB3_Remote_Lookup/tmp/TestRemoteEJBEAR.ear

deploy:
     [echo] *******************  Deploying the EAR file TestRemoteEJBEAR.ear *********************
     [echo] ********** build/TestRemoteEJBEAR.ear to /home/userone/jboss-as-7.1.0.Final/standalone/deployments **********
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.0.Final/standalone/deployments
     [echo] *******************  Deployed Successfully   *********************

BUILD SUCCESSFUL
Total time: 1 second

As soon as the EJB will be deployed on the JBoss AS7.1.0.Final you will see the following kind of output on your JBoss Console (STDOUT):

22:44:32,587 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "TestRemoteEJBEAR.ear"
22:44:32,595 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "remoteEJB.jar"
22:44:32,626 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named CallerBean in deployment unit subdeployment "remoteEJB.jar" of deployment "TestRemoteEJBEAR.ear" are as follows:

	java:global/TestRemoteEJBEAR/remoteEJB/CallerBean!remote.CallerRemote
	java:app/remoteEJB/CallerBean!remote.CallerRemote
	java:module/CallerBean!remote.CallerRemote
	java:jboss/exported/TestRemoteEJBEAR/remoteEJB/CallerBean!remote.CallerRemote
	java:global/TestRemoteEJBEAR/remoteEJB/CallerBean
	java:app/remoteEJB/CallerBean
	java:module/CallerBean

22:44:32,654 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018565: Replaced deployment "TestRemoteEJBEAR.ear" with deployment "TestRemoteEJBEAR.ear"

Step-11). Now we will try to compile and run the EJB3 remote Client application by running the command “ant run”

[userone@localhost New_EJB3_Remote_Lookup]$ ant run
Buildfile: build.xml

run:
   [delete] Deleting directory /home/userone/New_EJB3_Remote_Lookup/tmp
    [mkdir] Created dir: /home/userone/New_EJB3_Remote_Lookup/tmp
     [copy] Copying 1 file to /home/userone/New_EJB3_Remote_Lookup/tmp
    [javac] Compiling 2 source files to /home/userone/New_EJB3_Remote_Lookup/tmp
      [jar] Building jar: /home/userone/New_EJB3_Remote_Lookup/build/remoteEJBClient.jar
   [delete] Deleting directory /home/userone/New_EJB3_Remote_Lookup/tmp
     [java] Feb 18, 2012 10:45:52 PM org.xnio.Xnio <clinit>
     [java] INFO: XNIO Version 3.0.3.GA
     [java] Feb 18, 2012 10:45:52 PM org.xnio.nio.NioXnio <clinit>
     [java] INFO: XNIO NIO Implementation Version 3.0.3.GA
     [java] Feb 18, 2012 10:45:52 PM org.jboss.remoting3.EndpointImpl <clinit>
     [java] INFO: JBoss Remoting version 3.2.2.GA
     [java]
     [java] 	Got initial Context: javax.naming.InitialContext@1ebcda2d
     [java] Feb 18, 2012 10:45:53 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
     [java] INFO: Received server version 1 and marshalling strategies [river]
     [java] Feb 18, 2012 10:45:53 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
     [java] INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@1309de5b, receiver=Remoting connection EJB receiver [connection=Remoting connection <30ff94b1>,channel=jboss.ejb,nodename=localhost]} on channel Channel ID 8359e77c (outbound) of Remoting connection 1fe903d5 to localhost/127.0.0.1:4447
     [java] Feb 18, 2012 10:45:53 PM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
     [java] WARN: Unsupported message received with header 0xffffffff
     [java]
     [java] 	 remote.testMethod("MiddlewareMagic") = [CallerBean] returned Hello MiddlewareMagic

BUILD SUCCESSFUL
Total time: 2 seconds

References

[1] EJB invocations from a remote client using JNDI.
[2] Remote EJB invocations via JNDI – EJB client API or remote-naming project.
[3] EJB invocations from a remote server instance.
.
.
Thanks :)
Middleware Magic Team


EJB Specific Deployment descriptors in WebLogic and JBoss

Hi,

An EJB container is the component that manages a particular class of EJB. In JBoss there is one instance of the org.jboss.ejb.Container created for each unique configuration of an EJB that is deployed. The actual object that is instantiated is a subclass of Container and the creation of the container instance is managed by the EJBDeployer MBean.

The JBoss EJB container architecture employs a modular plug-in approach. All key aspects of the EJB container may be replaced by custom versions of a plug-in and/or an interceptor by a developer. This approach allows for fine tuned customization of the EJB container behavior to optimally suite your needs. Most of the EJB container behavior is configurable through the EJB JAR META-INF/jboss.xml descriptor and the default server-wide equivalent standardjboss.xml descriptor.

In order to migrate the EJB based application from WebLogic to JBoss most of the peoplefaces challenges specially when it comes to the container specific deployment descriptors. So here in this example we will see what kind of entries goes inside the WebLogic specific EJB Deployment descriptor “weblogic-ejb-jar.xml” and how those parameter and configurations can be moved insside the JBoss specific EJB Deployment descriptors like “jboss.xml” (for JBoss AS4/5/6) and “jboss-ejb3.xml” (for JBoss AS7).

First of all we will see where to find the XSDs based on which we can write these JBoss specific deployment descriptors.

WebLogic XSDs

WebLogic Schemas are present inside : “${WLS_INSTALLATION}/modules/com.bea.core.descriptor.wl.binding_1.2.0.0.jar” file.

Location: “WLS1031/modules/com.bea.core.descriptor.wl.binding_1.2.0.0/META-INF/schemas/weblogic-ejb-jar.xsd”

JBoss XSDs

JBoss Schemas are present inside the ${JBOSS_HOME}/docs/schema/jboss_5_1.xsd (JBoss AS6 and earlier versions)

JBoss Schemas are present inside the ${JBOSS_HOME}/docs/schema/jboss-ejb3-2_0.xsd (JBoss AS7)

Here we will see with all the possible elements inside “weblogic-ejb-jar.xml” file how it looks :

Before Migration (weblogic-ejb-jar.xml)

<weblogic-ejb-jar id="{someID}" version="{someString}">
  <description>{someDescription}</description>
  <weblogic-enterprise-bean id="{someID}">
    <ejb-name>{someEjbName}</ejb-name>
    <transaction-descriptor id="{someID}">
      <trans-timeout-seconds>{someTxTimeout}</trans-timeout-seconds>
    </transaction-descriptor>
    <iiop-security-descriptor id="{someID}">
      <transport-requirements id="{someID}">
        <integrity id="{someID}">{someString}</integrity>
        <confidentiality id="{someID}">{someString}</confidentiality>
        <client-cert-authentication id="{someID}">{someString}</client-cert-authentication>
      </transport-requirements>
      <client-authentication id="{someID}">{someString}</client-authentication>
      <identity-assertion id="{someID}">{someString}</identity-assertion>
    </iiop-security-descriptor>
    <enable-call-by-reference>{some-true-false}</enable-call-by-reference>
    <network-access-point>{someString}</network-access-point>
    <clients-on-same-server>{some-true-false}</clients-on-same-server>
    <run-as-principal-name>{some-Role-Name}</run-as-principal-name>
    <create-as-principal-name id="{someID}">{someString}</create-as-principal-name>
    <remove-as-principal-name id="{someID}">{someString}</remove-as-principal-name>
    <passivate-as-principal-name id="{someID}">{someString}</passivate-as-principal-name>
    <jndi-name>{someJndiName}</jndi-name>
    <local-jndi-name>{someJndiName}</local-jndi-name>
    <dispatch-policy>{some-dispatch-policyType}</dispatch-policy>
    <remote-client-timeout>{someTxTimeout}</remote-client-timeout>
    <stick-to-first-server>{some-true-false}</stick-to-first-server>
  </weblogic-enterprise-bean>
  <security-role-assignment>{some-Role-Name}</security-role-assignment>
  <run-as-role-assignment>{some-Role-Name}</run-as-role-assignment>
  <security-permission>{some-security-permissionType}</security-permission>
  <transaction-isolation id="{someID}">
    <isolation-level id="{someID}">{someString}</isolation-level>
    <method id="{someID}">
      <description>{someDescription}</description>
      <ejb-name>{someEjbName}</ejb-name>
      <method-intf>{something}</method-intf>
      <method-name>{something}</method-name>
      <method-params>{something}</method-params>
    </method>
  </transaction-isolation>

  <message-destination-descriptor>{some-message-destination-descriptorType}</message-destination-descriptor>
  <idempotent-methods id="{someID}">
    <method id="{someID}">
      <description>{someDescription}</description>
      <ejb-name>{someEjbName}</ejb-name>
      <method-intf>{something}</method-intf>
      <method-name>{something}</method-name>
      <method-params>{something}</method-params>
    </method>
  </idempotent-methods>
  <retry-methods-on-rollback id="{someID}">
    <description>{someDescription}</description>
    <retry-count>{someTxTimeout}</retry-count>
    <method id="{someID}">
      <description>{someDescription}</description>
      <ejb-name>{someEjbName}</ejb-name>
      <method-intf>{something}</method-intf>
      <method-name>{something}</method-name>
      <method-params>{something}</method-params>
    </method>
  </retry-methods-on-rollback>
  <enable-bean-class-redeploy>{some-true-false}</enable-bean-class-redeploy>
  <timer-implementation id="{someID}">{someString}</timer-implementation>
  <disable-warning id="{someID}">{someString}</disable-warning>
  <work-manager>{something}</work-manager>
  <component-factory-class-name>{someString}</component-factory-class-name>
  <weblogic-compatibility id="{someID}">
    <entity-always-uses-transaction>{some-true-false}</entity-always-uses-transaction>
  </weblogic-compatibility>
</weblogic-ejb-jar>

After Migration (jboss.xml) to JBoss AS5/6

Now if we will try to migrate a weblogic based EJB Application to JBoss AS 5/6 then it will look something like following:

<jboss version="{someString}" metadata-complete="{true-false}" id="{someID}">
  <loader-repository>{someClassLoaderRepositoryName}</loader-repository>
  <jmx-name>{someJMXName}</jmx-name>
  <security-domain>{someSecurityDomainName}</security-domain>
  <missing-method-permissions-excluded-mode></missing-method-permissions-excluded-mode>
  <unauthenticated-principal></unauthenticated-principal>
  <jndi-binding-policy>{someStringJndiPolicy}</jndi-binding-policy>
  <jacc-context-id></jacc-context-id>
  <webservices id="{someID}">
    <context-root>{someStringValue}</context-root>
    <webservice-description>{some-webservice-descriptionType}</webservice-description>
  </webservices>
  <enterprise-beans>
  <service id="{someID}">
    <ejb-name>{someEJBName}</ejb-name>
    <mapped-name>{someMBeanObjectName}</mapped-name>
    <business-local>{someRemoteInterfaceEJBClass}</business-local>
    <business-remote>{someRemoteInterfaceEJBClass}</business-remote>
    <ejb-class>{someEJBClass}</ejb-class>
    <security-identity id="{someID}">
      <description>{someStringDescription}</description>
      <run-as-principal>{someRoleName}</run-as-principal>
    </security-identity>
    <object-name>{someJMXName}</object-name>
    <management></management>
    <xmbean></xmbean>
    <local-binding>
      <description>{someStringDescription}</description>
      <jndi-name>{someStringJndiPType}</jndi-name>
    </local-binding>
    <remote-binding id="{someID}">
      <description>{someStringDescription}</description>
      <jndi-name>{someStringJndiPType}</jndi-name>
      <client-bind-url></client-bind-url>
      <interceptor-stack></interceptor-stack>
      <proxy-factory></proxy-factory>
      <invoker-name></invoker-name>
    </remote-binding>
    <jndi-name>{someStringJndiPType}</jndi-name>
    <home-jndi-name>{someStringJndiPType}</home-jndi-name>
    <local-jndi-name>{someStringJndiPType}</local-jndi-name>
    <jndi-binding-policy>{someStringJndiPolicy}</jndi-binding-policy>
    <clustered></clustered>
    <cluster-config id="{someID}">
      <description>{someStringDescription}</description>
      <partition-name></partition-name>
      <home-load-balance-policy></home-load-balance-policy>
      <session-state-manager-jndi-name>{someStringValue}</session-state-manager-jndi-name>
    </cluster-config>
    <security-domain>{someMBeanObjectName}</security-domain>
    <method-attributes id="{someID}">
      <method id="{someID}">
        <method-name>{some-method-nameType}</method-name>
        <read-only>{some-boolean}</read-only>
        <idempotent>{some-boolean}</idempotent>
        <transaction-timeout></transaction-timeout>
      </method>
    </method-attributes>
    <depends>{someMBeanObjectName}</depends>
    <annotation id="{someID}">
      <description>{someStringDescription}</description>
      <annotation-class></annotation-class>
      <annotation-implementation-class></annotation-implementation-class>
      <injection-target>{someInjectionTarget}</injection-target>
      <property id="{someID}">
        <description>{someStringDescription}</description>
        <property-name>{someStringValue}</property-name>
        <property-value>{someStringValue}</property-value>
      </property>
    </annotation>
    <ignore-dependency id="{someID}">
      <description>{someStringDescription}</description>
      <injection-target>{someInjectionTarget}</injection-target>
    </ignore-dependency>
    <aop-domain-name></aop-domain-name>
    <pool-config>
      <pool-value></pool-value>
      <pool-max-size></pool-max-size>
      <pool-timeout></pool-timeout>
    </pool-config>
    <concurrent></concurrent>
    <jndi-ref id="{someID}">
      <description>{someStringDescription}</description>
      <jndi-ref-name>{someStringJndiPType}</jndi-ref-name>
    </jndi-ref>
    <port-component id="{someID}">
      <port-component-name>{someStringValue}</port-component-name>
      <port-component-uri>{someStringValue}</port-component-uri>
      <auth-method>{someStringValue}</auth-method>
      <transport-guarantee>{someStringValue}</transport-guarantee>
      <secure-wsdl-access>{some-boolean}</secure-wsdl-access>
    </port-component>
    <ejb-timeout-identity id="{someID}">
      <description>{someStringDescription}</description>
      <run-as-principal>{someRoleName}</run-as-principal>
    </ejb-timeout-identity>
  </service>
  </enterprise-beans>
  <assembly-descriptor id="{someID}">
    <security-role>{some-security-roleType}</security-role>
    <message-destination>{some-message-destinationType}</message-destination>
  </assembly-descriptor>
  <resource-managers id="{someID}">
    <description>{someStringDescription}</description>
    <resource-manager id="{someID}" res-class="{someStringValue}">
      <description>{someStringDescription}</description>
      <res-name>{someMBeanObjectName}</res-name>
    </resource-manager>
  </resource-managers>
</jboss>

So now as we know the tags which we can use in an order while migrating from WebLogic to JBoss, it will be an easy task now. :)
To know more about these common JBoss specific deployment descriptors please refer to the following link:
http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/ENC_Usage_Conventions-EJB_References_with_jboss.xml_and_jboss_web.xml.html
.
.
Thanks :)
Middleware Magic Team


EJB3.1 Automatic Schedulers in JBoss AS7

Hi,

Job Scheduling is one of the most important in while working in admin profile or for the developers. There were various options available for job scheduling, but as this has become a most findamental requirement for most of the applications or admins, So now as part of EE6 we can crate our own Automatic Schedulers/timers using the annotation “javax.ejb.Schedule”.

Enterprise bean timers are either programmatic timers or automatic timers. In this example we will see how we can create an “Automatic Timer”, Timers can be set according to a calendar-based schedule and these are very easy to maintain. Schedule a timer for automatic creation with a timeout schedule based on a cron-like time expression. The annotated method is used as the timeout callback method. All elements of this annotation are optional. If none are specified a persistent timer will be created with callbacks occuring every day at midnight in the default time zone associated with the container in which the application is executing. For more information on this you can refer to the following link:
http://docs.oracle.com/javaee/6/api/javax/ejb/Schedule.html

Step1). Create a Directory somewhere inside your file system where we can create our web application. Suppose i am creating a directory as “/home/userone/EJB31_Automatic_Scheduler” and the create a subdirectory with name “src” inside “/home/userone/EJB31_Automatic_Scheduler”

Step2). Now we will write the Scheduler Bean “AutomaticSchedulerBean.java” program inside the “/home/userone/EJB31_Automatic_Scheduler/src” directory which will have a method “backgroundProcessing()” and it will run on scheduled time as mentioned below:

dayOfWeek=* means all the seven days of a week
hour = “*” means every hour of a day
minute = “*” means every minute
second=”*/5″ means every five second interval
year=”2012″ means in the year 2012

package test;
import javax.ejb.Stateless;
import java.util.Date;
import javax.ejb.Schedule;

@Stateless(name="AutomaticSchedulerBean")
public class AutomaticSchedulerBean
 {
     @Schedule(dayOfWeek = "*", hour = "*", minute = "*", second = "*/5",year="2012", persistent = false)
     public void backgroundProcessing()
	    {
		   System.out.println("\n\n\t AutomaticSchedulerBean's backgroundProcessing() called....at: "+new Date());
	    }
 }

Step3). Now we will write a simple ant “build.xml” file in order to build the scheduler JAR and deploy it on JBoss AS7. So write the following “build.xml” file inside “/home/userone/EJB31_Automatic_Scheduler” as following:

<project name="Secured EJB Remote" default="all">
<property name="jboss.home" value="/home/userone/jboss-as-7.1.0.CR1b" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="src.dir" value="src" />
<property name="output.dir" value="build" />
<property name="ejb.jar" value="schedulerEJB.jar" />

        <path id="jboss.classpath">
           <fileset dir="${jboss.module.dir}">
               <include name="**/*.jar"/>
           </fileset>
        </path>

        <target name="all" depends="deploy" />

        <target name="build_ejb_jar">
           <delete dir="${output.dir}" />
           <delete dir="${tmp.dir}" />
           <mkdir dir="${output.dir}" />
           <mkdir dir="${tmp.dir}" />
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="*.java" classpathref="jboss.classpath"/> 

           <jar jarfile="${tmp.dir}/${ejb.jar}" basedir="${tmp.dir}" compress="true" />
           <copy file="${tmp.dir}/${ejb.jar}" tofile="${output.dir}/${ejb.jar}"/>

           <delete dir="${tmp.dir}"/>
        </target>

        <target name="deploy" depends="build_ejb_jar">
            <echo message="*******************  Deploying the EAR file ${ear.name} *********************" />
            <echo message="********** ${output.dir}/${ejb.jar} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${ejb.jar}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
            <echo message="******************* Check JBoss AS7 Console  *********************" />
        </target>

</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script is to point to your own JBoss AS7 directory home directory.

Step4). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/userone/jdk1.6.0_21/bin:/home/userone/apache-ant-1.8.2/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/apache-ant-1.8.2/bin;%PATH%

Step5). Now run the ant file from the directory where you have placed the “build.xml” file as following:

[userone@localhost EJB31_Automatic_Scheduler]$ ant
Buildfile: build.xml

build_ejb_jar:
   [delete] Deleting directory /home/userone/EJB31_Automatic_Scheduler/build
    [mkdir] Created dir: /home/userone/EJB31_Automatic_Scheduler/build
    [mkdir] Created dir: /home/userone/EJB31_Automatic_Scheduler/tmp
    [javac] Compiling 1 source file to /home/userone/EJB31_Automatic_Scheduler/tmp
      [jar] Building jar: /home/userone/EJB31_Automatic_Scheduler/tmp/schedulerEJB.jar
     [copy] Copying 1 file to /home/userone/EJB31_Automatic_Scheduler/build
   [delete] Deleting directory /home/userone/EJB31_Automatic_Scheduler/tmp

deploy:
     [echo] *******************  Deploying the EAR file ${ear.name} *********************
     [echo] ********** build/schedulerEJB.jar to /home/userone/jboss-as-7.1.0.CR1b/standalone/deployments **********
     [copy] Copying 1 file to /home/userone/jboss-as-7.1.0.CR1b/standalone/deployments
     [echo] *******************  Deployed Successfully   *********************
     [echo] ******************* Check JBoss AS7 Console  *********************

all:

BUILD SUCCESSFUL
Total time: 4 seconds

Step6). Now as soon the above Scheduler is deployed on the JBoss AS7 we will see this kind of messages in the JBoss AS7 Console.

15:14:33,655 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) Starting deployment of "schedulerEJB.jar"
15:14:34,085 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-5) JNDI bindings for session bean named AutomaticSchedulerBean in deployment unit deployment "schedulerEJB.jar" are as follows:

	java:global/schedulerEJB/AutomaticSchedulerBean!test.AutomaticSchedulerBean
	java:app/schedulerEJB/AutomaticSchedulerBean!test.AutomaticSchedulerBean
	java:module/AutomaticSchedulerBean!test.AutomaticSchedulerBean
	java:global/schedulerEJB/AutomaticSchedulerBean
	java:app/schedulerEJB/AutomaticSchedulerBean
	java:module/AutomaticSchedulerBean

15:14:34,477 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "schedulerEJB.jar"
15:14:35,014 INFO  [stdout] (pool-9-thread-1)
15:14:35,015 INFO  [stdout] (pool-9-thread-1)
15:14:35,015 INFO  [stdout] (pool-9-thread-1) 	 AutomaticSchedulerBean's backgroundProcessing() called....at: Sun Jan 29 15:14:35 IST 2012
15:14:40,015 INFO  [stdout] (pool-9-thread-2)
15:14:40,015 INFO  [stdout] (pool-9-thread-2)
15:14:40,015 INFO  [stdout] (pool-9-thread-2) 	 AutomaticSchedulerBean's backgroundProcessing() called....at: Sun Jan 29 15:14:40 IST 2012
15:14:45,003 INFO  [stdout] (pool-9-thread-3)
15:14:45,003 INFO  [stdout] (pool-9-thread-3)
15:14:45,003 INFO  [stdout] (pool-9-thread-3) 	 AutomaticSchedulerBean's backgroundProcessing() called....at: Sun Jan 29 15:14:45 IST 2012
15:14:50,003 INFO  [stdout] (pool-9-thread-4)
15:14:50,003 INFO  [stdout] (pool-9-thread-4)
15:14:50,003 INFO  [stdout] (pool-9-thread-4) 	 AutomaticSchedulerBean's backgroundProcessing() called....at: Sun Jan 29 15:14:50 IST 2012

These timers are good to perform some background activities like cleaning up some logs …etc.
.
.
Thanks
MiddlewareMagic Team


  • Receive FREE Updates


    FREE Email updates of our new posts Enter your email address:



  • Magic Archives

  • Copyright © 2010-2012 Middleware Magic. All rights reserved. | Disclaimer