spring mvc 3 のセットアップに問題があり、自動 dll で休止状態になります。これは私のフォルダー構造です。
そして、これらは私のライブラリです:
抽象ユーザー
package org.andreadorigo.abstracts;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Generic user
* @author andreadorigo
*
*/
public abstract class AbstractUser {
@Id
@Column(name="id")
@GeneratedValue
private Integer id;
@NotEmpty
@Email
@Column(name="email")
public String email;
@NotEmpty
@Size(min = 6, max = 14)
@Column(name="password")
public String password;
/**
*
*/
public AbstractUser() {
super();
}
//Getters and setters
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
顧客ユーザー
package org.andreadorigo.entities;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.andreadorigo.abstracts.AbstractUser;
@Entity
@Table(name="customerUser")
public class CustomerUser extends AbstractUser{
}
dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="org.andreadorigo" />
<mvc:annotation-driven />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
id="entityManagerFactory">
<property
name="persistenceUnitName"
value="jtdb" />
<property
name="dataSource"
ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property
name="showSql"
value="true" />
<property
name="generateDdl"
value="true" />
<property
name="databasePlatform"
value="org.hibernate.dialect.MySQLDialect" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>
</beans>
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="transaction.factory_class">org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory</property>
<property name="hibernate.hbm2ddl.auto">create</property>
</session-factory>
</hibernate-configuration>
persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="CustomerUser">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.andreadorigo.entities.CustomerUser</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit>
</persistence>
しかし、jboss 7 を実行すると、次の警告/エラーが表示されます。
15:48:57,442 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.AbstractEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/AbstractEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:48:58,322 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-2) Hibernate Validator 4.2.0.Final
15:48:59,172 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:48:59,614 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-2) Monitoring jndi:/default-host/GenericProject/WEB-INF/faces-config.xml for modifications
15:49:00,295 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.AbstractEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/AbstractEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:00,405 INFO [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /GenericProject
15:49:01,010 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:01,271 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.AbstractEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/AbstractEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:01,529 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:01,778 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (MSC service thread 1-3) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
15:49:01,795 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.AbstractEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/AbstractEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:02,061 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:02,310 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@55e3c942: defining beans [registerController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,viewResolver,entityManagerFactory]; root of factory hierarchy
15:49:02,374 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.AbstractEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/AbstractEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:02,749 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:03,126 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.AbstractEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/AbstractEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:03,505 WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in Module "deployment.SpringTest.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean (Module "deployment.SpringTest.war:main" from Service Module Loader)
15:49:03,839 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@55e3c942: defining beans [registerController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,viewResolver,entityManagerFactory]; root of factory hierarchy
15:49:03,875 ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Destroy method on bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#0' threw an exception: java.lang.NoClassDefFoundError: org/springframework/transaction/support/TransactionSynchronization
15:49:04,031 ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Destroy method on bean with name '(inner bean)' threw an exception: java.lang.NoClassDefFoundError: org/springframework/transaction/support/TransactionSynchronization
15:49:04,182 ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Destroy method on bean with name 'org.springframework.format.support.FormattingConversionServiceFactoryBean#0' threw an exception: java.lang.NoClassDefFoundError: org/springframework/transaction/support/TransactionSynchronization
15:49:04,381 ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Destroy method on bean with name 'registerController' threw an exception: java.lang.NoClassDefFoundError: org/springframework/transaction/support/TransactionSynchronization
15:49:04,530 ERROR [org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-3) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean from [Module "deployment.SpringTest.war:main" from Service Module Loader]
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean from [Module "deployment.SpringTest.war:main" from Service Module Loader]
15:49:04,868 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringTest]] (MSC service thread 1-3) StandardWrapper.Throwable: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean from [Module "deployment.SpringTest.war:main" from Service Module Loader]
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean from [Module "deployment.SpringTest.war:main" from Service Module Loader]
15:49:05,194 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringTest]] (MSC service thread 1-3) Servlet /SpringTest threw load() exception: java.lang.ClassNotFoundException: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean from [Module "deployment.SpringTest.war:main" from Service Module Loader]