I have spring-framework-3.0.0.M3 (Spring 3).
Building a very basic app that simply reads in a simple bean configuration file. Appears to be a dependency issue as I am getting a NoClassDefFoundError , the following stack trace:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:441)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.jgk.spring3.simple.CheckSpringApp.main(CheckSpringApp.java:10)
The artifacts are
- Spring configuration file
- Single POJO bean to be wired
Spring configuration file: simple.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="simplePersonPojo" class="com.jgk.spring3.simple.SimplePersonPojo">
</bean>
</beans>
Main Application
Code:
package com.jgk.spring3.simple;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class CheckSpringApp {
public static void main(String[] args) {
// exception thrown on the following line:
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "simple.xml",});
}
}
Single POJO bean to be wired
Code:
package com.jgk.spring3.simple;
public class SimplePersonPojo {
private String title;
private String address;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
Library dependencies
- org.springframework.asm-3.0.0.M3
- org.springframework.beans-3.0.0.M3
- org.springframework.code-3.0.0.M3
- org.springframework.context-3.0.0.M3
Any suggestions?
Thanks :-)