2016-05-18 191 views
0

我想配置GlassFish 5与此数据源JNDI名称:jdbc/DefaultD加载JDBC资源

Exception attempting to inject Res-Ref-Env-Property: jdbc/[email protected]@ resolved as: jndi: java:comp/[email protected] principal: [email protected]: null No Runtime properties Database Vendor : null Create Tables at Deploy : false Delete Tables at Undeploy : false into class com.crm.web.authentication.LoginController: Lookup failed for 'java:comp/env/jdbc/DefaultDB' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} 

我创建数据源池和和JDBC资源,但是当我运行该应用程序闻我得到上述错误。有没有解决这个问题的方法?

回答

0

在创建数据源JNDI之前,您需要将数据库相关的Jar文件放在glass fish domain lib文件夹中。例如:如果你在默认的glass fish domain domain1中为MySQL数据库创建JNDI,那么你需要在lib文件夹中放置“mysql-connector-java-5.1.23-bin.jar”。然后重新启动服务器,那么它将工作