We have a parent project with multiple sub projects below. Some of them are producing a war and other are producing a jar.
Inside the parent project, there is a dev.properties file. It is in the directory
/src/main/resources/config/environments/dev.properties
This file is used by multiple subprojects correctly withour a problem.
The project that causes the error has the following configuration for jetty in pom.xml
<profiles>
<profile>
<id>jetty</id>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.16</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
<contextPath>/</contextPath>
<useTestClasspath>true</useTestClasspath>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
This project references with dependency our admin project like this:
<dependency>
<groupId>sample.project</groupId>
<artifactId>sample-project-admin-service</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
Inside the sample project and in the file sample-project-admin-service-context.xml there is this configuration :
<bean id="cacheMan"
class="org.infinispan.spring.provider.SpringRemoteCacheManagerFactoryBean"
p:configurationPropertiesFileLocation="/WEB-INF/classes/config/environments/${SERVER_ENV}.properties" />
This should read the properties file and initialize the cacheMan. The sample-project-admin-service-context.xml lies in the path:
/sample-project-admin-service/src/main/resources/META-INF/spring/flash-air-admin-service-context.xml
When we make a war file and deploy it to tomcat. the application deployes correctly without any problem. But when I try to load it with jetty I get the following error:
Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [META-INF/spring/sample-project-admin-service-context.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/classes/config/environments/dev.properties]:
Jetty maven is run using the command:
mvn install -Pjetty
any help would be appreciated.
thanks in advance