修改
这个问题已经解决了。我在pom.xml
中对Apache Derby有另一个依赖,导致了这个问题。从终端中的pom.xml
和mvn clean
中删除后,问题就消失了。
依赖项已从我的pom.xml
:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
</dependency>
问题
我试图在嵌入式Glassfish 4.1上设置Java EE webapp。我正在尝试使用嵌入式Derby设置JDBC。部署glassfish服务器时,我得到了ClassCast-Exception:java.lang.ClassCastException: org.apache.derby.jdbc.AutoloadedDriver40 cannot be cast to org.apache.derby.jdbc.InternalDriver
。当我搜索此异常时,我无法找到任何结果。我的猜测是datasource-classname
中的driverClass
和glassfish-resources.xml
的错误值,但将其更改为不同的值并未解决问题。这是我的代码:
我的persistence.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<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="myapp" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:app/jdbc/myapp</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.generate_statistics" value="false" />
</properties>
</persistence-unit>
我的glassfish-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool
datasource-classname="org.apache.derby.jdbc.BasicEmbeddedConnectionPoolDataSource40"
name="java:app/jdbc/myapp_pool"
res-type="javax.sql.ConnectionPoolDataSource">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="1572"/>
<property name="databaseName" value="myapp"/>
<!--<property name="URL" value="jdbc:derby:myapp;create true"/>-->
<property name="User" value="root"/>
<property name="Password" value="password"/>
<property name="URL" value="jdbc:derby://localhost:1572/myapp;create=true"/>
<property name="driverClass" value="org.apache.derby.jdbc.EmbeddedDriver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:app/jdbc/myapp"
object-type="user" pool-name="java:app/jdbc/myapp_pool"/>
</resources>
完整堆栈跟踪:
WARNUNG: jdbc.exc_get_conn
22:59:09.007 [main] ERROR org.hibernate.hql.spi.id.IdTableHelper - Unable obtain JDBC Connection
java.sql.SQLException: Error in allocating a connection. Cause: org.apache.derby.jdbc.AutoloadedDriver40 cannot be cast to org.apache.derby.jdbc.InternalDriver
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:121) ~[glassfish-embedded-all-4.1.jar:?]
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.internal.SessionFactoryImpl$2.obtainConnection(SessionFactoryImpl.java:653) ~[hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.hql.spi.id.IdTableHelper.executeIdTableCreationStatements(IdTableHelper.java:67) [hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy.finishPreparation(GlobalTemporaryTableBulkIdStrategy.java:125) [hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy.finishPreparation(GlobalTemporaryTableBulkIdStrategy.java:42) [hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.hql.spi.id.AbstractMultiTableBulkIdStrategyImpl.prepare(AbstractMultiTableBulkIdStrategyImpl.java:88) [hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:453) [hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) [hibernate-core-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) [hibernate-entitymanager-5.0.6.Final.jar:5.0.6.Final]
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135) [hibernate-entitymanager-5.0.6.Final.jar:5.0.6.Final]
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535) [glassfish-embedded-all-4.1.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_66]
at javax.security.auth.Subject.doAs(Subject.java:360) [?:1.8.0_66]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557) [glassfish-embedded-all-4.1.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_66]
at javax.security.auth.Subject.doAs(Subject.java:360) [?:1.8.0_66]
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133) [glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109) [glassfish-embedded-all-4.1.jar:?]
at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.java:108) [maven-embedded-glassfish-plugin-4.1.1.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
at org.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.java:259) [maven-embedded-glassfish-plugin-4.1.1.jar:?]
at org.glassfish.maven.RunMojo.execute(RunMojo.java:101) [maven-embedded-glassfish-plugin-4.1.1.jar:?]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) [maven-core-3.x.jar:?]
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) [maven-core-3.x.jar:?]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) [maven-core-3.x.jar:?]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) [maven-core-3.x.jar:?]
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) [maven-core-3.x.jar:?]
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) [maven-embedder-3.x.jar:?]
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) [maven-embedder-3.x.jar:?]
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) [maven-embedder-3.x.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) [plexus-classworlds2-2.5.2.jar:?]
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) [plexus-classworlds2-2.5.2.jar:?]
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) [plexus-classworlds2-2.5.2.jar:?]
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [plexus-classworlds2-2.5.2.jar:?]
Caused by: javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: org.apache.derby.jdbc.AutoloadedDriver40 cannot be cast to org.apache.derby.jdbc.InternalDriver
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:319) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:114) ~[glassfish-embedded-all-4.1.jar:?]
... 65 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: org.apache.derby.jdbc.AutoloadedDriver40 cannot be cast to org.apache.derby.jdbc.InternalDriver
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:103) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:245) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:170) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:360) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:114) ~[glassfish-embedded-all-4.1.jar:?]
... 65 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: org.apache.derby.jdbc.AutoloadedDriver40 cannot be cast to org.apache.derby.jdbc.InternalDriver
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:924) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:245) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:170) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:360) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:114) ~[glassfish-embedded-all-4.1.jar:?]
... 65 more
Caused by: java.lang.ClassCastException: org.apache.derby.jdbc.AutoloadedDriver40 cannot be cast to org.apache.derby.jdbc.InternalDriver
at org.apache.derby.jdbc.BasicEmbeddedDataSource40.findDriver(Unknown Source) ~[glassfish-embedded-all-4.1.jar:?]
at org.apache.derby.jdbc.BasicEmbeddedConnectionPoolDataSource40.createPooledConnection(Unknown Source) ~[glassfish-embedded-all-4.1.jar:?]
at org.apache.derby.jdbc.BasicEmbeddedConnectionPoolDataSource40.getPooledConnection(Unknown Source) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.gjc.spi.CPManagedConnectionFactory.createManagedConnection(CPManagedConnectionFactory.java:133) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:245) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:170) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:360) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166) ~[glassfish-embedded-all-4.1.jar:?]
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:114) ~[glassfish-embedded-all-4.1.jar:?]
... 65 more
Jan 12, 2016 10:59:09 PM org.glassfish.web.loader.WebappClassLoader clearReferencesJdbc
WARNUNG: The web application [unknown] registered the JDBC driver [org.apache.derby.jdbc.AutoloadedDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jan 12, 2016 10:59:09 PM org.glassfish.kernel.event.EventsImpl send
WARNUNG: Exception while dispatching an event
org.hibernate.resource.transaction.backend.jta.internal.JtaPlatformInaccessibleException: Unable to access TransactionManager or UserTransaction to make physical transaction delegate
at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.makePhysicalTransactionDelegate(JtaTransactionCoordinatorImpl.java:229)
at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.getTransactionDriverControl(JtaTransactionCoordinatorImpl.java:203)
at org.hibernate.engine.transaction.internal.TransactionImpl.<init>(TransactionImpl.java:36)
at org.hibernate.internal.AbstractSessionImpl.getTransaction(AbstractSessionImpl.java:313)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:278)
at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1327)
at org.hibernate.jpa.internal.EntityManagerImpl.internalGetSession(EntityManagerImpl.java:133)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:174)
at org.hibernate.jpa.internal.EntityManagerImpl.<init>(EntityManagerImpl.java:83)
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.internalCreateEntityManager(EntityManagerFactoryImpl.java:319)
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:286)
at org.glassfish.persistence.jpa.JPADeployer$2.visitPUD(JPADeployer.java:451)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.iterateInitializedPUsAtApplicationPrepare(JPADeployer.java:492)
at org.glassfish.persistence.jpa.JPADeployer.event(JPADeployer.java:398)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:487)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109)
at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.java:259)
at org.glassfish.maven.RunMojo.execute(RunMojo.java:101)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
非常感谢答案