FileNotFoundException, although the XML file should be deployed
I've got problems starting my WAR application on a local JBoss. After two other EARs are deployed and the TomcatDeployer begins deploying the WAR, I'm getting the following error message:
2010-04-28 10:01:56,605 ERROR [org.jboss.ejb.plugins.LogInterceptor] [] [main] EJBException in method: public abstract [return type] methode throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy: javax.ejb.EJBException: org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:context.xml], factory key [contextService]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'service' defined in URL [jar:file:/C:/jboss-4.2.3.GA/server/default/deploy/frontend.war/WEB-INF/lib/modules.jar!/aontext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [package/context.xml]; nested exception is java.io.FileNotFoundException: class path resource [package开发者_运维知识库/context.xml] cannot be opened because it does not exist
But package/context.xml actually is placed inside a JAR in one of my EAR files which should be deployed before the WAR. And at least I get a message that the deployment of the EAR has been successful. I also looked into the JAR with my file archiver and the context.xml is indeed there at the right place.
Is there a way for me to get sure that the JAR, not the EAR as a whole, is really deployed to the JBoss? I'm already starting to lose my head about this issue.
Thank you. Bernhard
Could be a classloader issue. You can check whether your JAR and its contents are loaded properly by configuring a logger for classloading events, as described here (example 3.8).
The log also gives you information about which classloader loaded what - this might explain why your web app (loaded by its own loader) does not see stuff within the EAR.
Another thing: is the JAR containing the XML file included in the classpath of the WAR?
I have deployed my war in another deploy directory called "deploy.last" in the JBoss directory, since it has to be -- as the name suggests -- deployed at last. Now I've changed my JBoss configuration and put the war in the higher-ranking deploy directory (where the two EARs are too) and everything is working fine now. The war is still deployed at last. I don't have an idea why this worked, but it worked. :D
精彩评论