Announcement Announcement Module
Collapse
No announcement yet.
Import config across jar files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Import config across jar files

    I have a project that exposes a bean to client apps. I'd like to drop a jar onto my classpath and have my project <import> a Spring config contained in that jar. It appears that Spring can't find the config file in the jar as I get the exception:

    Code:
    java.io.FileNotFoundException: class path resource [META-INF/myproject/../com/xyz/Service.xml] cannot be opened because it does not exist
    	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:160)
    ...
    The dependancy jar file is structured:

    Code:
    xyz-service-1.0.jar
       /META-INF
          /com
             /xyz
                Service.xml
       /com
          /...
    My project's jar is structured:
    Code:
    myproject-1.0.jar
       /META-INF
          /myproject
             MySpringConfig.xml
       /com
          /...
    MySpringConfig.xml contains a line like:

    Code:
    <import resource="../com/xyz/Service.xml"/>
    If I place the META-INF (but not the .class files) from the xyz-service jar into the myproject jar everything works fine, so I suspect that Spring does not <import> across jar files. Is this true? Is there a way around it?

  • #2
    try putting it that way:

    <import resource="com/xyz/Service.xml"/>

    and place the Service.xml not under META-INF/, but directly with the "com/xyz/" prefix
    Last edited by Injecteer; May 15th, 2006, 11:04 AM.

    Comment

    Working...
    X