Announcement Announcement Module
Collapse
No announcement yet.
spring roo with JBoss 4.2.2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


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

      Comment


      • #4
        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?

        Comment


        • #5
          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.

          Comment


          • #6
            Updated URL

            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.

            Comment

            Working...
            X