Spring Framework
  1. Spring Framework
  2. SPR-5120

Spring component scanning does not work within JBoss EJB container

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.5
    • Fix Version/s: 3.0 RC1
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      The spring scanner functionality do not work when I create my ApplicationContext from a EJB managed by JBoss. I do test the same spring application context on diferents enviroments. Just on a managed EJB on a JBoos it is not workin.

      EJB code
      appContext = new GenericApplicationContext();
      ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(appContext);
      scanner.scan("com");
      appContext.refresh();

      Annotated class
      @Service
      public class TransactionService {

      Exception
      ERROR: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionService' is defined

      1. vfs.patch
        12 kB
        Marius Bogoevici
      2. vfs-fixes-2.patch
        15 kB
        Marius Bogoevici
      3. vfs-fixes-3.patch
        16 kB
        Marius Bogoevici

        Issue Links

          Activity

          Hide
          Thomas Risberg added a comment -

          I have committed a revised patch for this issue. Moved methods from ResourceUtils to a separate ResourceHandlingUtils in the core.io.support package to avoid dependency cycles between packages.

          -Thomas

          Show
          Thomas Risberg added a comment - I have committed a revised patch for this issue. Moved methods from ResourceUtils to a separate ResourceHandlingUtils in the core.io.support package to avoid dependency cycles between packages. -Thomas
          Hide
          David Ward added a comment -

          At Alfresco we found that the VFSResource implementation still didn't work with some of our webapps that would work in Tomcat.

          For example this context file that uses ".." in a relative URL

          <?xml version='1.0' encoding='UTF-8'?>
          <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

          <beans>
          <!--
          The bean definitions for this subsystem are shared by the ldap and ldap-ad subsystems with different property
          defaults
          -->
          <import resource="../common-ldap-context.xml" />
          </beans>

          We fixed our own VFSResource implementation as follows

          public Resource createRelative(String relativePath) throws IOException

          { return new VFSResource(VFS.getRoot(new URL(getURL(), relativePath))); }

          Please consider reopening this issue and fixing as above.

          Show
          David Ward added a comment - At Alfresco we found that the VFSResource implementation still didn't work with some of our webapps that would work in Tomcat. For example this context file that uses ".." in a relative URL <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <!-- The bean definitions for this subsystem are shared by the ldap and ldap-ad subsystems with different property defaults --> <import resource="../common-ldap-context.xml" /> </beans> We fixed our own VFSResource implementation as follows public Resource createRelative(String relativePath) throws IOException { return new VFSResource(VFS.getRoot(new URL(getURL(), relativePath))); } Please consider reopening this issue and fixing as above.
          Hide
          Marius Bogoevici added a comment -

          Thomas,

          FIrst, thanks for comitting the patch. Also, David is right - and I made the changes in our code as per https://jira.jboss.org/jira/browse/JBSPRING-4, so it would be a good idea if same would be done for Spring 3.0.

          Thanks,
          Marius

          Show
          Marius Bogoevici added a comment - Thomas, FIrst, thanks for comitting the patch. Also, David is right - and I made the changes in our code as per https://jira.jboss.org/jira/browse/JBSPRING-4 , so it would be a good idea if same would be done for Spring 3.0. Thanks, Marius
          Hide
          Thomas Risberg added a comment -

          modified createRelative according to David Ward's suggestion for JBSPRING-4

          Show
          Thomas Risberg added a comment - modified createRelative according to David Ward's suggestion for JBSPRING-4
          Hide
          Sundar Sankarnarayanan added a comment -

          Hi All
          Thanks for making the component scan work. Even though this Jira talks of EJB with Jboss 5, I was wondering if component-scanning in general would work with Jboss 5.

          I had posted something on the forum a while back (http://forum.springsource.org/showthread.php?t=71541) and had not created a jira for my problem as I felt it was related to the one mentioned here. Am putting in this component to make sure if I was right or not.

          Thanks
          Sundar

          Show
          Sundar Sankarnarayanan added a comment - Hi All Thanks for making the component scan work. Even though this Jira talks of EJB with Jboss 5, I was wondering if component-scanning in general would work with Jboss 5. I had posted something on the forum a while back ( http://forum.springsource.org/showthread.php?t=71541 ) and had not created a jira for my problem as I felt it was related to the one mentioned here. Am putting in this component to make sure if I was right or not. Thanks Sundar

            People

            • Assignee:
              Thomas Risberg
              Reporter:
              Pedro Santos
              Last updater:
              Trevor Marshall
            • Votes:
              24 Vote for this issue
              Watchers:
              34 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 30 weeks, 6 days ago