• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

not able to connect database in jdeveloper

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
chaitu chaitu
Asked:
chaitu chaitu
1 Solution
 
petmagdyCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now