Search code examples
javanetbeansejbweblogicjava-ee-5

Where is my ejb-jar.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


Solution

  • 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.