我创建了一个简单的Java SE应用程序,但是在使用Tomcat 8.0.38配置JPA时遇到了问题。是否可以使用这些技术自动生成架构?
这是我的persistence.xml:
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="postgres" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>co.entity.Pais</class>
<class>co.entity.PilaEntity</class>
<class>co.entity.PilaNovedad</class>
<class>co.entity.PilaPago</class>
<class>co.entity.PilaRisk</class>
<class>co.entity.PilaSuperEntity</class>
<class>co.edu.entity.PilaUser</class>
<class>co.edu.entity.PilaUserIntermediary</class>
<class>co.edu.entity.PilaUserSuperEntity</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost/pila" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
<property name="hibernate.connection.username" value="user" />
<property name="hibernate.connection.password" value="password" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
</properties>
</persistence-unit>
</persistence>
这是我的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>PilaPayments</groupId>
<artifactId>PilaPayments</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.22.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.bundles.repackaged/jersey-guava -->
<dependency>
<groupId>org.glassfish.jersey.bundles.repackaged</groupId>
<artifactId>jersey-guava</artifactId>
<version>2.22.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.hk2/hk2-api -->
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-api</artifactId>
<version>2.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.hk2/hk2-locator -->
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-locator</artifactId>
<version>2.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.hk2/hk2-utils -->
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-utils</artifactId>
<version>2.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-json-jackson -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider -->
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.7.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.ext/jersey-entity-filtering -->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-entity-filtering</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
</dependencies>
从eclipse启动tomcat时的控制台日志
nov 07, 2016 5:22:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTENCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:PilaPayments' did not find a matching property.
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Server version: Apache Tomcat/8.0.38
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Server built: Oct 6 2016 20:51:55 UTC
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Server number: 8.0.38.0
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: OS Name: Windows 7
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: OS Version: 6.1
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Architecture: amd64
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Java Home: C:\Program Files\Java\jdk1.8.0_91\jre
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: JVM Version: 1.8.0_91-b15
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: JVM Vendor: Oracle Corporation
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: CATALINA_BASE: C:\Program Files\Apache Software Foundation\Tomcat 8.0
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 8.0
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.0
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.0
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dwtp.deploy=C:\Program Files\Apache Software Foundation\Tomcat 8.0\wtpwebapps
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 8.0\endorsed
nov 07, 2016 5:22:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dfile.encoding=Cp1252
nov 07, 2016 5:22:45 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMACIÓN: La biblioteca nativa de Apache Tomcat basada en ARP que permite un rendimiento óptimo en entornos de desarrollo no ha sido hallada en java.library.path: C:\Program Files\Java\jdk1.8.0_91\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Window s;C:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C:/Program Files (x86)/Java/jre1.8.0_101/bin;C:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32 \WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core- Static;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\AMD\ATI.ACE\Core- Static;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\nodejs\;D:\Software\apache-maven-3.3.9\bin;C:\Program Files\PostgreSQL\pg95\bin;C:\Program Files\Perforce;C:\Program Files\Perforce\DVCS\;C:\Program Files\Git\cmd;c:\Users\user1\AppData\Local\atom\bin;C:\Users\user1\AppData\Roami ng\npm;D:\Software\eclipse;;.
nov 07, 2016 5:22:46 PM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["http-nio-8080"]
nov 07, 2016 5:22:46 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMACIÓN: Using a shared selector for servlet write/read
nov 07, 2016 5:22:46 PM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["ajp-nio-8009"]
nov 07, 2016 5:22:46 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMACIÓN: Using a shared selector for servlet write/read
nov 07, 2016 5:22:46 PM org.apache.catalina.startup.Catalina load
INFORMACIÓN: Initialization processed in 2147 ms
nov 07, 2016 5:22:46 PM org.apache.catalina.core.StandardService startInternal
INFORMACIÓN: Arrancando servicio Catalina
nov 07, 2016 5:22:46 PM org.apache.catalina.core.StandardEngine startInternal
INFORMACIÓN: Starting Servlet Engine: Apache Tomcat/8.0.38
nov 07, 2016 5:22:50 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMACIÓN: Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP .
nov 07, 2016 5:22:51 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMACIÓN: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [108] milliseconds.
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMACIÓN: Despliegue del directorio C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\docs de la aplicación web
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMACIÓN: Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\docs has finished in 49 ms
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMACIÓN: Despliegue del directorio C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\manager de la aplicación web
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMACIÓN: Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\manager has finished in 129 ms
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMACIÓN: Despliegue del directorio C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\ROOT de la aplicación web
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMACIÓN: Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\ROOT has finished in 40 ms
nov 07, 2016 5:22:52 PM org.apache.coyote.AbstractProtocol start
INFORMACIÓN: Starting ProtocolHandler ["http-nio-8080"]
nov 07, 2016 5:22:52 PM org.apache.coyote.AbstractProtocol start
INFORMACIÓN: Starting ProtocolHandler ["ajp-nio-8009"]
nov 07, 2016 5:22:52 PM org.apache.catalina.startup.Catalina start
INFORMACIÓN: Server startup in 6154 ms
在启动时它只部署战争,但它不会创建架构