Results 1 to 6 of 6

Thread: spring roo with JBoss 4.2.2

  1. #1
    Join Date
    Oct 2006
    Posts
    9

    Default spring roo with JBoss 4.2.2

    Has anyone successfully deployed spring roo on JBoss 4.2.2? I am running into classloader issues with the hibernate libraries.

    I tried adding a jboss-web.xml:
    Code:
    <jboss-web>
       <loader-repository> 
          com.myapp:archive=myapp.war 
       </loader-repository> 
    </jboss-web>
    Without success. I am getting errors like:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [/usr/local/jboss-4.2.2.GA-src/build/output/jboss-4.2.2.GA/server/default/tmp/deploy/tmp7492265287971892465myapp-exp.war/WEB-INF/classes/META-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [/usr/local/jboss-4.2.2.GA-src/build/output/jboss-4.2.2.GA/server/default/tmp/deploy/tmp7492265287971892465myapp-exp.war/WEB-INF/classes/META-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Ah jboss and hibernate, you gotta lova that combination.

    The problem is that jboss ships with a version of hibernate which is loaded before the one which is shipped with your application. So either change the classloading order or replace the hibernate version in the server.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2006
    Posts
    9

    Default

    Thanks. Upgrading the hibernate is not possible, do you have any advice on the classloader config?

  4. #4
    Join Date
    Oct 2006
    Posts
    9

    Default Working config

    I got it working!

    In WEB-INF/jboss-web.xml :
    Code:
    <jboss-web>
       <loader-repository> 
          com.myapp:archive=myapp.war
            <loader-repository-config>  
           java2ParentDelegation=false  
        </loader-repository-config>  
       </loader-repository> 
    </jboss-web>
    Add these dependencies to the pom.xml:
    Code:
    <dependency>
    	<groupId>org.hibernate</groupId>
    	<artifactId>hibernate-search</artifactId>
    	<version>3.0.1.GA</version>
    </dependency>
    
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>3.0.0.ga</version>
    </dependency>
    AFAIK, the reason these packages are required is to prefer them over the JBoss hibernate packages.

    I also needed to remove the log4j.appender.stdout from the log4j.properties file. It was causing the following error:
    Code:
    ERROR: invalid console appender config detected, console stream is looping

    Here are a few references I used:

    - an excellent article to start with (especially for the links to the jboss wiki and forums):
    http://jaitechwriteups.blogspot.com/...-in-jboss.html
    - the hibernate matrix for determining with version is compatible:
    https://www.hibernate.org/6.html#A3


    Could someone verify the dependencies are correct? Are there com.springsource.* artifacts that should be used?

  5. #5
    Join Date
    Oct 2006
    Posts
    9

    Default Not so fast

    So far everything was working well, but now I am running into this issue:

    http://stackoverflow.com/questions/2...-hibernate-ejb

    which likely is a hibernate/jboss issue not a spring roo issue.

  6. #6
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    667

    Post Updated URL

    Quote Originally Posted by jon077 View Post
    The Hibernate matrix for determining which version is compatible: https://www.hibernate.org/6.html#A3
    This has moved to http://community.jboss.org/wiki/Hibe...tibilityMatrix.
    Andrew Swan
    "Now is the EJB of our discontent made glorious Spring"

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •