来自数据库的实体类....错误无效的资源_pm [英] Entity Class from Database....Error Invalid resource _pm

查看:263
本文介绍了来自数据库的实体类....错误无效的资源_pm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过phpMyAdmin在MySQL中创建了一个数据库和表.我正在尝试使用数据库中的Entity类将其连接到我的项目.但是,在运行项目时出现以下错误:

I have created a database and table in MySQL through phpMyAdmin. I am trying to connect this to my project using Entity class from database. However I get the following error when I run my project:

Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:      Invalid resource : java:module/companyDB__pm

我已经搜索了几个小时,似乎很多人都遇到了类似的问题,但是我无法按照提供的步骤来解决.例如,我尝试按照以下步骤操作: http: //www.nagazuka.nl/2014/03/invalid-resource-with-netbeans-8_27.html 但没有帮助.我试图在我的glassfish-resources.xml和persistence.xml中进行更改,但是没有任何效果. 任何帮助,请感激!

I have searched for hours and it seems lots of people have a similar problem however I have not been able to solve it following the steps provided. For example I tried to follow the steps here: http://www.nagazuka.nl/2014/03/invalid-resource-with-netbeans-8_27.html but has not helped. I have tried making changes in my glassfish-resources.xml and persistence.xml but nothing is working. Any help is appreciated please!

推荐答案

此错误Invalid resource : java:module/companyDB__pm表示您的JNDI不存在于您的服务器中,因此要解决您的问题,您必须使用以下方法在GlassFish服务器中手动创建一个JNDI同名companyDB

This error Invalid resource : java:module/companyDB__pm mean that your JNDI is not exist in your server, so to solve your problem you have to create a JNDI in your GlassFish server manually with the same name companyDB

例如:

登录到服务器后,您将看到:

After login to your server you will see this :

创建JDBC连接池

填写信息,然后按下一步,我正在使用PostgresSQL,因此在您的情况下选择MySQL:

Fill information and press next i'm using PostgresSQL so in your case choose MySQL :

填写连接信息,然后按完成:

Fill the connection information and press finish :

要检查您的连接是否成功,请按ping并检查:

To check if your connecton is succes of not press ping and check :

现在创建JDBC资源:

Now create JDBC Ressources :

创建一个新的JNDI,在您的应用程序中指定相同的名称,并选择之前已经创建它的池,然后按Finish:

Create a new JNDI specify the same name in your application and choose the pool that you already create it before and press finish :

现在您可以部署应用程序了,希望对您有所帮助.

Now you can deploy your application, hope this can help you.

这篇关于来自数据库的实体类....错误无效的资源_pm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆