Migrating Spring + Hibernate WAR application meet a "java.io.FileNotFoundException: class path resource [...] cannot be opened because it does not exist"

Solution Verified - Updated -

Issue

  • This is a migration issue, migrating a Spring + Hibernate web war application from JBoss 4.0.2 to JBoss 5.1.2;
  • A "java.io.FileNotFoundException" threw while initializing Spring context
  • The Exception trace as following
nested exception is java.io.FileNotFoundException: class path resource [classpath*:com/test/**/domain/*.hbm.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:389)
    at org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:341)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:195)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
    at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
    at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122)
    at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 4.0.2
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content