Meta Zoan

Greenhorn
+ Follow
since Feb 15, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Meta Zoan

I'm using spring 4.1 under Apache Tomcat 7 on Windows. I'm getting an error that I'm wondering if anyone can help with. Thanks - Bill.

I'm getting the following error:

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)


It looks like I have the correct jars.

When I compile the web project / war, it uses the following dependency (gradle):



My web app's WEB-INF/lib has the following jars (retrieved from maven repo using gradle):


I search the jars in WEB-INF/lib and see that org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.class is in spring-aop-4.1.1.RELEASE.jar

The Apache Version is:



My web.xml has:



Spring's xml is:

9 years ago

We need to use an external properties file (not in the classpath, not bundled with our WAR/EAR) & these properties need to be used to set some spring bean properties. This is exactly described in a 2008 blog post at http://springtips.blogspot.com/2008/09/configuring-applications-with-spring.html ('Optional External Properties'). I tried using the technique in an example but I get the error that the property that I reference from the external file is not being set.

1) spring bean xml file (TestSpringProp is my own Spring bean that I'm testing this example with; it has setMyProp and getMyProp methods):
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreResourceNotFound" value="true"/>
<property name="location" value="${PropFile}"/>
</bean>

<bean id="TestSpringProp" class="com.att.testspring.TestSpringProp">
<property name="myProp" value="${test.myprop}" />
</bean>

2) I create C:\deploy\myprops.properties as follows:
test.myprop=whatever

3) I then run it from Eclipse with the JVM argument as follows: -DPropFile=C:\deploy\myprops.properties

4) I don't get any errors on the 2 PropertyPlaceholderConfigurer beans but I get an error when I try to access the property that's in my property file: "Invalid bean definition with name 'TestSpringProp' defined in class path resource [config/spring/testspring.xml]: Could not resolve placeholder 'test.myprop'
12 years ago