Announcement Announcement Module
Collapse
No announcement yet.
Errors in Geronimo but not WAS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Errors in Geronimo but not WAS

    Now that Spring is certificed to work on WAS CE (aka Geronimo more or less) and WAS, is there any information anywhere that highlights what you have to do differrently between these two servers when deploying EARs with Spring jars and user code inside ? As an example I am posting an error I get when trying to start an app deployed to IBM WebSphere Application Server Community Edition V1.0.1.2. My guess is that this is a Geronimo problem not a Spring one, but as part of the certification process I was wondering if anyone came across this in Geronimo and knew of a workaround.

    For instance I have a org.springframework.web.context.ContextLoaderListe ner that is defined thus:

    <context-param>
    <param-name>locatorFactorySelector</param-name>
    <param-value>
    net/targetgroup/tprweb/spring/beanRefContext.xml
    </param-value>
    </context-param>
    <context-param>
    <param-name>parentContextKey</param-name>
    <param-value>servicelayer-context</param-value>
    </context-param>
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>


    This works fine in WAS and loads up my context files from here:

    <bean id="servicelayer-context"
    class="org.springframework.context.support.ClassPa thXmlApplicationContext">
    <constructor-arg>
    <list>
    <value>net/targetgroup/sv2/model/spring/*Context.xml</value>
    </list>
    </constructor-arg>
    </bean>


    All the context files are within a "dependant jar file" that is on the web apps manifest classpath.

    However in Geronimo I get this when the app starts to load:

    13:33:44,855 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.access.Bootstrap Exception: Unable to initialize group definition. Group resource name [classpath*:net/targetgroup/tprweb/spring/beanRefContext.xml], factory key [servicelayer-context]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'servicelayer-context' defined in URL [file:/C:/Program%20Files/IBM/WebSphere/AppServerCommunityEdition1.1/config-store/26/TPRWeb.war/WEB-INF/classes/net/targetgroup/tprweb/spring/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlAp plicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionSt oreException: Could not resolve bean definition resource pattern [net/targetgroup/sv2/model/spring/*Context.xml]; nested exception is java.io.FileNotFoundException: class path resource [net/targetgroup/sv2/model/spring/] cannot be resolved to URL because it does not exist
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'servicelayer-context' defined in URL [file:/C:/Program%20Files/IBM/WebSphere/AppServerCommunityEdition1.1/config-store/26/TPRWeb.war/WEB-INF/classes/net/targetgroup/tprweb/spring/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlAp plicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionSt oreException: Could not resolve bean definition resource pattern [net/targetgroup/sv2/model/spring/*Context.xml]; nested exception is java.io.FileNotFoundException: class path resource [net/targetgroup/sv2/model/spring/] cannot be resolved to URL because it does not exist
    org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlAp plicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionSt oreException: Could not resolve bean definition resource pattern [net/targetgroup/sv2/model/spring/*Context.xml]; nested exception is java.io.FileNotFoundException: class path resource [net/targetgroup/sv2/model/spring/] cannot be resolved to URL because it does not exist
    org.springframework.beans.factory.BeanDefinitionSt oreException: Could not resolve bean definition resource pattern [net/targetgroup/sv2/model/spring/*Context.xml]; nested exception is java.io.FileNotFoundException: class path resource [net/targetgroup/sv2/model/spring/] cannot be resolved to URL because it does not exist
    java.io.FileNotFoundException: class path resource [net/targetgroup/sv2/model/spring/] cannot be resolved to URL because it does not exist
    at org.springframework.core.io.ClassPathResource.getU RL(ClassPathResource.java:157)
    at org.springframework.core.io.support.PathMatchingRe sourcePatternResolver.isJarResource(PathMatchingRe sourcePatternResolver.java:312)
    at org.springframework.core.io.support.PathMatchingRe sourcePatternResolver.findPathMatchingResources(Pa thMatchingResourcePatternResolver.java:264)
    at org.springframework.core.io.support.PathMatchingRe sourcePatternResolver.getResources(PathMatchingRes ourcePatternResolver.java:215)
    at org.springframework.context.support.AbstractApplic ationContext.getResources(AbstractApplicationConte xt.java:667)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:144)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
    at org.springframework.context.support.Abst

  • #2
    Usually it's more reliable not to use patterns for collections, when you try loading some resources from/in app. servers' classloaders. One should specify the full file names.
    Yes, it's no fun, but the reality is like that. Exactly the same behaviour occurs, when you want to load hibernate mappings for example...

    So, try specifiying the full paths in the "servicelayer-context" bean.

    Comment


    • #3
      Originally posted by Injecteer
      Usually it's more reliable not to use patterns for collections, when you try loading some resources from/in app. servers' classloaders. One should specify the full file names.
      Yes, it's no fun, but the reality is like that. Exactly the same behaviour occurs, when you want to load hibernate mappings for example...

      So, try specifiying the full paths in the "servicelayer-context" bean.
      Tried this and it works - thanks !

      I think WAS unzips the web app WAR files when it deploys, so at run time the resources aren't in a jar file, whereas I guess in Geronimo they still are. I've been bitten by this before with Hibernate cfg.xml files, and can't beleive I forgot it second time around. Thanks for your help - much appreciated.

      Comment

      Working...
      X