我是 Java ee 新手。我从 oracle java ee 页面获得了一个教程firstcup。我按照 Dukes-age 的教程进行操作,效果很好。 Firstcup-war 的教程似乎无法在我的系统上运行。
我使用的是 Netbeans 8.0、GlassFish 4.0 和 Windows 7 操作系统。
1. 我按照提供的说明进行操作,当我运行该项目时 我收到的第一条消息是添加一个我在网上没有看到的服务器 教程(firstcup-war)。
2. 添加 glassfish 服务器后,项目仍未部署 服务器和我收到来自 glassfish 的警告和异常 服务器:
2.1
Warning: RAR5038:Unexpected exception while creating resource for pool DerbyPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Warning: RAR5117 : Failed to obtain/create connection from connection pool [ DerbyPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Warning: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.]
Severe: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:316)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
.....
and chain of other exception that caused the above execption.
2.2
Severe: Exception while deploying the app [firstcup-war]
Severe: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
.....
3.
在运行(firstcup-war)输出页面上,我在显示构建成功的日志后收到此消息:
------------------------------------------------------------------------
Total time: 7.949s
Finished at: Mon Apr 21 17:05:54 WAT 2014
Final Memory: 9M/111M
------------------------------------------------------------------------
NetBeans: Deploying on GlassFish Server
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at C:\Users\NYE\Documents\NetBeansProjects\java ee\firstcup-war\target\firstcup-war-1.0-SNAPSHOT
GlassFish Server, deploy, null, false
请帮我解决这个问题。
最佳答案
在教程中,maven 仅创建一个 war 文件。您必须使用 glassfish 控制台将其部署到 glassfish 服务器。
http://localhost:4848
您还必须启动 Java 数据库。
asadmin start-database
关于jakarta-ee - Oracle Firstcup 教程 (firstcup-war),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23204656/