?
Solved

not able to connect database in jdeveloper

Posted on 2004-10-26
3
Medium Priority
?
343 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
1 Comment
 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
A solution for Fortify Path Manipulation.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month3 days, 6 hours left to enroll

598 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