[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

not able to connect database in jdeveloper

Posted on 2004-10-26
3
Medium Priority
?
341 Views
Last Modified: 2008-01-09
I created jpr's for web and EJB's in Jdeveloper;



for EJB this is ejb-jar.xml file

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>

<ejb-jar>
  <description>No Description</description>
  <display-name>EJB</display-name>
  <small-icon />
  <large-icon />
  <enterprise-beans>
    <session>
      <description>No Description</description>
      <display-name>ESupplyUtilitiesSessionBean</display-name>
      <ejb-name>ESupplyUtilitiesSessionBean</ejb-name>
      <home>com.foursoft.esupply.common.ejb.sls.ESupplyUtilitiesSessionHome</home>
      <remote>com.foursoft.esupply.common.ejb.sls.ESupplyUtilitiesSession</remote>
      <ejb-class>com.foursoft.esupply.common.ejb.sls.ESupplyUtilitiesSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-ref>
      <description>No Description</description>
      <res-ref-name>jdbc/DB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      
      </resource-ref>
    </session>
  </enterprise-beans>
</ejb-jar>

orion-ejb-jar.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">

<orion-ejb-jar deployment-version="9.0.2.0.0" deployment-time="f862b45653">
      <enterprise-beans>
            <session-deployment name="ConsolSessionBean" max-instances="10" location="ConsolSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETCustomerContractSessionBean" max-instances="10" location="ETCustomerContractSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETransGatewaySetupSessionBean" max-instances="10" location="ETransGatewaySetupSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="QuoteSessionBean" max-instances="10" location="QuoteSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETransHOSuperUserSetupSessionBean" max-instances="10" location="ETransHOSuperUserSetupSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETransHOAdminSetupSessionBean" max-instances="10" location="ETransHOAdminSetupSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="OceanTariffSessionBean" max-instances="10" location="OceanTariffSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ClausesSessionBean" max-instances="10" location="ClausesSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="TaxEngineBean" max-instances="10" location="TaxEngineBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ChargeMasterSessionBean" max-instances="10" location="ChargeMasterSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="AccessControlSessionBean" max-instances="10" location="AccessControlSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="UserRoleRegistrationSessionBean" max-instances="10" location="UserRoleRegistrationSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ESupplyUtilitiesSessionBean" max-instances="10" location="ESupplyUtilitiesSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="MailerBean" max-instances="10" location="MailerBean" >
                  <resource-ref-mapping name="mail/MS" location="mailPool" />
            </session-deployment>
            <session-deployment name="ETSSetupSessionBean" max-instances="10" location="ETSSetupSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETDOSessionBean" max-instances="10" location="ETDOSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="OIDSessionBean" max-instances="10" location="OIDSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="CustomerReportSessionBean" max-instances="10" location="CustomerReportSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="OperationalReportSessionBean" max-instances="10" location="OperationalReportSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="TrackingSessionBean" max-instances="10" location="TrackingSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ShipmentEventsSessionBean" max-instances="10" location="ShipmentEventsSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="GpsSetupSessionBean" max-instances="10" location="GpsSetupSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="BeyondCostSessionBean" max-instances="10" location="BeyondCostSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="BillingSessionBean" max-instances="10" location="BillingSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="BookingSessionBean" max-instances="10" location="BookingSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="BreakBulkSessionBean" max-instances="10" location="BreakBulkSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ProfilesSessionBean" max-instances="10" location="ProfilesSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ConsoleSessionBean" max-instances="10" location="ConsoleSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="HBLSessionBean" max-instances="10" location="HBLSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETSReportsSessionBean" max-instances="10" location="ETSReportsSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="CustomerSessionBean" max-instances="10" location="CustomerSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="VendorSessionBean" max-instances="10" location="VendorSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="HouseDocumentSessionBean" max-instances="10" location="HouseDocumentSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="MAWBSessionBean" max-instances="10" location="MAWBSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETAReportsSessionBean" max-instances="10" location="ETAReportsSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETUtilitiesSessionBean" max-instances="10" location="ETUtilitiesSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="ETOperationUtilitiesSessionBean" max-instances="10" location="ETOperationUtilitiesSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <session-deployment name="HouseSessionBean" max-instances="10" location="HouseSessionBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </session-deployment>
            <entity-deployment name="QuoteBean" max-instances="10" location="QuoteBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="OceanTariffBean" max-instances="10" location="OceanTariffBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="RoleMasterBean" max-instances="10" location="RoleMasterBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="UserMasterBean" max-instances="10" location="UserMasterBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="ConsoleEntityBean" max-instances="10" location="ConsoleEntityBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="HAWBEntityBean" max-instances="10" location="HAWBEntityBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="MAWBEntityBean" max-instances="10" location="MAWBEntityBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="HBLEntityBean" max-instances="10" location="HBLEntityBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="HouseEntityBean" max-instances="10" location="HouseEntityBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="BookingEntityBean" max-instances="10" location="BookingEntityBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="CustomerBean" max-instances="10" location="CustomerBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
            <entity-deployment name="VendorBean" max-instances="10" location="VendorBean" >
                  <resource-ref-mapping name="jdbc/DB" location="oraclePool" />
            </entity-deployment>
      </enterprise-beans>
      <assembly-descriptor>
            <default-method-access>
                  <security-role-mapping name="&lt;default-ejb-caller-role&gt;" impliesAll="true" />
            </default-method-access>
      </assembly-descriptor>
</orion-ejb-jar>

 ;i will run index.jsp from jdeveloper,this jsp will call  ejb file ;in jdeveloper on what name should i create the connection ?
0
Comment
Question by:chaitu chaitu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
petmagdy earned 2000 total points
ID: 12409873
ok to call ur EJB from ur JSP do the following:

1- open ur menu (tools --> Embedded OC4J server Preferences ) in the left tree select (Current work space (ur project name) ---> Datasources ) make sure their is a defined datasource with the proper DB connection parameters  and this datasource in the JNDI Names Tab the attribute "EJB Location" value is "oraclePool"

2- in ur Web module create an ejb reference in ur web.xml as following:

<ejb-ref>
      <ejb-ref-name>ejb/ESupplyUtilitiesSessionBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <home>com.foursoft.esupply.common.ejb.sls.ESupplyUtilitiesSessionHome</home>
      <remote>com.foursoft.esupply.common.ejb.sls.ESupplyUtilitiesSession</remote>
        <ejb-link>ESupplyUtilitiesSessionBean</ejb-link>
</ejb-ref>


3- in ur JSP do the following:
import the packages javax.naming.* and ur EJB package and then write this sample code:

Context initCtx;
initCtx = new InitialContext();
Object theHomeObject = initCtx.lookup("java:comp/env/ejb/ESupplyUtilitiesSessionBean");
ESupplyUtilitiesSessionHome thehome= (ESupplyUtilitiesSessionHome ) javax.rmi.PortableRemoteObject.narrow(theHomeObject , ESupplyUtilitiesSessionHome.class);

ESupplyUtilitiesSession theRemote= thehome.create();
// Call the RJB Methods
theRemote.foo()


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question