简体   繁体   中英

Create JDBC connection pool in glassfish 4

I want to create a JDBC Connection Pool in glassfish 4.

I run my application server in eclipse Mars, and I access to the administration page of glassfish.

Then, I go to JDBC -> JDBC CONNECTION POOL -> NEW...

In the form, I informs following information:

在此处输入图片说明

And when I clic on next I get this error page

在此处输入图片说明

And the error log is :

2015-11-11T16:13:20.350+0000|Avertissement: Context path from ServletContext:  differs from path from bundle: /
2015-11-11T16:13:21.789+0000|Infos: Redirecting to /index.jsf
2015-11-11T16:13:21.878+0000|Infos: Admin Console: Initializing Session Attributes...
2015-11-11T16:13:21.978+0000|Avertissement: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
2015-11-11T16:13:30.379+0000|Infos: Exception Occurred :null
2015-11-11T16:13:30.382+0000|Grave: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException while attempting to process a 'beforeCreate' event for 'event144'.

2015-11-11T16:13:44.087+0000|Infos: Exception Occurred :null
2015-11-11T16:14:00.368+0000|Avertissement: StandardWrapperValve[FacesServlet]: Servlet.service() for servlet FacesServlet threw exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response

I'm facing the same issue and I found a solution: instead of creating the connection pool using my IDE (Netbeans), I used the command line:

My DB username is root with an empty password and I'm working on my localhost . My table is named tmpDb .

Here is the command I used:

$> cd "c:\Program Files\glassfish4\bin"
$> asadmin create-jdbc-connection-pool --restype  javax.sql.DataSource --datasourceclassname org.apache.derby.jdbc.ClientDataSource --validationmethod table --validationtable DUAL --property User=root:Password="":ServerName=localhost:tmpDb --ping true MyPool

Does this work for you?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM