Bitter bites with Java

JBoss4.0.5 to JBoss 5GA

Posted by: Venugopal S on: February 2, 2009

Hi,

Our application runs on Jboss4.0.5 for almost 2.5 years now. One thing that was appealing me the most with Jboss5 was its proved performance wrt JBoss Messaging. We have been using JBossMQ for long.

The day wasn’t pleasant when i started exploring Jboss5. It threw all strange errors and Exceptions to a newbie like me at the outset. Ok.. After about 3/4th of a week was spent, i was gaining grip on the new beast Jboss5 (finally).

You should not be bewildered initially. I would like to mention few things i learnt the very hard way.

Migrating to Jboss5:

  • XML files are strictly validated against the schema. Hence we need to alter some of the XML files :

In application.xml we have to replace

<application xmlns=”http://java.sun.com/xml/ns/j2ee” version=”1.4″

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation=”http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd”>

<display-name>ss</display-name>

WITH

<?xml version=”1.0″ encoding=”UTF-8″?>
<application 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”
version=”5″>


And the <description> tag should be removed.

In persistence.xml:

The root element was simple and plain. We need to update it to

<persistence

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_1_0.xsd”

version=”1.0″>

web.xml : Mixing <servlet> and <servlet-mapping> is not allowed in Jboss 5 and the dtd has to be updated to

<!DOCTYPE web-app

PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”

“http://java.sun.com/dtd/web-app_2_3.dtd”>

And in all the occurrences of

this.queueConnectionFactory = (QueueConnectionFactory) this.ctx

.lookup(“QueueConnectionFactory”);

we need to replace with

this.queueConnectionFactory = (QueueConnectionFactory) this.ctx

.lookup(“ConnectionFactory”);

jboss-app.xml which contains

<!DOCTYPE jboss-app

PUBLIC “-//JBoss//DTD J2EE Application 1.4//EN”

“http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd”>

has to be updated with the latest dtd as

<!DOCTYPE jboss-app

PUBLIC “-//JBoss//DTD Java EE Application 5.0//EN”

“http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd”>.

The annotations are a bit different in Jboss 5.

In a POJO class, we were using the JoinColumn annotations like

@ManyToOne

@JoinColumn(name = “orderid”, insertable = false)

which has to be modified to

@ManyToOne

@JoinColumns({@JoinColumn(name = “orderId”,referencedColumnName=”orderId”,insertable = false)})

referencedColumnName is a must in JBoss 5 for this annotation.

For JMS :

In case of Jboss4, all the JMS related stuff had to go in jbossmq-destinations-service.xml.

Sample element :

<mbean code=”org.jboss.mq.server.jmx.Queue”

name=”jboss.mq.destination:service=Queue,name=TotalOrderQueue”>

<attribute name=”JNDIName”>queue/TotalOrderQueue</attribute>

<attribute name=”RedeliveryDelay”>10000</attribute>

<attribute name=”RedeliveryLimit”>3</attribute>

<depends optional-attribute-name=”DestinationManager”>jboss.mq:service=DestinationManager</depends>

</mbean>

But in Jboss 5, Jboss messaging has replaced JbossMQ. Jboss messaging is significantly faster than JbossMQ(Ref : http://www.jboss.org/file-access/default/members/jbossmessaging/freezone/docs/userguide-2.0.0.alpha1/html/performance.html).

The configurations need to be tweaked a bit to be read as follows (also the configuration filename has changed to destinations-service.xml):

<mbean code=”org.jboss.jms.server.destination.QueueService”

name=”jboss.messaging.destination:service=Queue,name=TotalOrderQueue”

xmbean-dd=”xmdesc/Queue-xmbean.xml”>

<depends optional-attribute-name=”ServerPeer”>jboss.messaging:service=ServerPeer</depends>

<depends>jboss.messaging:service=PostOffice</depends>

</mbean>

Hope this helps!

9 Responses to "JBoss4.0.5 to JBoss 5GA"

Hi,
This is my personal experience. More will be added to this as and when i come across.

Hello everybody,

first of all thank you for your experiences venuwin!

I also started migrating from jboss 4.0.0 to the new released jboss 5 GA. I came along serveral problems while trying to deploy ejbs into jboss 5 that where running perfectly in an jboss 4 environment.

I can confirm your problems with web.xml and jboss-app.xml in ear- and war-archives.

Example for an ejb-web.xml:

DTD from JBoss 4:

And the Edited DTD for JBoss 5:

Also very important:
To make your JBoss 4 Client communicate with the new JBoss 5 server you have to replace all the old client jars – usually jbossall-client.jar and all depending jars (take a look at the manifest in your jbossall-client.jar).

And this is exactly where I got stuck…although I replaced all client jars I get the following exception:

javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.ejb3.remoting.IsLocalInterceptor; local class incompatible: stream classdesc serialVersionUID = -3758782076801249473, local class serialVersionUID = 337700910587744646]

I almost tried everything. Has anybody got experience with this error? I am running out of ideas.

Thank you in advance!

Alex

Hi Venugopal,

did you use some reference documentation or books?
Please, could you send me this references if you have used?

I have to migrate some EJBs 2.x from JBoss 4.x to JBoss 5 and I have many problems with JBoss 5 configurations.

Congratulations for your post .

Tanks.

Hi Venu Gopal,
We have been using JBOSS 4 for 2 yrs now, and are planning to move to Jboss too. IT was encouraging to read comments on some one who has done it.
Where did you strat the upgrade initially? How did you migrate the existing server ( C:\boss-4\server\xxx) directory? Where there any jars different in the new version?
Thanks
Sreeja

Hi everybody,

Sorry for the belated reply ..
Let me answer one by one :)

Alex : Pls refer my post https://jira.jboss.org/jira/browse/EJBTHREE-1696. You have to upgrade to Jboss 4.2 atleast to get rid of this.

Fransisco : There is no reliable doc available to do this. All that i followed was Jboss reference for version 5 which was outdated with wrong contents. I learnt all these the hard way.

Frankly speaking, there is no specific place to start with. But still the rule of thumb :

1. Update your XML contents
2. If you are using MySQL, upgrade to the latest .jar file and prefer XA datasource to avoid issues with Arjuna API
3. Correct your EJB3 annotations wherever required

Hope this helps..

[...] This is again a small JMS configuration stuff we have to do in JBoss 5. There is considerable difference in doing it in JBoss 5 compared to JBoss 4 and don’t expect our old configuration to work well with JBoss 5 without any change. In JBoss 5 they are using JBoss Messaging in place of JBoss MQ. You can read a detailed post on migrating from JBoss 4 to JBoss 5 here. [...]

Hello,

I’m migrating application from Jboss 3.2.6 to Jboss 5.1.0 GA.

I’ve used EJB 2, Message Driven Beans, Hibernate.

Could you please give guidance on what all changes required to deploy on JBOSS 5.1.0 GA ?

Also please tell which all and what needs to be added in .xml files for message-driven-beans

Need your help to solve the issues.

I’ve tried to resolve some of the errors but no success

1. namingexception – …. not bound
2. failed to reactivate

Hi Kuldeep,

We (me & venu) were using Jboss 4 before migrating to 5.0 and then to 5.1. I don’t have much idea about migrating from 3.x to 5.x.

I have a small post in my blog on configuring JMS for Jboss 5. Hope this will help you.

http://javabeanz.wordpress.com/2009/06/05/configuring-jms-in-jboss-5/

Subin

Leave a Reply


  • whitelassiblog: jbossjta-properties.xml is present in JBOSS_HOME/checkout folder. Check it out !
  • Subinkrishna G: Hi Kuldeep, We (me & venu) were using Jboss 4 before migrating to 5.0 and then to 5.1. I don't have much idea about migrating from 3.x to 5.x.
  • Kuldeep: Hello, I'm migrating application from Jboss 3.2.6 to Jboss 5.1.0 GA. I've used EJB 2, Message Driven Beans, Hibernate. Could you please give

Categories

Archives