Access EJB 3.0 in JBoss 5, from JBoss 4

Category

Blog Development
24 December, 2014 0

If you are in a process of migrating JBoss servers you may sometimes need to deploy an EAR in a newer server, while having others in the older servers and keep the integration between the apps. We faced this issue when migrating from JBoss 4.3 to JBoss 5, but you may face a similar issue when migrating different versions.

One problem that may arrive when an application in the older server (JBoss 4) tries to access an EJB in the newer (JBoss 5) is this exception when doing a lookup:

java.lang.ClassCastException: javax.naming.Reference cannot be cast to XXX

Being XXX the interface you want to lookup in the JBoss 5 server.

This problem occurs because the application is using by default the client libraries of the JBoss 4 server. To solve this problem, you need to add the client jar files of the JBoss 5 server to the application in JBoss 4.

In order to do this, you need to copy the jars from JBoss 5 jbossall-client.jar and all its dependencies (listed in the META-INF, excluding jnp-client.jar) inside the application EAR file in JBoss 4 (in the lib folder inside the EAR).

This is the full list of jar files that need to be copied from /jboss-as/client inside /lib:

common-annotations.jar

commons-beanutils.jar

commons-collections.jar

commons-digester.jar

commons-logging.jar

concurrent.jar

ejb3-persistence.jar

hibernate-annotations.jar

hibernate-commons-annotations.jar

hibernate-core.jar

hibernate-validator.jar

jboss-aop-client.jar

jboss-appclient.jar

jboss-aspect-jdk50-client.jar

jboss-client.jar

jboss-common-core.jar

jboss-deployers-client-spi.jar

jboss-deployers-client.jar

jboss-deployers-core-spi.jar

jboss-deployers-core.jar

jboss-deployment.jar

jboss-ejb3-common-client.jar

jboss-ejb3-core-client.jar

jboss-ejb3-ext-api-impl.jar

jboss-ejb3-ext-api.jar

jboss-ejb3-proxy-clustered-client.jar

jboss-ejb3-proxy-impl-client.jar

jboss-ejb3-proxy-spi-client.jar

jboss-ejb3-security-client.jar

jboss-ha-client.jar

jboss-ha-legacy-client.jar

jboss-iiop-client.jar

jboss-integration.jar

jboss-j2se.jar

jboss-javaee.jar

jboss-jsr77-client.jar

jboss-logging-jdk.jar

jboss-logging-log4j.jar

jboss-logging-spi.jar

jboss-mdr.jar

jboss-messaging-client.jar

jboss-profileservice-client.jar

jboss-remoting.jar

jboss-security-spi.jar

jboss-serialization.jar

jboss-srp-client.jar

jboss-system-client.jar

jboss-system-jmx-client.jar

jbossall-client.jar

jbosscx-client.jar

jbossjts.jar

jbosssx-as-client.jar

jbosssx-client.jar

jmx-client.jar

jmx-invoker-adaptor-client.jar

jsf-facelets.jar

jsf-tlds.jar

jstl.jar

richfaces-api-3.2.1.GA.jar

richfaces-impl-3.2.1.GA.jar

richfaces-ui-3.2.1.GA.jar

slf4j-api.jar

slf4j-jboss-logging.jar

standard.jar

xmlsec.jar

NOTE: If you fail to copy this list and add also the jnp-client.jar you will get this error when deploying the application:

java.lang.IncompatibleClassChangeError: Class org.jnp.server.NamingServer does not implement the requested interface org.jnp.interfaces.Naming

COMMENTS

Leave a Reply

Your email address will not be published. Required fields are marked *

bkadmin
Wednesday December 24, 2014 - 21:12 Blog, Development
Recent posts
Managing React server state: a simpler approach

The role of the state The state is a property of each component that holds its data, it gives personality […]

Read More…

Continue reading
17 May, 2021
The Importance Of Retrospectives Meetings

What are retrospectives and why are they important? If you know SCRUM you will be familiar with the retrospective meeting […]

Read More…

Continue reading
10 May, 2021
Using Mockito to create Java Unit Test

Let’s start with the definition given by the official page. “Mockito is a mocking framework that tastes really good. It […]

Read More…

Continue reading
1 December, 2020
From idea to deploy

When the great idea and background just isn’t enough […]

Read More…

Continue reading
11 August, 2020