You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Urkens Jean-Pierre <Je...@devoteam.com> on 2013/05/31 09:27:07 UTC

Tomcat 6.x supporting classpath wildcards

Hi,

I'm porting a web application from SUN AS9 to Tomcat-6.0.37 to run on Sun Solaris 5.10 and I'm experiencing problems with classpath wildcards.

The web application is using SPRING-3.0.4 and Hibernate-3.2.6 and loading the Hibernate mapping files is done within a SPRING bean declaration using the "classpath*" (cf. spring-resources-classpath-wildcards<http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/resources.html#resources-classpath-wildcards>) wildcard as follows:
       <bean abstract="true" id="defaultSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
             <property name="mappingLocations">
                    <list>
                           <value>classpath*:hibernatemappings/*.hbm.xml</value>
                    </list>
             </property>
             <property name="hibernateProperties" ref="hibernateProperties" />
             <property name="entityInterceptor" ref="auditInterceptor" />
       </bean>

When trying to load the SPRING beans during startup I get the error (note that defaultSessionFactory is the parent of 'centraalSessionFactory'):

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'centraalSessionFactory' defined in class path resource [aeoDataAccessContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
          ... 66 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
          at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:527)
          at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:684)
          at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
          ... 73 more
Caused by: org.dom4j.DocumentException: unknown protocol: classpath Nested exception: unknown protocol: classpath
          at org.dom4j.io.SAXReader.read(SAXReader.java:484)
          at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:518)
       ... 77 more

I couldn't directly find any reference on the web regarding Tomcat and classpath wildcards so I'm not sure whether this is  supported by Tomcat-6.x.

Re: Tomcat 6.x supporting classpath wildcards

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On May 31, 2013 12:27 AM, "Urkens Jean-Pierre" <
Jean-Pierre.Urkens@devoteam.com> wrote:
>
> Hi,
>
> I'm porting a web application from SUN AS9 to Tomcat-6.0.37 to run on Sun
Solaris 5.10 and I'm experiencing problems with classpath wildcards.
>
> The web application is using SPRING-3.0.4 and Hibernate-3.2.6 and loading
the Hibernate mapping files is done within a SPRING bean declaration using
the "classpath*" (cf. spring-resources-classpath-wildcards<
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/resources.html#resources-classpath-wildcards>)
wildcard as follows:

The Spring documentation lists a way that you can test compatibility with
its "classpath*" feature. See the "classpath*: portability" section in your
link above.

Have you tried this?

Dan

>        <bean abstract="true" id="defaultSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>              <property name="mappingLocations">
>                     <list>
>
 <value>classpath*:hibernatemappings/*.hbm.xml</value>
>                     </list>
>              </property>
>              <property name="hibernateProperties"
ref="hibernateProperties" />
>              <property name="entityInterceptor" ref="auditInterceptor" />
>        </bean>
>
> When trying to load the SPRING beans during startup I get the error (note
that defaultSessionFactory is the parent of 'centraalSessionFactory'):
>
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'centraalSessionFactory' defined in class path
resource [aeoDataAccessContext.xml]: Invocation of init method failed;
nested exception is org.hibernate.InvalidMappingException: Could not parse
mapping document from input stream
>           at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
>           at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>           at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>           at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>           at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>           at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>           at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>           at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
>           ... 66 more
> Caused by: org.hibernate.InvalidMappingException: Could not parse mapping
document from input stream
>           at
org.hibernate.cfg.Configuration.addInputStream(Configuration.java:527)
>           at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:684)
>           at
org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
>           at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
>           at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
>           ... 73 more
> Caused by: org.dom4j.DocumentException: unknown protocol: classpath
Nested exception: unknown protocol: classpath
>           at org.dom4j.io.SAXReader.read(SAXReader.java:484)
>           at
org.hibernate.cfg.Configuration.addInputStream(Configuration.java:518)
>        ... 77 more
>
> I couldn't directly find any reference on the web regarding Tomcat and
classpath wildcards so I'm not sure whether this is  supported by
Tomcat-6.x.