在netbeans 8.1中运行示例的麻烦

时间:2016-01-18 00:06:53

标签: java-ee netbeans

我正在尝试从Netbeans 8.1运行订单示例,但Glassfish总是会出现同样的错误。

当我使用Windows 7的PC时,我做了完全相同的事情。我正在尝试在带有Windows 10的电脑上运行持久性示例。

我确实按照文档上的说明(java EE教程)。这是我的服务器日志:

Información:   EclipseLink, version: Eclipse Persistence Services - 2.6.1.v20150605-31e8258
Advertencia:   RAR5038:Unexpected exception while creating resource for pool DerbyPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
Advertencia:   RAR5117 : Failed to obtain/create connection from connection pool [ DerbyPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
Advertencia:   RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X]
Grave:   Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
Error Code: 0
    at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:316)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:147)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:207)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:750)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:265)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:731)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528)
    at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:385)
    at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:313)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
    at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
    at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
    at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
    at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434)
    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.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:121)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
    ... 56 more
Caused by: javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:319)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166)
    at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:114)
    ... 57 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:103)
    at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
    at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512)
    at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944)
    at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230)
    at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511)
    at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
    at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:245)
    at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:170)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:360)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307)
    ... 61 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:924)
    at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189)
    at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
    ... 71 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:110)
    at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
    ... 73 more
Caused by: javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:129)
    at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
    ... 74 more
Caused by: java.sql.SQLNonTransientConnectionException: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
    at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
    at org.apache.derby.jdbc.ClientBaseDataSourceRoot.getConnection(Unknown Source)
    at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:115)
    ... 75 more
Caused by: org.apache.derby.client.am.SqlException: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
    at org.apache.derby.client.am.Connection.completeSqlca(Unknown Source)
    at org.apache.derby.client.net.NetConnectionReply.parseRdbAccessFailed(Unknown Source)
    at org.apache.derby.client.net.NetConnectionReply.parseAccessRdbError(Unknown Source)
    at org.apache.derby.client.net.NetConnectionReply.parseACCRDBreply(Unknown Source)
    at org.apache.derby.client.net.NetConnectionReply.readAccessDatabase(Unknown Source)
    at org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(Unknown Source)
    at org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(Unknown Source)
    at org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(Unknown Source)
    at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
    at org.apache.derby.client.net.NetConnection.initialize(Unknown Source)
    at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
    at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
    at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
    at org.apache.derby.jdbc.ClientBaseDataSourceRoot.getConnectionX(Unknown Source)
    ... 77 more

Grave:   Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
Grave:   Exception while preparing the app
Grave:   Exception during lifecycle processing
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: No se ha podido crear la base de datos 'sun-appserv-samples', consulte la excepción siguiente para obtener más información.::SQLSTATE: XBM0X
Error Code: 0

2 个答案:

答案 0 :(得分:0)

首先,使用英语运行服务器总是一个好主意,这样每个人都可以在发布问题或搜索错误消息时读取错误日志。

Derby告诉您堆栈跟踪中的异常代码XBM0X,这是给定区域的问题(请参阅here for details)。

答案 1 :(得分:0)

谢谢亚历山大花时间阅读我的问题

  1. 对不起西班牙邮报。
  2. 我只是将示例运行到另一个浏览器中,然后将笔记本电脑更改为英语,netbeans环境完美无缺。我不确定这些例子的作用是什么,但现在我可以毫无困难地使用netbeans。
  3. 谢谢你