Hi All,
I have a mavenized, multi-module spring-based(3.0.1) application that runs in tomcat. I'm trying to create a standalone tool that I can distribute to users via a single jar(so they can just double-click on it), that bundles in some of the modules of the application mentioned above.
I've used the maven-shade-plugin to assemble this jar. If I explode the jar it appears as if all of the dependencies are there and the two spring metadata files have been properly concatenated from all of the individual spring jars. The application runs, up until the point where I attempt to instantiate a ClassPathXmlApplicationContext
. When a user clicks a button in the application, the following method is executed:
public void createAppContext() {
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext(springFiles);
}
"springFiles" is declared in the class as follows:
public final String[] springFiles = { "/applicationContext-beans.xml" };
When the above method is executed the following error appears:
Exception in thread "Thread-8" java.lang.ArrayIndexOutOfBoundsException: 3350 at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:48) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:82) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.checkConfigurationClassCandidate(ConfigurationClassBeanDefinitionReader.java:302) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:157) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:132) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:584) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:405) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93) at com.mycompany.StandaloneTool$2.run(StandaloneTool.java:124)
Any help would be greatly appreciated!