HOWTO: Using a BC4J Application Module in an Stateless EJB Session Bean

HOWTO: Using a BC4J Application Module in an Stateless EJB Session Bean
by Steve Muench
Overview
BC4J provides automatic facilities for deploying any application module as a stateful EJB session bean. If you want to leverage the features of your BC4J application module from a stateless EJB session bean, it's not automatic but it is straightforward to implement. This howto article explains the details.
For our example, we will create a stateless EJB session bean that uses a container-managed transaction. To keep things simple, let's assume the session bean has a single public method on its remote interface named createDepartment() with the following signature:
public void createDepartment(int id, String name, String loc) throws AppException
AppException is an example of an application-specific exception that our method will throw if any problems arise during its execution.The goal of this article is to illustrate how to use the BC4J application module named com.example.hr.HRApp as part of the implementation of this createDepartment method on our stateless enterprise bean. Let's assume that the HRApp application module has a view object member named Departments, based on the com.example.hr.DeptView view object, based on the familiar DEPT table and related to the com.example.hr.Dept entity object so our view can be updateable.
Creating the Stateless Session Bean
We can start by using the JDeveloper Enterprise Bean wizard to create a new stateless session bean called StatelessSampleEJB implemented by:[list][*]com.example.StatelessSampleEJBBean (Bean class)[*]com.example.StatelessSampleEJBHome (Home interface)[*]com.example.StatelessSampleEJB (Remote interface)[list]
We then use the EJB Class Editor to add the createDepartment method to the remote interface of StatelessSampleEJB with the signature above. We edit the remote interface to make sure that it also reflects that the createDepartment method thows the AppException like this:
package com.example;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface StatelessSampleEJB extends EJBObject {
  void createDepartment(int id, String name, String loc)
  throws RemoteException,AppException;
}Before we start adding BC4J into the picture for our implementation, our StatelessSampleEJBBean class looks like this:
package com.example;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
public class StatelessSampleEJBBean implements SessionBean {
  public void ejbCreate(){}
  public void ejbActivate(){}
  public void ejbPassivate(){}
  public void ejbRemove(){}
  public void setSessionContext(SessionContext ctx){
  public void createDepartment(int id, String name, String loc) 
  throws AppException {
    // TODO: Implement method here
}We can double-click on the ejb-jar.xml file in our project to see the XML deployment descriptor for the bean we just created:
<ejb-jar>
   <enterprise-beans>
      <session>
         <description>Session Bean ( Stateless )</description>
         <display-name>StatelessSampleEJB</display-name>
         <ejb-name>StatelessSampleEJB</ejb-name>
         <home>com.example.StatelessSampleEJBHome</home>
         <remote>com.example.StatelessSampleEJB</remote>
         <ejb-class>com.example.StatelessSampleEJBBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
      </session>
   </enterprise-beans>
</ejb-jar>We need to add the extra <assembly-descriptor> section in this file to indicate that the createDepartment method will require a transaction. After this edit, the ejb-jar.xml file looks like this:
<ejb-jar>
   <enterprise-beans>
      <session>
         <description>Session Bean ( Stateless )</description>
         <display-name>StatelessSampleEJB</display-name>
         <ejb-name>StatelessSampleEJB</ejb-name>
         <home>com.example.StatelessSampleEJBHome</home>
         <remote>com.example.StatelessSampleEJB</remote>
         <ejb-class>com.example.StatelessSampleEJBBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
      </session>
   </enterprise-beans>
   <assembly-descriptor>
      <container-transaction>
         <method>
            <ejb-name>StatelessSampleEJB</ejb-name>
            <method-name>createDepartment</method-name>
            <method-params>
               <method-param>int</method-param>
               <method-param>java.lang.String</method-param>
               <method-param>java.lang.String</method-param>
            </method-params>
         </method>
         <trans-attribute>Required</trans-attribute>
      </container-transaction>
   </assembly-descriptor>
</ejb-jar>
Aggregating a BC4J Application Module
With the EJB aspects of our bean setup, we can proceed to implementing the BC4J application module aggregation.
The first thing we do is add private variables to hold the EJB SessionContext and the instance of the aggregated BC4J ApplicationModule, like this:
// Place to hold onto the aggregated appmodule instance
transient private ApplicationModule _am  = null;
// Remember the SessionContext that the EJB container provides us
private           SessionContext    _ctx = null;and we modify the default, empty implementation of the setSessionContext() method to remember the session context like this:
public void setSessionContext(SessionContext ctx){ _ctx = ctx; }We add additional constants that hold the names of the J2EE datasource that we want BC4J to use, as well as the fully-qualified name of the BC4J application module that we'll be aggregating:
// JNDI resource name for the J2EE datasource to use
private static final String DATASOURCE = "jdbc/OracleCoreDS";
// Fully-qualified BC4J application module name to aggregate
private static final String APPMODNAME = "com.example.hr.HRApp";We expand the now-empty ejbCreate() and ejbRemove() methods to create and destory the aggregated instance of the BC4J application module that we'll use for the lifetime of the stateless session bean. When we're done, ejbCreate() it looks like this:
public void ejbCreate() throws CreateException {
  try {
    // Setup a hashtable of environment parameters for JNDI initial context
    Hashtable env = new Hashtable();
    env.put(JboContext.INITIAL_CONTEXT_FACTORY,JboContext.JBO_CONTEXT_FACTORY);
    // NOTE: we want to use the BC4J app module in local mode as a simple Java class!
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
    env.put(PropertyConstants.INTERNAL_CONNECTION_PARAMS,DATASOURCE);
    // Create an initial context, using this hashtable of environment params
    InitialContext ic = new InitialContext(env);
    // Lookup a home interface for the application module
    ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(APPMODNAME);
    // Using the home, create the instance of the appmodule we'll use
    _am = home.create();
    // Register the BC4J factory to handle EJB container-managed transactions
    registerContainerManagedTransactionHandlerFactory();
  catch(Exception ex) {
     ex.printStackTrace();
    throw new CreateException(ex.getMessage());
}and ejbRemove() looks like this:
public void ejbRemove() {
  try {
    // Cleanup any appmodule resources before getting shutdown
    _am.remove();
  catch(JboException ex) { /* Ignore */ }
}The helper method named reigsterContainerManagedTransactionHandlerFactory() looks like this:
private void registerContainerManagedTransactionHandlerFactory() {
  SessionImpl session = (SessionImpl)_am.getSession();
  session.setTransactionHandlerFactory(
    new TransactionHandlerFactory() {
      public TransactionHandler  createTransactionHandler() {
        return new ContainerManagedTxnHandlerImpl();
      public JTATransactionHandler createJTATransactionHandler() {
        return new ContainerManagedTxnHandlerImpl();
}The last detail is to use the BC4J appmodule to implement the createDepartment() method. It ends up looking like this:
public void createDepartment(int id, String name, String loc)
throws AppException {
  try {
    // Connect the AM to the datasource we want to use for the duration
    // of this single method call.
    _am.getTransaction().connectToDataSource(null,DATASOURCE,false);
    // Use the "Departments" view object member of this AM
    ViewObject departments = _am.findViewObject("Departments");
    // Create a new row in this view object.
    Row newDept = departments.createRow();
    // Populate the attributes from the parameter arguments.
    newDept.setAttribute("Deptno", new Number(id));
    newDept.setAttribute("Dname", name);
    newDept.setAttribute("Loc", loc);
    // Add the new row to the view object's default rowset
    departments.insertRow(newDept);
    // Post all changes in the AM, but we don't commit them. The EJB
    // container managed transaction handles the commit.
    _am.getTransaction().postChanges();
  catch(JboException ex) {
    // To be good EJB Container-Managed Transaction "citizens" we have
    // to mark the transaction as needing a rollback if there are problems
    _ctx.setRollbackOnly();
    throw new AppException("Error creating dept "+ id +"\n"+ex.getMessage());
  finally {
    try {
      // Disconnect the AM from the datasource we're using
      _am.getTransaction().disconnect();
    catch(Exception ex) { /* Ignore */ }
Building a Test Client
With the EJB-Tier work done, we can build a sample client program to test this new stateless EJB Session Bean by selecting the bean in the Oracle9i JDeveloper IDE and choosing "Create Sample Java Client" from the right-mouse menu.
When the "Sample EJB Client Details" dialog appears, we take the defaults of connecting to embedded OC4J container. Clicking the (OK) button generates the following test class:
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.example.StatelessSampleEJB;
import com.example.StatelessSampleEJBHome;
public class SampleStatelessSampleEJBClient {
  public static void main(String [] args) {
    SampleStatelessSampleEJBClient sampleStatelessSampleEJBClient =
       new SampleStatelessSampleEJBClient();
    try {
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,
              "com.evermind.server.rmi.RMIInitialContextFactory");
      env.put(Context.SECURITY_PRINCIPAL, "admin");
      env.put(Context.SECURITY_CREDENTIALS, "welcome");
      env.put(Context.PROVIDER_URL,
              "ormi://localhost:23891/current-workspace-app");
      Context ctx = new InitialContext(env);
      StatelessSampleEJBHome statelessSampleEJBHome =
           (StatelessSampleEJBHome)ctx.lookup("StatelessSampleEJB");
      StatelessSampleEJB statelessSampleEJB;
      // Use one of the create() methods below to create a new instance
      // statelessSampleEJB = statelessSampleEJBHome.create();
      // Call any of the Remote methods below to access the EJB
      // statelessSampleEJB.createDepartment( int id, java.lang.String name, java.lang.String loc );
    catch(Throwable ex) {
      ex.printStackTrace();
}We uncomment the call to the create() method and add a few calls to the createDepartment() method so that the body of the test program now looks like this:
// Use one of the create() methods below to create a new instance
statelessSampleEJB = statelessSampleEJBHome.create();
// Call any of the Remote methods below to access the EJB
statelessSampleEJB.createDepartment( 13, "Test1","Loc1");
System.out.println("Created department 13");
statelessSampleEJB.createDepartment( 14, "Test2","Loc2");
System.out.println("Created department 14");
try {
  // Try setting a department id that is too large!
  statelessSampleEJB.createDepartment( 23456, "Test3","Loc3");
catch (AppException ax) {
  System.err.println("AppException: "+ax.getMessage());
}Before we can successfully run our SampleStatelessSampleEJBClient we need to first run the EJB bean that the client will try to connect to. Since Oracle9i JDeveloper supports local running and debugging of the EJB-Tier without doing through a full J2EE deployment step, to accomplish this prerequisite step we just need to right-mouse on the StatelessSampleEJB node in the System Navigator and select "Run". This starts up the embedded OC4J instance and runs the EJB right out of the current out path.Finally, we can run the SampleStatelessSampleEJBClient, and see the output of the test program in the JDeveloper log window:
Created department 13
Created department 14
AppException: Error creating dept 23456
JBO-27010: Attribute set with value 23456 for Deptno in Dept has invalid precision/scale
Troubleshooting
One error that might arise while running the example is that the database connection information in your data-sources.xml for the jdbc/OracleCoreDS datasource does not correspond to the database you are trying to test against. If this happens, then double-check the file .\jdev\system\oc4j-config\data-sources.xml under the JDeveloper installation home directory to make sure that the url value provided is what you expect. For example, to work against a local Oracle database running on your current machine, listening on port 1521, with SID of ORCL, you would edit this file to have an entry like this for jdbc/OracleCoreDS :
<data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="OracleDS"
    location="jdbc/OracleCoreDS"
    xa-location="jdbc/xa/OracleXADS"
    ejb-location="jdbc/OracleDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="scott"
    password="tiger"
    url="jdbc:oracle:thin:@localhost:1521:ORCL"
    inactivity-timeout="30"
/>This is the data-sources.xml file that gets used by the embedded OC4J instance running in JDeveloper.
Conclusion
Hopefully this article has illustrated that it is straightforward to utilize the full power of BC4J in local mode as part of your EJB Stateless Session Beans using container-managed transaction. This example illustrated a single createDepartment method in the enterprise bean, but by replicating the application module interaction code that we've illustrated in createDepartment, any number of methods in your stateless session bean can use the aggregated application module instance created in the ejbCreate() method.
Code Listing
The full code listing for the SampleStatelessEJB bean implementation class looks like this:
* StatelessSampleEJB
* Illustrates how to use an aggregated BC4J application module
* in local mode as part of the implementation of a stateless
* EJB session bean using container-managed transaction.
* HISTORY
* smuench/dmutreja 14-FEB-2002 Created
package com.example;
import oracle.jbo.*;
import oracle.jbo.server.*;
import javax.ejb.*;
import oracle.jbo.domain.Number;
import oracle.jbo.common.PropertyConstants;
import java.util.Hashtable;
import javax.naming.InitialContext;
import oracle.jbo.server.ejb.ContainerManagedTxnHandlerImpl;
public class StatelessSampleEJBBean implements SessionBean {
  // JNDI resource name for the J2EE datasource to use
  private static final String DATASOURCE = "jdbc/OracleCoreDS";
  // Fully-qualified BC4J application module name to aggregate
  private static final String APPMODNAME = "com.example.hr.HRApp";
  // Place to hold onto the aggregated appmodule instance
  transient private ApplicationModule _am  = null;
  // Remember the SessionContext that the EJB container provides us
  private           SessionContext    _ctx = null;
  public void ejbCreate() throws CreateException {
    try {
      // Setup a hashtable of environment parameters for JNDI initial context
      Hashtable env = new Hashtable();
      env.put(JboContext.INITIAL_CONTEXT_FACTORY,JboContext.JBO_CONTEXT_FACTORY);
      env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
      env.put(PropertyConstants.INTERNAL_CONNECTION_PARAMS,DATASOURCE);
      // Create an initial context, using this hashtable of environment params
      InitialContext ic = new InitialContext(env);
      // Lookup a home interface for the application module
      ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(APPMODNAME);
      // Using the home, create the instance of the appmodule we'll use
      _am = home.create();
      // Register the BC4J factory to handle EJB container-managed transactions
      registerContainerManagedTransactionHandlerFactory();
    catch(Exception ex) {
       ex.printStackTrace();
      throw new CreateException(ex.getMessage());
  public void ejbActivate(){}
  public void ejbPassivate(){}
  public void ejbRemove(){}
  public void setSessionContext(SessionContext ctx){ _ctx = ctx; }
  public void createDepartment(int id, String name, String loc)
  throws AppException {
    try {
      // Connect the AM to the datasource we want to use for the duration
      // of this single method call.
      _am.getTransaction().connectToDataSource(null,DATASOURCE,false);
      // Use the "Departments" view object member of this AM
      ViewObject departments = _am.findViewObject("Departments");
      // Create a new row in this view object.
      Row newDept = departments.createRow();
      // Populate the attributes from the parameter arguments.
      newDept.setAttribute("Deptno", new Number(id));
      newDept.setAttribute("Dname", name);
      newDept.setAttribute("Loc", loc);
      // Add the new row to the view object's default rowset
      departments.insertRow(newDept);
      // Post all changes in the AM, but we don't commit them. The EJB
      // container managed transaction handles the commit.
      _am.getTransaction().postChanges();
    catch(JboException ex) {
      // To be good EJB Container-Managed Transaction "citizens" we have
      // to mark the transaction as needing a rollback if there are problems
      _ctx.setRollbackOnly();
      throw new AppException("Error creating dept "+ id +\n"+ex.getMessage());
    finally {
      try {
        // Disconnect the AM from the datasource we're using
        _am.getTransaction().disconnect();
      catch(Exception ex) { /* Ignore */ }
  private void registerContainerManagedTransactionHandlerFactory() {
    SessionImpl session = (SessionImpl)_am.getSession();
    session.setTransactionHandlerFactory(
      new TransactionHandlerFactory() {
        public TransactionHandler createTransactionHandler() {
          return new ContainerManagedTxnHandlerImpl();
        public JTATransactionHandler createJTATransactionHandler() {
          return new ContainerManagedTxnHandlerImpl();

Hi Steve, It4s me again;
About the question I made, I tried with a single assembly-descriptor tag and a single container-transaction tag in the deployment descriptor of the session bean and these were the results.
java.lang.NullPointerException
     void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
     java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     void __Proxy1.modificaEnvoltura(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String)
     void SamplemdeController.envolturaControlEJBClient.main(java.lang.String[])
Then I tried with multiple assembly-descriptor tags each with a single container-transaction tag and the results were:
java.lang.NullPointerException
     void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
     java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     void __Proxy1.modificaEnvoltura(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String)
     void SamplemdeController.envolturaControlEJBClient.main(java.lang.String[])
Finally I tried with a single assembly-descriptor and multiple container tags and the results were:
java.lang.NullPointerException
     void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
     java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     void __Proxy1.modificaEnvoltura(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String)
     void SamplemdeController.envolturaControlEJBClient.main(java.lang.String[])
How can I make my Stateless Session bean work out?

Similar Messages

  • BUG: Can't create BC4J Application Module Configurations

    Hello,
    I'm using JDev 9.0.3.1 with Win2K and WinXP. There seems to be a bug in the BC4J Application Module Configuration Manager:
    It seems to be impossible to create a new BC4J Application Module Configuration with the Configuration Manager of a BC4J Application Module. I can copy an existing AM configuration, but I can not rename it. Clicking on the OK Button in the Configuration Manager simply does nothing.
    A work around seems to be to open bc4j.xcfg in any text editor, copy an AppModuleConfig element, save xcfg, in JDev remove the project form the workspace, readd it to the workspace (some caching issue of jdev?). Then the new AM config is there and can be modified.
    In JDev 9.0.3 the Config Manager seems to work fine.
    Regards
    Stefan

    The bug is mentioned in metalink bug 2849146.

  • BC4J Application Module Pooling for JClient App

    Helo,
    i wonder why all documentation about bc4j application module pooling available is for Web app ? (jsp) . I'm creating swing JClient app and i need some doc about how the application module pooling works in this kind of application.
    anybody know where can i get those docs ?
    Need help and Thank you,
    Ricky H.P.

    Connection pooling can be achieved when a JVM instance manages the pool, in 3tiers the Java App. Server has that task.
    If you are 2tiers that means that you are communicating with the database through JDBC.
    When a user launches your JClient app in fact he lauches his own JVM instance so I don't how he could share a pool with other users.
    In your case you have at most 2 open transactions per user.
    You can achieve that by sharing a same binding context with n forms composed of m panels.
    Let's say:
    1 main form
    connection 1: forms a,b,c
    connection 2: forms x,y,z
    In your main form your open your 2 connections and share them.
    You can achieve that by:
    1) in our main form, initialize 2 binding containers
    Example of one:
    DCBindingContainer bc1 = this.createBindingContainer("package name","model name");
    private DCBindingContainer createBindingContainer(String packageName, String panelModelName)
    StringBuffer sb = new StringBuffer(packageName);
    sb.append(ViewConstants.STRING_DOT);
    sb.append(panelModelName);
    DCBindingContainerDef bcdef = DCBindingContainerDef.findDefObject(sb.toString()); //NOTE THE NAME.
    if (bcdef == null)
    throw new JboException("System error, "+getClass().getName()+".createBindingContainer, DCBindingContainerDef: "+sb.toString()+" not found");
    DCBindingContainer bc = bcdef.createBindingContainer(panelBinding.getBindingContext());
    bc.setName(panelModelName);
    panelBinding.getBindingContext().put(panelModelName, bc);
    return bc;
    2) Before that the jbInit method gets called in the called form, set the binding context:
    form1 = new Form1(...);
    form1.setBindingContainer(bc1) ;
    Example of methods in form 1 and form 2:
    public void setBindingContainer(DCBindingContainer ctr)
    this.panelBinding = (JUPanelBinding)ctr;
    setBindingContext(ctr.getBindingContext());
    public void setBindingContext(BindingContext bindCtx)
    if (panelBinding.getPanel() == null)
    panelBinding = panelBinding.setup(bindCtx, this);
    registerProjectGlobalVariables(bindCtx);
    panelBinding.refreshControl();
    try
    System.out.println("Form setBindingContext calling jbInit");
    jbInit();
    panelBinding.refreshControl();
    // FL added
    isBindingContextSet = true;
    System.out.println("Form isBindingContextSet true");
    catch(Exception ex)
    System.out.println("Form setBindingContext exception caught");
    panelBinding.reportException(ex);
    Regards
    Fred

  • BC4J, JSP, accesing a remote app module deployed as an 8i EJB session bean

    hi everybody,
    i am reposting this question since the thread went somewhat off-topic ...
    i have successfully deployed my Jdev 3.2 developed app module to my remote 8.1.7 db server as an EJB session bean
    i am able to test it via the Business Components Tester ...
    i am also able to test it from my wizard-generated Business Components JSP App using DataWebBeans ...
    but when i try to access it from a JSP data tag page I get the following error:
    Excepcisn:
    javax.servlet.jsp.JspException: JBO-28300: Piggyback read error
    void periodoswebtags_html.PeriodoView_Browse._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
    void oracle.jsp.app.JspApplication.dispatchRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void oracle.jsp.JspServlet.doDispatch(oracle.jsp.app.JspRequestContext)
    void oracle.jsp.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void oracle.jsp.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
    void oracle.lite.web.JupServlet.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.MimeServletHandler.handle(oracle.lite.web.JupApplication, java.lang.String, int, oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.JupApplication.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.JupHandler.handle(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.HTTPServer.process(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    boolean oracle.lite.web.HTTPServer.handleRequest(oracle.lite.web.JupInputStream, oracle.lite.web.JupOutputStream)
    boolean oracle.lite.web.JupServer.handle(oracle.lite.web.JupInputStream, oracle.lite.web.JupOutputStream)
    void oracle.lite.web.SocketListener.process(java.net.Socket)
    void oracle.lite.web.SocketListener$ReqHandler.run()
    and the JBO-28300 error is undocumented ... :(
    i have included a library containing the <mybcs>CommonEJB.jar and <myappmodule>EJBClient.jar files into my JSP projects
    the JSP data tag page is a wizard-generated trivial browse page
    TIA,
    p

    hi everybody,
    just fixed ... :) ...
    i added the following libraries to my JSP data tag project and everythig works fine ...
    Oracle XML Parser 2.0
    JBO Runtime
    SQLJ Runtime
    HTH,
    p

  • Can Oracle SQL Flavor be used When BC4J is deployed in WebLogic as EJB?

    Hi,
    Does anybodys know if Oracle SQL Flavor can be used When BC4J is deployed in WebLogic as EJB?
    We succeeded in deploying BC4J to WebLogic 7.0 & 6.0, but we had to select the SQL92 option for SQL Flavor when the first BC package is created in a project. Selecting Oracle option for SQL Flavor will cause EJB to fail, and client get a ClassCastException.
    We still want to use Oracle SQL, is it possible to use it with WebLogic?
    Thanks.

    We figured out that Oracle SQL Flavor can be used with WebLogic, but only with DB connections created from JDBC URL, not work with DB connections from WebLogic connection pool.

  • Deploying App Module as EJB Session Bean to JBoss

    I am attempting to follow the How-To at
    http://otn.oracle.com/products/jdev/howtos/appservers/deploy_bc4j_to_jboss.html for deploying BC4J to JBoss. In particular, I was looking at the section 'BC4J as an EJB Session Bean', because that is the route we would like to take.
    The document instructs you to create a business components deployment profile.. ok, done.
    It then instructs you to copy the app module configuration that was just created and rename it. However, the editor will not let you rename the configuration.
    Then when 'Creating a JSP to Access Your Application Module as a EJB', the wizard to create the JSP will not allow you to select the app module configuration that was just created. It only shows the Local configuration.
    What am I doing wrong? I am using JDeveloper 9.0.3.1.
    My ultimate goal is to take an existing BC4J/JSP application and deploy the app module as an EJB, so the JSP and EJB can reside on separate machines.
    Any pointers that anyone can give me about deploying an app module as a Session Facade (BMT) to JBoss, with a JSP front end, is greatly appreciated. I have read the how-tos available from OTN. I have relatively little experience with EJB, so please forgive me if there's something obvious I'm missing.
    Thanks!!!

    Can this be solved by application module pooling? How
    can we use the PoolMgr to work with the session
    beans?You can use a stateless checkout/checkin appmodule.
    Take a look at the following help topics which explain this in good detail.
    "About Application Module Pooling"
    "About JSP Pages and Application Module Pooling"
    The pool can help reuse the appmodule instance across requests thus reducing the number of concurrent db sessions.
    Dhiraj

  • Sharing a BC4J application module amongst sessions

    Is there any method of sharing an application module amongst many sessions. Take BC4J/JSP on a single web server. We have a considerable amount of static lookup data that rarely changes and it seems daft to have to store this in the entity/view cache for every application module (one per active session).
    If we have a 100 sessions running I don't won't to store the lookup data 100 times. The smaller the session memory footprint the better.
    Anyone got any ideas?

    Hi,
    In 9.0.5 there is a property, "jbo.ampool.isuseexclusive", that may be used to configure this behaviour for an ApplicationPool.
    The summary is that when this property is false SessionCookie.useApplicationModule requests do not return an ApplicationModule that is reserved exclusively for that SessionCookie. Instead the AMs in the "intial pool" are shared by all SessionCookies that are using that pool.
    The reason that this is not formally documented is that it will not work with the declarative binding layer.
    Though BC4J itself is designed to be threadsafe you could still get race conditions on the default iterators. Imagine two threads that are looping through the rows of the default RSI of a deptVO in an unsynchronized block and, consequently, interleaving next calls.
    This is not an issue for programmatic clients as long as each thread of control instantiates their own RSI for access, simply does not use RowSetIterators, or implements synchronized, re-entrant use of an RSI.
    Please see the documentation for examples of developing a programmatic client that uses the pool APIs directly.
    Hope this helps,
    JR

  • Using local interfaces for EJB (session bean)

    Hi,
    I�ve a question regarding when to use the Local interfaces(EJBLocal and EJBLocalHome) of a enterprise bean. I understand that calls to enterprise bean can be made locally if the client which is invoking is in the same JVM as that of EJB. I�ve written a web client (servlet) which is packaged in a EAR and this servlet is trying to invoke a session bean which is in a �different� EAR using local interfaces. Both the EARs have been deployed in a single server (websphere 6.0 server). It didn�t work for me this way�..If I package the servlet in the same EAR of session bean then it works fine.
    So is this to say that both EARs are not running on the same JVM? Or should it work even if the client and the session bean are in different EARs but in same server?
    Can anyone explain me the fundamentals behind this.
    Thanks in advance

    Local access is only portable within the same .ear. For example, the Java EE SDK and SUN's
    application servers have never supported local EJB access from a web/EJB component in a different
    .ear. One issue is that local access requires that both the caller and target EJB have the same
    classloader. By definition, different Java EE applications have distinct classloaders. In addition,
    in Java EE 5 persistence context propagation does not span applications, so it wouldn't work in the
    local case.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Test web service proxy using EJB session bean client...

    Hello!
    I am following this blog /people/abdelmorhit.elrhazi/blog/2009/10/30/how-to-consume-an-inbound-backend-web-service-in-nwdsjboss-environment to create a EJB session bean client to access the web service proxy...
    The blog is not very clear. Where should I be deploying the web service proxy and the EJB session bean (web service client) ? on the PI 7.1 ?
    How to find out the URL for the wsdl ?
    Thanks

    > The blog is not very clear. Where should I be deploying the web service proxy and the EJB session bean (web service client) ? on the PI 7.1 ?
    "To deploy your web service proxy and session bean, right click on your JBoss server in the Servers view, and click on Add Remove Projects, add you ear file and click finish."
    You need a JBoss server.

  • HOWTO:Deploy BC4J as Session Bean in Weblogic

    This document describes Howto deploy a BC4J Appmodule as EJB Session Bean to Weblogic and
    test the appmodule through the BC4J tester.
    =>create a BC4J Application using Business Components Wizard.
    =>test it using BC4J tester
    =>make the Application Module Remotable [list]
    [*]Select Appmodule and right mouse on it to select the edit option
    [*]Select Remote tab
    [*]Select the check box for Remotable Application Module
    [*]Select EJB Session Bean and shuttle it from Available list to Selected list
    [*]Click on the finish button[list]
    => Do File| Save All and a Rebuild on the project
    => create the weblogic XML Deployment Descriptor[list]
    [*]Choose File|New
    [*]Select the web objects tab
    [*]Select XML and click ok
    [*]Rename the file as ejb-jar.xml using File|Rename
    [*]Save it in the JDEV_HOME/myclasses/META-INF directory.
    [*]Open the xml file by double clicking on it.
    [*]Paste the following into the file
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>wl.WlModule</ejb-name>
    <home>wl.common.ejb.WlModuleHome</home>
    <remote>wl.common.ejb.RemoteWlModule</remote>
    <ejb-class>wl.server.ejb.WlModuleServerEJB</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Bean</transaction-type>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    </assembly-descriptor>
    </ejb-jar>
    [*]Choose File|New
    [*]Select the web objects tab
    [*]Select XML and click ok
    [*]Rename the file as weblogic-ejb-jar.xml using File|Rename
    [*]Save it in the JDEV_HOME/myclasses/META-INF directory.
    [*]Open the xml file by double clicking on it.
    [*]Paste the following into the file
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>wl.WlModule</ejb-name>
    <caching-descriptor>
    <max-beans-in-free-pool>100</max-beans-in-free-pool>
    <max-beans-in-cache>100</max-beans-in-cache>
    <idle-timeout-seconds>60</idle-timeout-seconds>
    </caching-descriptor>
    <jndi-name>wl.WlModule</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    In this example "wl" is the package name and "WlModule" is the Appmodule name.[list]
    => generate the jar file for appmodule along with xml deployment descriptors[list]
    [*]from the command line in JDEV_HOME/myclasses directory run
    [*]jar cvf0 wlappmodule.jar wl META-INF[list]
    => edit the setenv.cmd file in WEBLOGIC_HOME directory[list]
    [*]set JAVA_HOME=f:\jdev32\java1.2
    [*]set JBOLIB=f:\jdev32\lib
    [*]set JDBC_CLASSES=f:\jdev32\jdbc\lib\oracle8.1.7\classes12.zip
    [*]set JBO_RUNTIME=%JBOLIB%\jboorasql.zip;%JDBC_CLASSES%;%JBOLIB%\jbodatum12.zip;%JBOLIB%\xmlparserv2.jar;%JBOLIB%\jbomt.zip;%JBOLIB%\jboejb.jar
    [*]add JBO_RUNTIME in the set CLASSPATH variable[list]
    => create a bc4j deploy batch file "Deploybc4j.cmd" in the WEB_LOGIC HOME
    which will generate the server side jar files
    @setlocal
    set JAVA=java
    set JAVAC=javac
    set BEAN_JAR=%1
    set EJB_TEMP=f:\jdev32\myclasses\wl
    set XMLPARSERV2=f:\jdev32\lib\xmlparserv2.jar;
    set JDBC_LIBS=f:\jdev32\jdbc\oracle8.1.7\lib\classes12.zip
    set JBO_EJB_RUNTIME=f:\jdev32\lib\jbomt.zip;f:\jdev32\lib\jboejb.jar;%XMLPARSERV2%;%JDBC_LIBS%
    set CLASSPATH=%CLASSPATH%;%JBO_EJB_RUNTIME%;%BEAN_JAR%;%EJB_TEMP%
    %JAVA% weblogic.ejbc -compiler javac f:\jdev32\myclasses\wlappmodule.jar f:\jdev32\myclasses\wlAppModuleGenerated.jar;f:\jdev32\lib\jbodomorcl.zip
    pushd %EJB_TEMP%
    @endlocal
    Note: substittue appropriate jar file and directory structure names
    => Run setenv.cmd
    => Run deploybc4j.cmd
    => Configure Weblogic server[list]
    If your weblogic server is residing on a different machine then
    [*]copy wlAppModuleGenerated.jar (generated jar file from deploybc4j.cmd)
    [*]Copy classes12.zip from JDEV_HOME/jdbc/lib/oracle8.1.7/ directory
    [*]Copy jbodomorcl.zip
    [*]jbodatum12.zip
    [*]xmlparserv2.jar
    [*]jbomt.zip
    [*]jboejb.jar from JDEV_HOME/lib directory
    [*]edit weblogic.properties file in WEBLOGIC_HOME directory
    [*]In the WEBLOGIC EJB DEMO PROPERTIES sectio
    [*]add weblogic.ejb.deploy=E:/weblogic/myserver/wlAppModuleGenerated.jar
    (generated jar file from deploybc4j.cmd file)
    [*]edit startweblogic.cmd file in WEBLOGIC_HOME directory
    [*]set POST_CLASSPATH=f:\jdev32\jdbc\oracle8.1.7\lib\classes12.zip;f:\jdev32\lib\jboorasql.zip;f:\jdev32\lib\jbodatum12.zip;f:\jdev32\lib\xmlparserv2.jar;f:\jdev32\lib\jbomt.zip;f:\jdev32 \lib\jboEJB.jar;f:\jdev32\lib\jbodomorcl.zip
    [*]add E:/weblogic/myserver/wlAppModuleGenerated.jar
    (generated jar file from deploybc4j.cmd file) in the weblogic_classpath setting[list]
    Note: modify the directory structure of jar files as apporpriate
    => Run the BC4J tester to test the deployed BC4J Appmodule as session bean to Weblogic[list]
    [*]Add a new library
    [*]Select the Project in which you developed the BC4J Appmodule
    [*]Project | Project Properties
    [*]select libraries tab
    [*]Click on Add
    [*]Click on New
    [*]Specify "JBO WL Client" in the NAME
    [*]Click on ... button for adding the jar files
    [*]Click on Add/Zip jar button to add the following files
    weblogicaux.jar
    jboremoteejb.zip
    jboremote.zip
    <Weblogic_home>/classes
    [*]Click on OK
    [*]Start the weblogic server
    [*]Bring the BC4J Tester by doing a right mouse on the appmodule and selecting Test option
    [*]In the Middle Tier Server Type Select "Weblogic"
    [*]Specify Host name and port # of weblogic server
    [*]Click on Connect[list]
    raghu
    null

    Although this explains how to then deploy to Weblogic on another server, it still presumes that it is installed on the same computer as JDev. I moved the weblogic.jar file over to the computer and fudged a few things to get it to work.
    Also, I am testing this with Weblogic 6.0, so some of the information does not work as prescribed. I edited the config.xml instead of the weblogic.properties file. I am trying to figure out where to put all of the *.jar and *.zip files that I copied over to the Solaris machine with Weblogic. Any suggestions?
    And one of the steps in the section to create the deploybc4j.cmd file is wrong. It says
    "%JAVA% weblogic.ejbc -compiler javac f:\jdev32\myclasses\wlappmodule.jar f:\jdev32\myclasses\wlAppModuleGenerated.jar;f:\jdev32\lib\jbodomorcl.zip"
    Which does not work. I took off the last part:
    "%JAVA% weblogic.ejbc -compiler javac f:\jdev32\myclasses\wlappmodule.jar f:\jdev32\myclasses\wlAppModuleGenerated.jar"
    and it worked. It was getting that whole last part and trying to create a directory with that name and failing.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by David Shanes ([email protected]):
    This seems to assume that JDev and Weblogic are installed on the same server (I refer to the section on setting the setenv.cmd file in the WEBLOGIC_HOME dir that includes the path to the JDev install.
    I have JDev installed on a Win 2k box and Weblogic installed on a Solaris. Any suggestions? I got all the way up to the setenv.cmd step fine.<HR></BLOCKQUOTE>
    null

  • Problem in Connection pooling after deploying BC4J App Module as EJB

    Hi,
    We have deployed the application modules on standalone OC4J as stateful EJB session beans.
    The problem is that with each user, the number of database connections seem to increase. This is making the application unscalable, which defeats the purpose of using EJB!
    Can someone please suggest how to limit the number of database conections in this scenario?
    Can this be solved by application module pooling? How can we use the PoolMgr to work with the session beans?
    We have tried to invoke disconnect on the application module after calling methods(using appmodule.disconnect(true)) and reconnect (appmodule.reconnect()) on entering the method. This keeps the number of connections low and works the first time the method is invoked. But subsequently, it gives nullpointerexception when the Row is accessed in the JSP.
    The exception we are getting is :
    java.lang.NullPointerException
         at oracle.jbo.client.remote.ViewUsageImpl.getStructDef(ViewUsageImpl.java:241)
         at oracle.jbo.client.remote.ViewUsageImpl.findAttributeDef(ViewUsageImpl.java:275)
         at oracle.jbo.client.remote.RowImpl.getAttributeIndexOf(RowImpl.java:368)
         at oracle.jbo.client.remote.RowImpl.getAttribute(RowImpl.java:144)
         at Supplier.client.ejb.beanmanaged.SupplierAM_IntPaymtVORowBeanManagedClient.getMdid(SupplierAM_IntPaymtVORowBeanManagedClient.java:63)
         at supplier.sccPayCheq._jspService(_sccPayCheq.java:102)
         [SRC:/Supplier/sccPayCheq.jsp:44]
    The Application module configuration (in bc4j.xcfg) is:
    <AppModuleConfig name="SupplierAM9iAS">
    <AppServerConnectionName>StandaloneOC4JConnection</AppServerConnectionName>
    <AppModuleJndiName>Supplier.SupplierAM</AppModuleJndiName>
    <java.naming.security.credentials>admin</java.naming.security.credentials>
    <DeployPlatform>EjbIas</DeployPlatform>
    <java.naming.security.principal>admin</java.naming.security.principal>
    <DtMiddleTierDeploymentProfile>ProjectMiddleTier.deploy</DtMiddleTierDeploymentProfile>
    <ApplicationName>Supplier.SupplierAM</ApplicationName>
    <DtDeploymentProfile>ProjectEJB.deploy</DtDeploymentProfile>
    <DtCommonDeploymentProfile>ProjectCommon.deploy</DtCommonDeploymentProfile>
    <JDBCDataSource>jdbc/ConnectionCoreDS</JDBCDataSource>
    <jbo.server.internal_connection>jdbc/ConnectionCoreDS</jbo.server.internal_connection>
    <jbo.ejb.txntype>local</jbo.ejb.txntype>
    <jbo.doconnectionpooling>true</jbo.doconnectionpooling>
    <ApplicationPath>ProjectEJB</ApplicationPath>
    </AppModuleConfig>
    The Datasource used (in $ORACLE_HOME/j2ee/home/config/data-sources.xml) is:
    <data-source
              class="oracle.jdbc.pool.OracleConnectionCacheImpl"           connection-driver="oracle.jdbc.driver.OracleDriver"
              ejb-location="jdbc/ConnectionDS"
              inactivity-timeout="30"
              location="jdbc/ConnectionCoreDS"
              name="ConnectionDS"
              password="*******"
              pooled-location="jdbc/ConnectionPooledDS"
              url="jdbc:oracle:thin:@<IPADDESS>:<SID>"
              username="USER"
              xa-location="jdbc/xa/ConnectionXADS"
              max-connections="5"
              min-connections="1"/>

    Can this be solved by application module pooling? How
    can we use the PoolMgr to work with the session
    beans?You can use a stateless checkout/checkin appmodule.
    Take a look at the following help topics which explain this in good detail.
    "About Application Module Pooling"
    "About JSP Pages and Application Module Pooling"
    The pool can help reuse the appmodule instance across requests thus reducing the number of concurrent db sessions.
    Dhiraj

  • JAAS Authorization - Application Module

    I created a project based on the BC4J technology. The application module is configured for using the security : jbo.security.enforce=Must. This application module is also configured to deploy the user/password.
    When I used this application through a web application, I don't meet any problem.
    If I create a POJO class in the same project as BC4J in which I instantiate an instance in the application module pool, I receive the following message :
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-33021: Failed authenticate user null.
    The java class in charge of instantiating the application module pool and get an instance of it works without any problem as soon as the security is not implemented.
    Hereafter you can find the method used :
    public ApplicationModule getApplicationModule()
    try{
    PoolMgr poolMgr = PoolMgr.getInstance();
    this.lg_ApplPool = poolMgr.findPool( this.lg_configPackage + "." + this.lg_configName, // name of the pool
    this.lg_configPackage, // name of the package
    this.lg_configName, // name of the configuration
    null);
    // SessionCookie Creation
    String timeStamp = (new java.util.Date()).toString();
    // for web application, replace timeStamp by ip address of the client
    this.lg_Cookie = lg_ApplPool.createSessionCookie(this.lg_applicationId,timeStamp,null);
    CordaEnvInfoProvider lEnvInfoProvider = new CordaEnvInfoProvider ("xxx","xxx");
    // this.lg_Cookie = lg_ApplPool.createSessionCookie(this.lg_applicationId,timeStamp,null);
    this.lg_Cookie.setEnvInfoProvider(lEnvInfoProvider);
    ApplicationModule lAM = this.lg_Cookie.useApplicationModule();
    return lAM;
    catch(Exception e)
    System.out.println("_CrdAppModulePoolMgr - exception : " + e.getMessage());
    e.printStackTrace();
    return null;
    After Having search quite a long time to find a solution, I have no more idea. The only thing I see now is to forget about Jaas if the application module has not to be used by a Java client not being a JClient (Swing) or a Web application.
    Could you let me know if
    1. jaas works with java client not being Swing or web application
    2. if so, could you give me more information about how to work with BC4J application module and security enforce to Must ?
    N.B.
    POJO Client :
    public class TestAppModulePoolMgr
    private ApplicationModule lg_Am = null;
    private CrdAppModulePoolMgr  lgCrdAppModulePoolMgr = null;
    private ApplicationPool lg_ApplPool = null;
    private SessionCookie lg_Cookie = null;
    public TestAppModulePoolMgr()
    this.lg_CrdAppModulePoolMgr = _CrdAppModulePoolMgr.getCrdAppModulePoolMgr();
    this.lg_CrdAppModulePoolMgr.setApplicationId("CrdGenerationAppModuleId");
    this.lg_CrdAppModulePoolMgr.setConfigName("_CrdGenerationAppModuleLocal");
    this.lg_CrdAppModulePoolMgr.setConfigPackage("CORDA_BSV");
    this.lg_Am = lg_CrdAppModulePoolMgr.getApplicationModule();
    this.lg_ApplPool = lg_CrdAppModulePoolMgr.getApplicationPool();
    this.lg_Cookie = lg_CrdAppModulePoolMgr.getApplicationSessionCookie();
    * @param args
    public static void main(String[] args)
    TestAppModulePoolMgr testAppModulePoolMgr = new TestAppModulePoolMgr();
    }

    Thank you.
    I use SSO authentication to test my application so have no users defined.
    Can I use the test-all user? If so, what is the password?

  • View link between VO from two application modules

    Is it possible to create view link between VOs from 2 different Application modules?

    Here is what it says:
    SymptomsYou have an ADF BC (BC4J) project and you are getting the following error:
    oracle.jbo.domain.Number; local class incompatibleA more detailed error looks similar to:
    oracle.jbo.domain.Number; local class incompatible: stream classdesc
    serialVersionUID = -7171468674200794918, local class serialVersionUID =
    -6507359405709672486
    CauseThis problem is caused by either that:
    You have inadvertently mixed two mutually exclusive domain libraries like "BC4J Generic Domains" (bc4jdomgnrc.jar) and "BC4J Oracle Domains" (bc4jdomorcl.jar).
    or
    You have added the "BC4J Datum" library (bc4jdatum.jar) to your middle-tier class path, and are trying to use a JDBC driver different from the one that ships with JDeveloper 10g in the box.
    The BC4J Generic Domains and the BC4J Oracle Domains are never meant to be used in the same application classpath. They contain different implementations of the same set of classes, one destined for use in Oracle JDBC driver environments, and the other for use with other non-Oracle JDBC drivers.
    The BC4J Datum library is designed for use in a thin-client Classpath that is remotely accessing an ADF Business Components middle tier deployed as an EJB Session bean. It contains only the domain classes (typically jar'ed up as part of the whole Oracle JDBC Driver JAR) without having to have the rest of the JDBC Driver JAR on the thin client. SolutionPlease check if any of the above suggested scenarios is applicable to your application.
    If you have the BC4J Generic Domains and the BC4J Oracle Domains in the same project despite that they are never meant to be used in the same application classpath you will get this error. They contain different implementations of the same set of classes, one destined for use in Oracle JDBC driver environments, and the other for use with other non-Oracle JDBC drivers.
    Goto the Project Properties for you project.
    Select Profiles -> <Profile Name> -> Libraries
    Check in the Selected list (to the right) if you have both BC4J Generic Domains and the BC4J Oracle Domains there. If so, remove the one not appropriate for your project.

  • Call an Application Module deployed as EJB into JServer from a client

    Hi all,
    I've successfully deployed a BC4J Application Module as EJB Session Bean into Oracle8i 8.1.6.
    The deployment descriptor (file LoginModule.dd) starts with the foolowing lines:
    Session Bean ricercalista.server.ejb.LoginModuleServerEJB
    BeanHomeName = "/test/omero/ejb/ricercalista.LoginModule";
    HomeInterfaceClassName = ricercalista.common.ejb.LoginModuleHome;
    RemoteInterfaceClassName = ricercalista.common.ejb.RemoteLoginModule;
    The client code that calls the EJB is:
    import oracle.jbo.*;
    import java.util.Hashtable;
    import javax.naming.*;
    import oracle.jbo.JboContext;
    import ricercalista.common.*;
    import ricercalista.common.ejb.*;
    import ricercalista.UserProfile;
    public class ProvaEJBLogin {
    public static void main(String[] args) throws Exception {
    final String AMDefName = "ricercalista.LoginModule";
    final String Username = "omero";
    final String Password = "omero";
    final String DBUrl = "jdbc:oracle:thin:omero/omero@localhost:1521:OMERO";
    try {
    Hashtable env = new Hashtable(10);
    env.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_ORACLE8I);
    env.put(JboContext.HOST_NAME, "bacco08.csr.unibo.it");
    env.put(JboContext.CONNECTION_PORT, "2481");
    env.put(JboContext.ORACLE_SID, "OMERO");
    env.put(JboContext.APPLICATION_PATH, "test/omero/ejb");
    env.put(JboContext.SECURITY_PRINCIPAL, Username);
    env.put(JboContext.SECURITY_CREDENTIALS, Password);
    Context ic = new InitialContext(env);
    LoginModuleHome home = (LoginModuleHome) ic.lookup(AMDefName);
    LoginModule myejb = (LoginModule) home.create();
    myejb.getTransaction().connect(DBUrl, Username, Password);
    myejb.setUser("turronic", "chris");
    System.out.println((String) myejb.getCognome());
    System.out.println((String) myejb.getNome());
    UserProfile up = myejb.getUserProfile();
    for (int i = 0; i < up.size(); i++) {
    System.out.println("dominio = " + up.getCodeDomain(i) + " grado = " + up.getInterestDegree(i));
    myejb.getTransaction().disconnect();
    myejb.remove();
    catch (NamingException ne) {
    System.out.println("Unable to find application " + AMDefName);
    ne.printStackTrace();
    catch (ApplicationModuleCreateException e) {
    System.out.println("Unable to create application module " + AMDefName);
    e.printStackTrace();
    When I run this client, I find the following error:
    "D:\Program Files\Oracle\JDeveloper 3.1.1.2\java1.2\jre\bin\javaw.exe" -classpath "D:\Program Files\Oracle\JDeveloper 3.1.1.2\myclasses;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbojdbcpatch.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboorasql.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbodatum12.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jdev-rt.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\jdbc\lib\oracle8.1.6\classes12.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\connectionmanager.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbomt.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboremote.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jndi.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\xmlparserv2.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\javax_ejb.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboremoteejb.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora_client.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjorb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjapp.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbohtml.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboo8i.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\jswdk-1.0.1\lib\servlet.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Test.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Jelly.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Juggler.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Misc.jar;D:\Program Files \Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Molecule.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Buttons.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\classgen.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboejb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora_client.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjorb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjapp.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\javax_ejb.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjtools.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbj30ssl.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\sqlj\lib\translator.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboremote.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbo8iclient.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora_client.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjorb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjapp.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jndi.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbodatum12.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\java1.2\jre\lib\rt.jar" ricercalista.ProvaEJBLogin
    Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
    Unable to find application ricercalista.LoginModule
    [Root exception is java.lang.ClassNotFoundException: ricercalista.common.ejb.LoginModuleHomeHelper]javax.naming.NamingException: Unknown reasons
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.initRemoteHome()
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.<init>(oracle.jbo.JboContext, java.lang.String)
    oracle.jbo.common.JboHome oracle.jbo.client.remote.corba.aurora.AuroraInitialContext.createJboHome(java.lang.String)
    java.lang.Object oracle.jbo.common.JboInitialContext.lookup(java.lang.String)
    java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
    void ricercalista.ProvaEJBLogin.main(java.lang.String[])
    What's wrong in my code? Are the Context Properties set correctly? The test on this Application Module works fine. So what's the problem?
    I need your help!
    Tnx!
    null

    I've added libraries LoginModuleEJBClient.jar and EJBGenerated.jar to the client project.
    The error isn't the same, but the following:
    Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
    Unable to find application ricercalista.LoginModule
    javax.naming.NamingException. Root exception is java.lang.ClassCastException
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.initRemoteHome()
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.<init>(oracle.jbo.JboContext, java.lang.String)
    oracle.jbo.common.JboHome oracle.jbo.client.remote.corba.aurora.AuroraInitialContext.createJboHome(java.lang.String)
    java.lang.Object oracle.jbo.common.JboInitialContext.lookup(java.lang.String)
    java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
    void client.LoginClient.<init>()
    void client.LoginClient.main(java.lang.String[])
    Why is there a ClassCastException?
    Tnx in advance for your help.

  • Obteain connection object from application module

    Hello
    I am working with ADF 10g using BC4j , I am in application module implementation class, how can I obtain the java.sql.connection object used by my application module?

    to execute prepared statements follow
    http://download-uk.oracle.com/docs/html/B25947_01/bcadvgen005.htm#sm0297
    to access the SQL connection itself (for whatever reason)
    Re: how to get connection from adf bc?
    Frank

Maybe you are looking for

  • Hi all, I got problem with my Safari!?

    Hi all, I got problem with my Safari, same with Google Chrome, when trying to block pops-up. It's already ticked on BLOCK but everytime i click on new link, an annoyed pop-up appeared (game online, Mackeeper ...), any advice?

  • I do not like the new Smart Print, How can I get the previous Smart Web Print?

    Win 7 home ed. I have 3 computers. On one I have Smart Web Print.  It works great and is easy.  When I added the 3rd computer I was unable to get that feature and was given Smart Print.  I hate it.  It takes more steps and thn I don't always what I w

  • User authentication for menus..

    Hi Everyone, I am doing a project for my office to maintain inventory, I want to implement user rights for the menus.. I would appreciate if any help me out... Thanks in advance.. Regards, Irsath Ahamed.

  • Gamma shift  from After Effects

    Hi, We had to apply graphic work over a QuickTime Uncompressed 8 bit footage from Final Cut Pro. The graphic work was done in After Effects. The After Effect output was done using QuickTime Uncompressed 8 bit, the very same codec. ...but all the foot

  • Error trying to check whether the job will be importing

    Hi, I am getting the below message error when I try to upload the data through webADI,is there any limit for loading the records that we can upload using web ADI? we tried to load near to 10,000 records and it's giving me an error on window and gets