11 Replies Latest reply on Feb 5, 2008 4:07 AM by Michele La Porta

    JBoss 4.2 Spring Deployer + Spring 2.08

    Brandon Harper Newbie

      I'm in the process of refactoring an app to take advantage of the JBoss Spring Deployer and I'm running into some minor issues. I have a project layout very similar to the example project.. here is the basic gist of what is in the EAR file which gets deployed:

      Services.spring -- these are the pojo services configured for the Spring deployer.

      Services.jar -- EJB's which get injected with the above POJO's

      Website.war -- Wicket app which has a service factory which in theory gets injected with the EJB's via JNDI.

      The Spring configured POJO's load fine, and as far as I can tell the EJB's get injected correctly, but various exceptions happen with the Website.war.

      At first it was missing some sort of class from the spring-web.jar, so I added it to the deployer. Now that the spring-web.jar is in the deployer, I'm getting an exception like this:



      04:50:44,413 ERROR [ContextLoader] Context initialization failed
      java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.registerScope(Ljava/lang/String;Lorg/springframework/beans/factory/config/Scope;)V
       at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext.java:161)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294)
       at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
       at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
       at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:589)
       at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
       at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.apache.catalina.core.StandardContext.init(StandardContext.java:5310)
      


      I also tried upgrading all of the jar's in the deployer to Spring 2.08 and ran into various problems because some of the methods the deployer relies on have been removed, etc.

      The downloads section of the Spring Deployer is not at all clear to me, so I may have downloaded/implemented it wrong. I basically did this to create a Spring deployer that seems to work for the most part:

      Downloaded the "Spring Deployer 1.3" and applied the JDK JAR from "Spring Deployer 2".

      Anyhow, I guess I have a few questions around all of this:

      1. Did I implement the deployer correctly? If not, what should I do?
      2. What version of Spring is supported/shipped with the deployer?
      3. Will Spring 2.0.8 or 2.5.1 support get rolled into the deployer anytime soon for JBoss 4.x? I think I ran into some bugs which put me on 2.0.8 (2.5.1 would be much preferred however)

      Thanks,

      - Brandon



        • 1. Re: JBoss 4.2 Spring Deployer + Spring 2.08
          Ales Justin Master

           

          "devnulled0" wrote:

          I also tried upgrading all of the jar's in the deployer to Spring 2.08 and ran into various problems because some of the methods the deployer relies on have been removed, etc.

          Which methods?
          Can you post your exceptions.
          It's been a while since I compiled the version for JBoss4.x.

          "devnulled0" wrote:

          The downloads section of the Spring Deployer is not at all clear to me, so I may have downloaded/implemented it wrong. I basically did this to create a Spring deployer that seems to work for the most part:

          Yup, it can be a bit confusing.
          The thing is that only core deployer code changes, so no need for the full update on spring.jar and jboss-service.xml.
          That's why I only put that artifact on the download site.

          "devnulled0" wrote:

          1. Did I implement the deployer correctly? If not, what should I do?
          2. What version of Spring is supported/shipped with the deployer?
          3. Will Spring 2.0.8 or 2.5.1 support get rolled into the deployer anytime soon for JBoss 4.x? I think I ran into some bugs which put me on 2.0.8 (2.5.1 would be much preferred however)


          1) Looks ok, but like you said, and I'm aware of, there can be compability issues.
          You can try it yourself - to build against 2.0.8 and 2.5 - the changes needed to be done should be trivial.
          Eventually I'll do those two releases, but currently there is no time for that. :-(

          2) Uf, dunno. :-) If there is a spirng.jar, it should have MANIFEST.MF, where the version is stated.

          3) Hmmm, after JBossWorld.
          I could do the changes for JBoss5 much quicker, since I'm working on the trunk on daily bases. But porting it back for 4.x will take some time.
          But I'm always thumbs up for some contribution. ;-)

          • 2. Re: JBoss 4.2 Spring Deployer + Spring 2.08
            Brandon Harper Newbie

            Thanks for the quick reply. I've spent the day looking at other classloader issues and am finally back to this issue, and I think I'd like to try and build this against a current version of Spring.

            I checked-out the project from Sourceforge from trunk, and when I run the build.sh script under spring-int, I get this error:

            tobin:~/dev/jbossas/spring-int brandon$ ./build.sh
            Searching for build.xml ...
            Buildfile: /Users/brandon/dev/jbossas/spring-int/build.xml
            /Users/brandon/dev/jbossas/thirdparty/libraries.ent could not be found
            
            BUILD FAILED
            java.io.FileNotFoundException: /Users/brandon/dev/jbossas/thirdparty/libraries.ent (No such file or directory)
            
            Total time: 0 seconds
            


            Any suggestions? I looked for documentation but didn't find much. FWIW, I'm on OS X running Java 6.

            Also, should I be doing anything specific to get the version which works with JBoss 4.x?

            Thanks,

            - Brandon

            • 3. Re: JBoss 4.2 Spring Deployer + Spring 2.08
              Brandon Harper Newbie

              Oh, and FWIW, the current Spring version for JBoss seems to be Spring 2.0 M3. Thanks for the help and creating this deployer-- if I can manage to get it updated to a current version it will be super helpful and I can pass back any patches needed, etc.

              • 4. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                Ales Justin Master

                 

                "devnulled0" wrote:

                Any suggestions? I looked for documentation but didn't find much. FWIW, I'm on OS X running Java 6.

                Also, should I be doing anything specific to get the version which works with JBoss 4.x?

                First, I think you should be trying to fix this against some AS4.x branch.
                Not the trunk, since trunk already contains new code needed for AS5.

                Then simply run (JBossAS_4.x_HOME)/build/build.sh.
                This will download all the required thirdparty libs (that's what's missing with you - the libraries.ent warning) and build the server instance.
                After that you should be able to run spring-int build as well.
                By default (in pre AS5) spring-int is excluded from main build.


                • 5. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                  Brandon Harper Newbie

                   

                  "alesj" wrote:

                  First, I think you should be trying to fix this against some AS4.x branch.
                  Not the trunk, since trunk already contains new code needed for AS5.

                  Then simply run (JBossAS_4.x_HOME)/build/build.sh.
                  This will download all the required thirdparty libs (that's what's missing with you - the libraries.ent warning) and build the server instance.
                  After that you should be able to run spring-int build as well.
                  By default (in pre AS5) spring-int is excluded from main build.


                  Thanks, I'm used to Maven so buildmagic is Greek to me at the moment.

                  I checked out of the newest 4.x branch I could find with spring-int in it, which was:

                  tobin:~/dev/jboss brandon$ svn info
                  Path: .
                  URL: http://anonsvn.jboss.org/repos/jbossas/branches/JBoss_4_0_4_JBAS-4213
                  Repository Root: http://anonsvn.jboss.org/repos/jbossas
                  Repository UUID: 84be2c1e-ba19-0410-b317-a758671a6fc1
                  Revision: 69357
                  Node Kind: directory
                  Schedule: normal
                  Last Changed Author: bstansberry@jboss.com
                  Last Changed Rev: 61460
                  Last Changed Date: 2007-03-19 12:28:18 -0600 (Mon, 19 Mar 2007)
                  


                  I moved to JDK5 and got JBoss to build just fine. However, when I went to build spring-int I got this error:

                  tobin:~/dev/jboss/spring-int brandon$ ./build.sh
                  Searching for build.xml ...
                  Buildfile: /Users/brandon/dev/jboss/spring-int/build.xml
                  
                  _buildmagic:init:
                  Trying to override old definition of task property
                  
                  _buildmagic:init:buildlog:
                  
                  configure:
                  
                  init:
                  
                  _buildmagic:build-bypass-checker:
                  
                  _buildmagic:build-bypass-notice:
                  
                  _buildmagic:build-bypass-check:
                  
                  jars:
                  
                  _buildmagic:init:
                  
                  init:
                  
                  compile-classes:
                   [javac] Compiling 8 source files to /Users/brandon/dev/jboss/spring-int/output/classes
                  
                  BUILD FAILED
                  /Users/brandon/dev/jboss/spring-int/build.xml:299: The following error occurred while executing this line:
                  /Users/brandon/dev/jboss/spring-int/build.xml:227: Reference spring.classpath not found.
                  


                  I poked around in build.sh and build.xml.. looked around in the tools/etc/buildmagic directory and noticed that nothing about Spring was mentioned in there, but otherwise I don't know this build system well enough to know what to even look for or change. Any suggestions? Thanks!

                  • 6. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                    Ales Justin Master

                     

                    "devnulled0" wrote:

                    I poked around in build.sh and build.xml.. looked around in the tools/etc/buildmagic directory and noticed that nothing about Spring was mentioned in there, but otherwise I don't know this build system well enough to know what to even look for or change. Any suggestions? Thanks!

                    Uf, ok, I know build magic can be pita.
                    I can have a look at the end of this next week.
                    That soon enough?
                    If I forget, grab me at JBossWorld, since I know you'll be there. :-)

                    • 7. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                      Brandon Harper Newbie

                      I wish I were going to JBossWorld! ;)

                      If you could look at it by then that would be great. I have some code going to QA this week and if I have time to patch up the Spring Deployer to a more recent version between this week and next week, that would be perfect. Thanks!

                      • 8. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                        Michele La Porta Newbie

                        I'm running jboss-4.2.2.GA with spring-deployer (2.0-m3)
                        I wish to see this support for spring-2.0.8 or 2.5.

                        Thanks

                        Michele

                        • 10. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                          Michele La Porta Newbie

                          Great!

                          I will try and post comments

                          Thanks

                          michele

                          • 11. Re: JBoss 4.2 Spring Deployer + Spring 2.08
                            Michele La Porta Newbie

                            Hi alesj,
                            spring-int works with both spring-2.5 and spring-2.0.8.

                            Thanks

                            Michele