Announcement Announcement Module
Collapse
No announcement yet.
Spring across projects in RAD/Eclipse on WebSphere Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring across projects in RAD/Eclipse on WebSphere

    Hello,

    I am trying to build an project in Eclipse (actually I'm using RAD, so basically eclipse, and when I say 'JEE Project' I mean an 'Enterprise Application Project'). The project is being deployed to WebSphere 6.1.

    My Enterprise Application Project (the 'EAR' project) has two module projects : - service - web

    The service project has some stuff in it, all wired up using Spring.

    The web project has its own stuff in it, all wired up using Spring. The UI stuff in the web project needs to use the stuff in the service project.

    Both projects are included in the EAR project as modules.

    The web project lists the 'service' project as a dependent project in the build path, it's checked off for export, and also has it listed as a EE Module Dependency.

    I'm having a really hard time to get this working though:

    The spring context in the web project is of course what gets loaded when the application is deployed, and it imports the spring config I need from the service project. This seems to be working fine.

    When spring tries to instantiate a bean it throws a ClassNotFoundException. On the very first bean.

    I tried simply copying the spring config from my service context and pasting it into my web context, but I got the same ClassNotFoundException.

    I have tried instantiating an object of that type (the class that spring says cannot be found) in the java controller class in the web project, and it is successful, both at compile time (no compile errors) and at runtime (no exceptions).

    So the classes from my service project are not available on the classpath when spring tries to use them.

    It seems like the classloader that Spring is running in a separate classloader that doesn't have access to the classes in the service project.

    Any ideas what's going on here and/or what I might be able to do about it?

  • #2
    make your service project jar file and copy into you WEB-INF/lib folder, and copy all spring bean xml file from service into WEB-INF/classes or classpath and configure context lister in web.xml file and give to you service spring xml file , path.
    ex:
    WEB-INF/lib/service.jar (which contain your service)
    web.xml

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext-service*.xml</param-value>
    </context-param>

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    it will be going to resolve you classnotfoundexception.

    Comment

    Working...
    X