Failed to execute JavaEE project

I am new to Java EE. Today I tried to learn Java EE by following this tutorial: http://netbeans.org/kb/docs/javaee/javaee-gettingstarted.html

He mainly teaches how to build a web application from Java web categories using Netbeans.

When I launch the application, I received the "Build failed" error message as follows:

WebApplication1/build/web&name=WebApplication1&contextroot=/WebApplication1&force=true failed on GlassFish Server 3+ Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): 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. Error Code: 0. Please see server.log for more details. WebApplication1/nbproject/build-impl.xml:721: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 2 seconds) 

I already turn on the Glassfish server and select Glassfish as the server when creating this project, but it looks like the server is denying the connection.

+6
source share
3 answers

Go persistence.xml and add the tag "jta-data-source" with the name of the database connection pool in it.

You can find the connection pool name in the Glassfish admin console. Resources-> JDBC-> JDBC Connection Pools

 <persistence-unit name="Project-name"> <jta-data-source>jdbc/mysqlpool</jta-data-source> <class>....</class> </persistence-unit> 
+5
source

Java DB runs on port 1527. It appears that it does not work in your case.

Click the Output tab in your NetBeans IDE and view the Java Database Database console.

You should see the following lines:

 Tue Jul 03 20:25:43 BST 2012 : Security manager installed using the Basic server security policy. Tue Jul 03 20:25:44 BST 2012 : Apache Derby Network Server - 10.8.1.2 - (1095077) started and ready to accept connections on port 1527 

If you do not see these lines trying to figure out why the Java DB process does not start.

+4
source

Go to the Glassfish, JDBC, JDBC Connection Pools admin console and check the advanced properties in the connection pools. In my case, I have DerbyPool, where PortNumber was 1527, I changed it.

+2
source

Source: https://habr.com/ru/post/919624/


All Articles