Classpath scanning ZipException or NoSuchBeanDefinitionException using Spring and JBoss EAP
Issue
- Using Spring to deploy component results in a java.util.zip.ZipException. For example:
ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: I/O failure during classpath scanning; nested exception is java.util.zip.ZipException: error in opening zip file
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:222)
or other ZipFile I/O errors such as:
Caused by: java.io.FileNotFoundException: C:\jboss-eap-5.0\jboss-as\server\default\deploy\ozone.war\WEB-INF\lib\spring-beans-2.5.6.jar\META-INF (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:133)
at java.util.jar.JarFile.<init>(JarFile.java:70)
- If you define the following in the web.xml file and you define your spring beans in the file(s) specified by the "classpath":
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/properties/contexts/*.xml</param-value>
</context-param>
you receive the following error:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxxxxxxx' is defined
- Why this issue does not occur in EAP 4.3 ?
Environment
- Spring 2.5.6
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.