以下是我的配置文件:
的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_1_0.xsd"
version="1.0">
<persistence-unit name="Connection">
</persistence-unit>
</persistence>
的applicationContext.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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
<context:annotation-config />
<context:component-scan base-package="be.iepsfc.uccle">
</context:component-scan>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="Connection" />
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:8081/form" />
<property name="username" value="root" />
</bean>
<!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactory" />
<tx:annotation-driven />
</beans>
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>learningcenter</display-name>
<welcome-file-list>
<welcome-file>/</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.swf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.ico</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.xml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpeg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.woff</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.tff</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.eot</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.pdf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/helptxt/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<session-config>
<!-- Disables URL-based sessions (no more 'jsessionid' in the URL using Tomcat) -->
<tracking-mode>COOKIE</tracking-mode>
</session-config>
</web-app>
的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>be.iepsfc.uccle</groupId>
<artifactId>LearningCenter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
我不知道问题来自哪里。 这是tomcat创业公司的控制台日志:
sept. 14, 2014 10:29:03 AM org.apache.catalina.core.AprLifecycleListener init
Infos: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_55\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Live\Shared;.
sept. 14, 2014 10:29:03 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avertissement: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:LearningCenter' did not find a matching property.
sept. 14, 2014 10:29:03 AM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["http-bio-8181"]
sept. 14, 2014 10:29:03 AM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["ajp-bio-8009"]
sept. 14, 2014 10:29:03 AM org.apache.catalina.startup.Catalina load
Infos: Initialization processed in 479 ms
sept. 14, 2014 10:29:03 AM org.apache.catalina.core.StandardService startInternal
Infos: Démarrage du service Catalina
sept. 14, 2014 10:29:03 AM org.apache.catalina.core.StandardEngine startInternal
Infos: Starting Servlet Engine: Apache Tomcat/7.0.47
sept. 14, 2014 10:29:03 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
Infos: validateJarFile(C:\Users\Ramzi\Desktop\Java\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\LearningCenter\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.startup.TaglibUriRule body
Infos: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
sept. 14, 2014 10:29:05 AM org.apache.catalina.core.ApplicationContext log
Infos: No Spring WebApplicationInitializer types detected on classpath
sept. 14, 2014 10:29:05 AM org.apache.catalina.core.ApplicationContext log
Infos: Initializing Spring root WebApplicationContext
sept. 14, 2014 10:29:05 AM org.springframework.web.context.ContextLoader initWebApplicationContext
Infos: Root WebApplicationContext: initialization started
sept. 14, 2014 10:29:05 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
Infos: Refreshing Root WebApplicationContext: startup date [Sun Sep 14 10:29:05 CEST 2014]; root of context hierarchy
sept. 14, 2014 10:29:05 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
Infos: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
sept. 14, 2014 10:29:05 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
Infos: Loaded JDBC driver: com.mysql.jdbc.Driver
sept. 14, 2014 10:29:05 AM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
Infos: Building JPA container EntityManagerFactory for persistence unit 'Connection'
sept. 14, 2014 10:29:05 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
sept. 14, 2014 10:29:05 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: Connection
...]
sept. 14, 2014 10:29:05 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.6.Final}
sept. 14, 2014 10:29:05 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
sept. 14, 2014 10:29:05 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
sept. 14, 2014 10:29:06 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
它提到了Hibernate Commons Annotations api,但我没看到它被称为何处? 任何帮助都感激不尽 感谢。