在glassfish 4中创建JDBC连接池

时间:2015-11-11 16:07:35

标签: java jdbc glassfish connection-pooling

我想在glassfish 4中创建一个JDBC连接池。

我在eclipse Mars中运行我的应用程序服务器,然后访问glassfish的administration page

然后,我转到JDBC - > JDBC CONNECTION POOL - > NEW ...

在表格中,我会通知以下信息:

enter image description here

当我接下来clic时,我得到这个错误页面

enter image description here

错误日志是:

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

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题而且我找到了一个解决方案:我没有使用IDE(Netbeans)创建连接池,而是使用了命令行:

我的数据库用户名是root an empty password,我正在处理我的localhost。 我的表名为tmpDb

这是我使用的命令:

$> 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

这对你有用吗?