我正在开发一个Web应用程序,因此我决定使用Netbeans IDE 8.1,默认的Glassfish Server 4.1和oracle数据库11g快速版。
首先,我需要在Glassfish中创建连接池。我打开localhost:4848设置那些东西:
- Resource Type: javax.sql.DataSource
- Class name of the data source: oracle.jdbc.pool.OracleDataSource
In Additionnal properties i set :
- driverClass : oracle.jdbc.OracleDriver
- portNumber : 1521
- databaseName : XE
- user: user
- password: password
- url: jdbc:oracle:thin:@localhost:1521:XE
和其他默认值。
第二我在C:\Program Files\glassfish-4.1\glassfish\domains\domain1\lib\ext
但不幸的是,当我尝试ping时,显示此错误:
An error has occurred
Ping Connection Pool failed for mailing_pool. Class name is wrong or classpath is not set for : oracle.jdbc.pool.OracleDataSource Please check the server.log for more details.
最后,我还在cmd上执行了tnsping命令,并且所有事情都没问题,这是cmd上显示的结果:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ADMIN-
PC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
OK (30 msec)
任何人都可以帮助我
答案 0 :(得分:0)
尝试将ojbc6.jar文件放在以下目录中,然后重新启动服务器:
C:\Program Files\glassfish-4.1\glassfish\domains\domain1\lib\
或者,为了使其可用于您创建的所有域,请将其放在以下文件夹中:
C:\Program Files\glassfish-4.1\glassfish\lib