В настоящее время я разрабатываю приложение Wicket Spring Hibernate.Для разработки я использую Jetty в качестве веб-сервера.
При запуске приложения с mvn jetty:run
все работает как положено.Но когда я пытаюсь запустить приложение с mvn jetty:run-exploded
, появляются некоторые исключения, говорящие о том, что bean-компонент sessionFactory не может быть создан.
Я уже много искал по этой проблеме, но не смог найти никаких подсказок о том, что вызывает эту ошибку.Также трассировка стека не дает много информации, где именно начать.Я надеюсь, что кто-то может указать мне правильное направление, как решить эту проблему.
Поскольку трассировка стека исключений слишком длинна, чтобы разместить ее здесь, я вставил ее в PasteBin .Это происходит, если я запускаю свое приложение с mvn jetty:run-exploded
. Трассировка стека исключений
Вот мое приложениеContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- Configurer that replaces ${...} placeholders with values from properties files -->
<!-- (in this case, JDBC related properties) -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:application.properties</value>
<value>file:///${user.home}/storefinder.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true"/>
</bean>
<!-- a bean for storing configuration properties. -->
<bean id="runtimeConfig" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:application.properties</value>
<value>file:///${user.home}/storefinder.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true"/>
</bean>
<!-- bean id="wicketApplication" class="com.mycompany.storefinder.backend.core.web.StoreFinderApplication" /-->
<!-- Services -->
<bean id="authenticationService" class="com.mycompany.storefinder.backend.core.service.AuthenticationServiceImpl">
<constructor-arg ref="userDao"/>
<constructor-arg ref="runtimeConfig" />
</bean>
<bean id="imageService" class="com.mycompany.storefinder.backend.core.infrastructure.filesystem.ImageFileServiceImpl">
<constructor-arg ref="imageDao"/>
<constructor-arg ref="runtimeConfig" />
</bean>
<!-- DAOs -->
<bean id="offerDao" class="com.mycompany.storefinder.backend.core.infrastructure.hibernate.OfferDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="userDao" class="com.mycompany.storefinder.backend.core.infrastructure.hibernate.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="roleDao" class="com.mycompany.storefinder.backend.core.infrastructure.hibernate.RoleDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="imageDao" class="com.mycompany.storefinder.backend.core.infrastructure.hibernate.ImageDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="storeDao" class="com.mycompany.storefinder.backend.core.infrastructure.hibernate.StoreDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Database Beans -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.h2.Driver"/>
<property name="url" value="jdbc:h2:file:target/db/storefinder"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
<!-- Hibernate session factory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="use_outer_join">true</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
<prop key="hibernate.connection.pool_size">10</prop>
<prop key="hibernate.jdbc.batch_size">1000</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.mycompany.storefinder.backend.core.domain.offer.Offer</value>
<value>com.mycompany.storefinder.backend.core.domain.image.Image</value>
<value>com.mycompany.storefinder.backend.core.domain.store.Store</value>
<value>com.mycompany.storefinder.backend.core.domain.store.OpeningPeriod</value>
<value>com.mycompany.storefinder.backend.core.domain.store.CommunicationData</value>
<value>com.mycompany.storefinder.backend.core.domain.user.Role</value>
<value>com.mycompany.storefinder.backend.core.domain.user.User</value>
<value>com.mycompany.storefinder.backend.core.domain.base.BusinessObject</value>
</list>
</property>
<!-- TODO Check -->
<property name="schemaUpdate" value="true"/>
</bean>
<!-- Tell Spring it should use @Transactional annotations -->
<tx:annotation-driven/>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
Вот мой pom.xml.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.storefinder</groupId>
<artifactId>backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>StoreFinder Backend</name>
<dependencies>
<!-- LOGGING DEPENDENCIES -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- SPRING -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>2.5.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>spring-core</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- HIBERNATE & DB -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.2.0.Final</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.158</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.15.0-GA</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<!-- COMMONS LIBS -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- JODA TIME -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-hibernate</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
</dependency>
<!-- WICKET -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-auth-roles</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-devutils</artifactId>
<version>${wicket.version}</version>
</dependency>
<!-- TESTING DEPENDENCIES -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils</artifactId>
<version>${unitils.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-spring</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-test</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-management</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
</dependency>
<!-- >dependency>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>enunciate-spring3-app-rt</artifactId>
<version>1.24</version>
</dependency-->
</dependencies>
<build>
<plugins>
<!-- plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-spring-plugin</artifactId>
<version>1.24</version>
<configuration>
<configFile>src/main/webapp/WEB-INF/enunciate.xml</configFile>
</configuration>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin-->
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.5</source>
<target>1.5</target>
<optimize>true</optimize>
<debug>true</debug>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version>
<configuration>
<instrumentation>
<excludes>
<exclude>src/test/**/*.class</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${jetty.version}</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- Add code coverage report to site -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version>
</plugin>
</plugins>
</reporting>
<properties>
<wicket.version>1.5-RC5.1</wicket.version>
<jetty.version>6.1.4</jetty.version>
<cobertura.version>2.5.1</cobertura.version>
<slf4j.version>1.6.1</slf4j.version>
<springframework.version>3.0.5.RELEASE</springframework.version>
<junit.version>4.8.1</junit.version>
<unitils.version>3.1</unitils.version>
</properties>
</project>
ОБНОВЛЕНИЕ
Поскольку добавление графика зависимостей Maven моего проекта здесь превысит максимально допустимое количество символов, я вставил его в PasteBin .
ОБНОВЛЕНИЕ 2
Вывод плагина maven-duplicate-finder .
ОБНОВЛЕНИЕ 3