我的ejb-jar.xml在哪里? [英] Where is my ejb-jar.xml?

查看:263
本文介绍了我的ejb-jar.xml在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NetBeans 7.4中创建了一个Java EE 5企业应用程序,包括使用Weblogic 10.3.0的WAR和EJB。



我使用JPA,所以我需要使用数据源对于我的persistence.xml



我的问题是我试图制作一个JDBC数据源:
http://docs.oracle.com/cd/E15051_01/wls/docs103/jdbc_admin/wwimages/jdbc_package_simple。 gif



但Netbeans没有向EJB添加一个ejb-jar.xml,我需要一个资源引用。 Oracle的文档说,它需要在META-INF文件夹中,但如果我将该文件添加到该文件夹​​,然后编译就会自动删除。



那么我的ejb在哪里-jar.xml?如果我自己创建,我可以做什么来包含它,而不是在编译后被删除?用WINRAR打开jar并手动添加(笑话)?有一个更简单的方法吗?



谢谢

解决方案

那么我删除了我的EJB(没有必要)。我刚刚创建了我的JDBC应用程序模块,以便在我的WAR中使用它,而不必在链接中执行所有这些操作。
将我的datasource-jdbc.xml放在配置文件夹(META-INF)中并将下一个代码插入到weblogic-application.xml中就足够了:

 <模块> 
< name>
MyDatabase
< / name>
< type>
JDBC
< / type>
< path>
META-INF / datasource-jdbc.xml
< / path>
< / module>

然后我在我的Persistence.xml中使用了JNDIMyDatabase



要生成datasource-jdbc.xml,您可以访问服务器(测试一个),创建数据源,然后转到服务器文件夹,并且有一个文件夹(其中一个主文件夹,寻找它)与名称jdbc。在里面,你可以得到你生成的xml。


i created a Java EE 5 Enterprise Application on NetBeans 7.4 including a WAR and an EJB using Weblogic 10.3.0

Im using JPA so i need to use the datasource for my persistence.xml

My problem is i'm trying to make a JDBC Datasource following this: http://docs.oracle.com/cd/E15051_01/wls/docs103/jdbc_admin/wwimages/jdbc_package_simple.gif

But Netbeans didn't add a ejb-jar.xml to the EJB, which i need for a resource reference. Oracle's documentation says it needs to be inside META-INF folder but if i add that file to that folder and then compile it is automatically deleted.

So, where is my ejb-jar.xml ? If i create it by my own what can i do to include it without being deleted after compilation ? Open the jar with WINRAR and add it manually (joke) ? Is there a easier way of doing this ?

Thanks

解决方案

Well, i deleted my EJB (it wasn't necessary). I just created my JDBC Application Module to use it in my WAR without doing all those things in the link. Putting my datasource-jdbc.xml in the config folder (META-INF) and inserting the next code in the weblogic-application.xml was enough:

<module>
  <name>
    MyDatabase
  </name>
  <type>
    JDBC
  </type>
  <path>
    META-INF/datasource-jdbc.xml
  </path>
</module>

Then I used the JNDI "MyDatabase" in my Persistence.xml

To generate the datasource-jdbc.xml you can go to the server (a testing one), make the datasource and then go to the server folder and there is a folder (inside one of the main folders, look for it) with the name "jdbc". Inside it, you can get your generated xml.

这篇关于我的ejb-jar.xml在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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