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

bkadmin
Wednesday December 24, 2014 - 21:12 Blog, Development
Recent posts
Reclaim your disk space from Xcode

Do you have problems with the space on your disk? You are in the right place! This post is for […]

Read More…

Continue reading
25 June, 2020
RoR – Get your exceptions notified via Slack

Have you ever wanted to be one step ahead, and be notified of any unwanted exception before your users have […]

Read More…

Continue reading
18 October, 2018
Easy creation of a new Node + React project

Starting a new project is something everybody loves to do. However, some steps are always the same for every project. […]

Read More…

Continue reading
3 October, 2018
Learning SCRUM with LEGOS

In Kreitech, we know about Scrum, and we apply it in many of our projects, which gives us very positive […]

Read More…

Continue reading
19 September, 2018