• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading different version of Hibernate(3.3) in Jboss4.0.3

 
Prashant Vasudeo
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using Hibernate code 3.2.5GA and Annotations 3.3 with Jboss 4.0.3, which comes pre-packaged with Hibernate 3.1 jar.

I am facing classloading problem, as it takes 3.1 jar rather than 3.3 which is bundled in my .war file.

what i want that my application should use 3.3 jar packaged in my war file rather than from 3.1 jar

after reading these article...
http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration
http://java2.5341.com/msg/68204.html

I did following changes,

jboss-web.xml
--------------
<jboss-web>
<context-root>ABC</context-root>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
aaaa.com:loader=ABC.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>

jboss-app.xml
--------------
<jboss-app>
<class-loading>
<loader-repository>aaaa.com:loader=ABC.ear</loader-repository>
</class-loading>
</jboss-app>

I am using following structure of my ear file
/
ABC.war
META-INF/
application.xml
jboss-app.xml

Also I don't have access to jboss-service.xml, as it is not for a particluar jboss instance but for firm wide usage, so i cannot change anything in this file.

Can anybody tell me what is wrong in it or any other way to work

Prashant

[ January 30, 2008: Message edited by: Prashant Vasudeo ]
[ January 30, 2008: Message edited by: Prashant Vasudeo ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since your WAR is packaged in the EAR, you need not do anything related to classloading configuration in the jboss-web.xml. So your jboss-web.xml can be something like :



Then in the jboss-app.xml you add something like this:



Try these changes and see if it works. If not, then post the exact details as to what is happening.
 
Prashant Vasudeo
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in Jboss-app.xml
org.myapp:loader=MyAppClassLoader

what is "MyAppClassLoader"...Do I need to create my own classloader or its value will be "myear.ear" ?

Prashant
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.myapp:loader=MyAppClassLoader is just a unique name. You can give any unique name(actually there's a pre-defined format for MBean Object names), as per your wish. JBoss will create a classloader for your application with this name. In general, the name looks like:

 
Prashant Vasudeo
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi done the changes

Still picks the 3.1 hibernate and not 3.3

-------------------------------------------------
[org.hibernate.cfg.Environment] Hibernate 3.1 [org.hibernate.cfg.Environment] hibernate.properties not found [org.hibernate.cfg.Environment] using CGLIB reflection optimizer [org.hibernate.cfg.Environment] using JDK 1.4 java.sql.Timestamp handling [org.hibernate.cfg.Configuration] configuring from resource: /hibernate.qa.cfg.xml [org.hibernate.cfg.Configuration] Configuration resource: /hibernate.qa.cfg.xml [org.hibernate.util.DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/ [org.hibernate.util.DTDEntityResolver] found http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath [org.hibernate.cfg.Configuration] dialect=org.hibernate.dialect.DB2Dialect [org.hibernate.cfg.Configuration] show_sql=true [org.hibernate.cfg.Configuration] hibernate.format_sql=false [org.hibernate.cfg.Configuration] use_outer_join=false

My unix server is configured for server as "all" and not "default"

I downloaded Jboss4.0.3 Windows version and without changing any thing i deployed the war file with jboss-web.xml It is picking jar from WEB-INF/lin folder i.e 3.3 jar are getting loaded.

Any difference between server "all" and "default" ?

Prashant
[ January 31, 2008: Message edited by: Prashant Vasudeo ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic