ClassCastException while using session bean in OC4J

I am facing the same problem while deploying a stateless session bean in Oracle 9i AS 1.0.2.2.1. The details are given below.
The following code snippet is used in the client to prepare for the lookup:
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");
//the following line can also have the actual machine name instead of "localhost"
env.put(Context.PROVIDER_URL, "ormi://localhost:23893/myejbs");
Context ctx = new InitialContext(env);
System.out.println("Getting Home....");
Object obj=ctx.lookup("Grouping");
System.out.println("Home Object Is : "+obj);
GroupingHome groupingHome = (GroupingHome)obj;
System.out.println("Got Home");
Grouping grouping = groupingHome.create( );
graphs=grouping.<mehtods>();
I've edited the config/server.xml file to have the following line:
<application name="myejbs" path="C:\oracle\ora102\j2ee\home\applications\classes\myejbs" auto-start="true" />
which points to the directory where the class files reside
I've also change the port in the config/rmi.xml file to 23893.
Now... the problem that I am facing is - while I am running a client from outside the server JVM i.e standalone client... which uses the Grouping interfaces, it works fine. giving me the desired result. But the moment I place the code in a service client deployed in the server or a jsp, I get a ClassCastException for GroupingHome whereas the SOP that I have given after lookup shows that I have found - "Grouping EJBHome". The funny thisng is that bith the working client and the JSP are using sme set of interface class files - Grouping.class (Remote) and GroupingHome.class.
Where am I going wrong?? If anybody knows, or Giri has found an answer to his query... please post a reply.
Thanks.
PS: I've tried new InitialContext(); solution but it didn't work. I have also narrowed the home object with javax.rmi.PortableRemoteObject.narrow(obj,GroupingHome.class) but to no avail :(.

Hi Gauarv,
Did you not see my reply in the following post?
Re: 502 service temporarily unavailable
If I'm not mistaken, this is exactly the same question as you asked
there.
By the way, is there some reason you are still using OC4J version
1.0.2.2? Is there something stopping you from upgrading to the later
versions (9.0.2 and 9.0.3)?
Good Luck,
Avi.

Similar Messages

  • Is it possible to connect database using session bean

    Dear all,
    Is it possible to connect database using session bean without using entity beans like cmp,bmp.
    if ur answer is yes, then pls tell me where to put the select statement and transaction attribute like(6 types).
    if u have sample code, then it is good for me.
    Hope I will get answer.

    Sure it is.
    Try something like this (and maybe get a book on JDBC):
    String name;
    try {
         InitialContext ic = new InitialContext();
         DataSource ds = (DataSource) ic.lookup(Constants.MY_DATASOURCE);
         Connection connection = ds.getConnection();
         String sql = "SELECT * FROM TABLE";
         PreparedStatement statement = connection.prepareStatement(sql);
         ResultSet rs = statement.executeQuery();
         while (rs.next()) {
              name = rs.getString("NAME");
         if (rs != null)
              rs.close();
         if (statement != null)
              statement.close();
         if (connection != null)
              connection.close();
    catch (NamingException e) {
         // Can't get JDBC datasource
         // ... do something with this exception
    catch (SQLException e) {
         // SQL exception from getter
         // .... do seomthing with this one too
    }

  • Can I connect with Database using Session Bean

    Hi,
    I am new to EJB. I have small doubt.
    can I connect with Database using Session Bean.
    Regards,
    Murali.

    Double post of http://forum.java.sun.com/thread.jspa?threadID=687239&tstart=0

  • Using Session Beans on a read only database

    Hi,
    i am working on a weblogic 6.1 server and have to access a read only database
    using session beans. The transaction attributes of all session beans (we are using
    no entity beans) are set to NOT_SUPPORTED but every time a method is accessed
    an error message is thrown
    BEGIN TRANS in read only database .....
    Is there a way to avoid this?
    Regards
    Edmund

    I guess it is NotSupported. If not try Never.
    --Jay   
    www.architectslobby.org
    An exclusive community for Enterprise Architects

  • Using BC4J Session Bean in OC4J 10.1.3 with dynamic ports

    Hi Folks!
    I've benn having trouble connecting my BC4J Session Bean to an Oracle 10gAS R3 server instance tha uses dynamic ports.
    After migrating a BC4J/Struts/JSP application from 9iAS to 10gAS R3, I'm trying to connect from a client application to my instace in the server. The problem is that the instance uses dynamic ports, and whenever I deploy my application to the server, I've got to update the port number in the bc4j.xcfg file in the client application, wich has became impossible to maintain.
    When I connect to an EJB in the same server, I use the instance name instead of the port number. However, when I do the same with BC4J, I get the following exception:
    javax.naming.NamingException [Root exception is java.lang.NumberFormatException: For input string: "OC4J_dvt20"]
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.remoteLookup(AmHomeImpl.java:131)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.getRemoteApplicationModuleHome(AmHomeImpl.java:42)
         at oracle.jbo.client.remote.ejb.AbstractApplicationModuleHomeImpl.lookupUsingPlatformContext(AbstractApplicationModuleHomeImpl.java:82)
         at oracle.jbo.client.ejb.ApplicationModuleHomeImpl.<init>(ApplicationModuleHomeImpl.java:52)
         at oracle.jbo.client.remote.ejb.AbstractApplicationModuleHomeImpl.<init>(AbstractApplicationModuleHomeImpl.java:35)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.<init>(AmHomeImpl.java:35)
         at oracle.jbo.client.remote.ejb.ias.InitialContextImpl.createJboHome(InitialContextImpl.java:28)
         at oracle.jbo.common.JboInitialContext.lookup(JboInitialContext.java:77)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:136)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:80)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:2468)
         at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:536)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2094)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1961)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2793)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419)
         at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1546)
         at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1504)
         at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1476)
         at pkg.TesteEjbMCT.findTLS(TesteEjbMCT.java:98)
         at pkg.TesteEjbMCT.main(TesteEjbMCT.java:51)
    My question is: is there a way to configure my bc4j.xcfg, or another way to connect, in order to skip the use of the port number? Or a way to get the port number from the server before I connect?
    Thanks in advance!!!

    I've just found the solution from Steve Muench weblog, always useful by the way!
    You can find the solution at this link http://radio.weblogs.com/0118231/stories/2004/05/07/handcodingDynamicDiscoveryOfEjbdeployedAppmodule.html
    In summary, we need to use the class com.evermind.server.rmi.RMIInitialContextFactory, which supports dynamic lookup, and implement the lookup ourselves.
    The code I've written to lookup the service is listed below:
    public static ApplicationModule getAppModuleManutencao() {
    try {
    Context ctx = getContext();
    ManutencaoFacadeHome home = (ManutencaoFacadeHome) ctx.lookup(EJB_MANUTENCAO_BEAN_NAME);
    ApplicationModule am = ApplicationModuleProxy.create(home, null);
    return am;
    } catch (NamingException nex) {     
    nex.printStackTrace();
    return null;
    private static InitialContext getContext() {   
    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, "opmn:ormi://dsv008:OC4J_dvt20/mct");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    return new InitialContext(env);
    }catch (NamingException e) {     
    e.printStackTrace();
    return null;
    I hope this helps someone!!!
    Cheers!

  • Cant able to get the output while using session scope

    Hi
    I am using jdeveloper 11.1.1.5
    As i posted in the previous post i had made some changes still i am not getting proper output
    These are steps that i had followed for developing login page
    1.I had created a TaskFlow in adfc-config.xml such that if the login is success it navigates to the other page pls verfiy the link
    http://www.4shared.com/photo/5PNrf1hd/E028_2.html
    2.I had also changed the scope to session in adfc-config.xml
    http://www.4shared.com/photo/HtVVOw_B/E029.html
    3.This was my Welcome.jspx code
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" binding="#{sessionScope.backing_welcome.d1}">
          <af:form id="f1" binding="#{sessionScope.backing_welcome.f1}">
            <af:inputText label="UserName" binding="#{backing_welcome.it1}"
                          id="it1" value="#{sessionScope.backing_welcome.auser}"/>
            <af:inputText label="Password" binding="#{backing_welcome.it2}"
                          id="it2"
                          value="#{sessionScope.backing_welcome.apassword}"/>
            <af:commandButton text="Login"
                              binding="#{backing_welcome.cb1}" id="cb1"
                              action="#{backing_welcome.cb9_action}"/>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_welcome-->
    </jsp:root>3.This was my welcome.java backing bean for welcome.jspx page
        public String getAuser() {
            return auser;
        public void setApassword(String apassword) {
            this.apassword = apassword;
        public String getApassword() {
            return apassword;
        public String cb9_action() {
            String returnStr="error";
            System.out.println("Inside loginBtn_action");
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("checkLoginCredentials1");
            operationBinding.getParamsMap().put("p_user", auser);
            operationBinding.getParamsMap().put("p_pwd", apassword);
        operationBinding.execute();
        Object result = operationBinding.execute();
        if (!operationBinding.getErrors().isEmpty()) {
            returnStr= "success";
        System.out.println("returnStr= " + returnStr);
               return returnStr;
        }While i run my program no output is displayed!! No logs also been recorded!!
    Could any body pls help me!!

    thank you jhon!
    If i am not using any binding i m getting error as
    javax.el.PropertyNotFoundException: Target Unreachable, 'backing_welcome' returned nullI had used this jspx code
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" >
          <af:form id="f1" >
            <af:inputText label="UserName"
                          id="it1" value="#{sessionScope.backing_welcome.auser}"/>
            <af:inputText label="Password"
                          id="it2"
                          value="#{sessionScope.backing_welcome.apassword}"/>
            <af:commandButton text="Login"
                               id="cb1"
                              action="#{sessionScope.backing_welcome.cb9_action}"/>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_welcome-->
    </jsp:root>Give me some guide how to use session scope!! Since i read all the documents i m not getting any proper output

  • Deploying EJB 3 session beans on OC4J 10.1.3.0.0 Standalone

    Guys,
    I am unable to deploy any EJB 3.0 session beans on my freshly installed OC4J 10.1.3.0.0 instance. I also have tried to deploy the EAR created by the "Develop a Stateless Session Bean using EJB 3.0" to eliminate problems in the deployed archive, but itfails with the exact same stacktrace:
    06/06/05 14:38:52 SEVERE: ProgressObjectImpl.reportError java.lang.InstantiationException: Error initializing ejb-module
    s: nested exception is: java.lang.reflect.InvocationTargetExceptionoracle.oc4j.admin.jmx.shared.exceptions.InternalExcep
    tion: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.reflect.Invocatio
    nTargetException
    at oracle.oc4j.admin.jmx.shared.deploy.NotificationUserData.<init>(NotificationUserData.java:107)
    at oracle.oc4j.admin.internal.Notifier.reportError(Notifier.java:429)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:123)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:819)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Error initializing ejb-module
    s: nested exception is: java.lang.reflect.InvocationTargetException
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126)
    ... 4 more
    Caused by: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.reflect.Invo
    cationTargetException
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1056)
    at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:210)
    at com.evermind.server.Application.setConfig(Application.java:391)
    at com.evermind.server.Application.setConfig(Application.java:308)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1771)
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:507)
    at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:191)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    ... 4 more
    Caused by: javax.ejb.EJBException: nested exception is: java.lang.reflect.InvocationTargetException
    at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:352)
    at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:343)
    at com.evermind.server.ejb.POJOEntityAnnotationListener.parseAnnotatedClass(POJOEntityAnnotationListener.java:56
    at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:197)
    at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:69)
    at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:964)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:831)
    ... 11 more
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.evermind.server.ejb.POJOEntityAnnotationListener.parseAnnotatedClass(POJOEntityAnnotationListener.java:48
    ... 15 more
    Caused by: java.lang.NullPointerException
    at java.lang.Class.getAnnotation(Class.java:2956)
    ... 20 more
    Also, and this is probably related, when starting up it the app server prints:
    6-06-05 14:38:51.777 WARNING J2EE EJB5003 EJB 3.0 enabled but JDK 1.5 is not in use. No annotations will be parsed.
    Which is not true as I am running JDK 5.0_6 and I have tested/validated this by deploying a working (working as in putting stuff in and pulling stuff out of a db) EJB 3.0 Persistence project in there, which uses annotations.
    I really hope somebody on the OC4J team can help me out on this, as I am guessing a lot of people will run into this.
    Kind regards,
    Mik

    Well, I think I at least isolated the problem:
    My installation was not as fresh as I thought. It had to do with my trying to get the latest version of TopLink (the final EJB 3.0 RI one) running on the latest OC4J standalone. For this I deleted the j2ee/home/persistence.jar and replaced it by toplink-essentials.jar. I apparently misjudged the differences that occured in the last steps of the EJB 3 specs.
    So let me rephrase my question: is there a way to get the latest version of TopLink (the one packaged as the EJB3 Persistence RI) in the OC4J 10.1.3.0 Standalone container? And if not, when will there be one?
    Mik

  • ClassCastException while using @NamedStoredProcedureQuery

    Hi,
    I'm doing some testing with the TopLink JPA extensions and I'm getting a ClassCastException when executing a stored procedure. The procedure gets executed though.
    The procedure is called testjeroen2 in the jeroen package and uses an IN parameter that is an empno.
    The entitybean:
    @Entity
    @NamedStoredProcedureQuery(
    name = "remove_employee",
    procedureName = "jeroen.testjeroen2",
    returnsResultSet = false,
    procedureParameters = {
    @StoredProcedureParameter(queryParameter = "employee_id")
    public class EmpRs {
    private int empno;
    @Id
    public int getEmpno() {
    return empno;
    public void setEmpno(int empno) {
    this.empno = empno;
    My unit test:
    public void testSp() throws Exception {
    EntityManager em = emf.createEntityManager();
    Query query = em.createNamedQuery("remove_employee");
    query.setParameter("employee_id",5558);
    query.getResultList(); //oracle.jdbc.driver.T4CPreparedStatement cannot be cast to java.sql.CallableStatement
    // query.getSingleResult(); //oracle.jdbc.driver.T4CPreparedStatement cannot be cast to java.sql.CallableStatement
    // query.executeUpdate(); //You cannot call executeUpdate() on this query. It is the incorrect query type.
    To execute the query I use the getResultList method and tried the getSingleResult and executeUpdate method. I put the errors I got in the comments next to the lines of code I tried.
    Is getResultList the preferred way to execute a stored procedure?
    Thanks for your help!
    Jeroen van Wilgenburg

    thanx mate for the reply,
    i am sure that i am storing the same object in the vector.
    first of all I tried the same code by writing small class same as yours & it worked fine so i implemented in my real implementation class. But it still gives me classCastException i am not able to understand it why???? Actually my Product class is a stateless session bean(hope u know EJB)
    so actually i am storing a remote reference i.e(product)in my vector.But i dont think this should be a problem...
    please help....
    regards,
    ashish

  • How can i design a EJB application using session Beans?

    Hello,
    I am designing a Find application using EJB. Here a user is prompted a search page, where he can enter the search criteria's. Then on click of submit, the query is formed at the server side depending on what criteria's were selected. Then a jdbc query is performed and the results are returned back to the user. Here no session is maintained for the users. Can anyone suggest me how to design this application using EJB. Should i use entity beans for this or session beans will suffice? Should the jdbc query be performed in the bean itself or should it be outside in a helper class? Please kindlu suggest me the design for this application...
    Regards,
    Subbu

    Hi,
    First of all, I'm unable to figure out why you need to use EJB for this scenario. You can write a helper class to frame and execute the query.
    If you really want to use EJB, then I suggest you use a stateless Session Bean with transaction attribute as TX_NOT_SUPPORTED. From the session bean, you can call the helper class. But, by avoiding the session bean, you can eliminate remote calls, thus improving your performance. Also, check if the database & the db driver you are using supports sql caching.
    Regards,
    Raj.

  • Run time error while running Session Bean sample

    Hi,
    I am new to EJB. When I try to run one sample session bean, I am getting following exeception.
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:292)
         at javax.naming.InitialContext.lookup(InitialContext.java:359)
         at RunEJB.main(RunEJB.java:31)
    Exception in thread "main"
    This exception is thrown by client project. naming.jar file is already include in the class for Client project as well.
    I am testing this sample on WSAD.
    The code on the client is as follows.
              Context initial = new InitialContext();
              Context myEnv = (Context)initial.lookup("java:comp/env");
              Object objref = myEnv.lookup("ejb/MyTestBeanHome");
              MyTestBeanHome home =
                (MyTestBeanHome) PortableRemoteObject.narrow(objref, MyTestBeanHome.class);
              MyTestBean firstBean = home.create(); 
              firstBean.testMessage();
              firstBean.remove();

    Hi Vikas,
    The fact that this client is coded to use java:comp/env means it's a J2EE Application Client component. Application Clients are full-fledged J2EE components that run within an Application Client container. You'll need to consult the documentation for your J2EE implementation to see how to invoke its Application Client container.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Issue with Webservice Creation using Session Beans.

    Hi All,
    I want to expose my Session beans as webservice.
    I'm using Weblogic Application Server.
    When I do the modeling using JDeveloper, I'm unable to convert the Session bean to webservice.
    Any information on this is highly appreciable.
    Thanks & Regards,
    Kumar Madhavan.

    I can't give you much of a walk through, as I have just started it myself, but I'm using a universal unique identifier to represent each client. Whenever a client posts data from a jsp or applet the uuid is also sent. I use POST to pass all my parameters. If the server hasen't received data in say 5 minutes from the client then it is assumed the client went offline. Its working for me so far.
    COn

  • Using session bean in JSP

    Dear All
    I write a BorrowList session bean and tested OK in console mode. I can't use it in the JSP, Dose any body tell me How can I create this bean in the JSP and when should I place the bean classes(Home, Bean and Remote).
    I'm now using the BEA Weblogic 7.0
    I'm appreicate if anybody can help me.
    Best Regards
    YU

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

  • TX isolation level with stateless session bean in oc4j

    Hi All,
    I have a stateless session bean with container managed transaction method. This method is called in a Servlet. This method retrieves data from database using 'ejb-location'connection pool and closes the connection inside. Max-connection setting for connection pool is 50
    I am facing a problem running servlet multiple times.
    When i have the tx_attribute as Supports, it works fine. I can run the servlet hundreds of times
    But when i have the tx_attribute as Required, i am able to run servlet only 50 times and further it says 'Max connection limit exceed..unable to get the connection'.
    I assume that with 'Required' attribute, it starts a transaction. Why is the transaction not getting completed at end of method? Is transaction hanging somewhere?
    I assume that i am closing the connection properly as it is working fine with supports attribute.
    When i monitor database, there are only 20 connections.
    Why am i seeing this behaviour?
    Thanks
    srinath

    Hi Deepak,
    Thanks for your reply.
    Actually, our stand alone java application already using spring-hibernate feature. Now we are planning divide our application into modules and deploy each module as ejb beans. As it is already integrated with spring-hibernate we are not using entity beans as of now. My understanding is container uses some default transcation management .so, my question is what are all the configurations needs to be done to let weblogic 10.0 server uses org.springframework.orm.hibernate3.HibernateTransactionManager. I mean, is there are any .xml file in weblogic to configure all these? please reply deepak I am struck here..
    Regards,
    Rushi.

  • Example of using session bean with webservices

    Hello,
    I am working with netbeans 5.5 (with JAX-WS 2.0 library) and using Tomcat.
    I have created webservices and everything is working well so far. However, each webservice is making a connection to my database.
    I would like to use a session bean so that I make the connection only once (at the begining of the client session for example) and store it into my session bean.
    I am a newbie in those things, I search on the Web and on this forum some code examples. The only thing I have found is this article http://weblogs.java.net/blog/ramapulavarthi/archive/2006/06/maintaining_ses.html
    When I tried this, the session doesn't seem to work at all : I get the same result (counter=1) twice.
    Does anybody have a complete example of how to use a session with webservices please?
    Thanks a lot!

    Sorry, I was not very clear in my last message.
    I need all my webservices to share the same bean during one user session.
    Then, if a page calls 2 different web services, only 1 database connection is made instead of 2. And if the user opens other pages which call other webservices, they will use the connection kept into the session bean.
    Anyway, I tried to do like it is said in your website but I can not build my project. I have an error : java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/.../build/web/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. I do not understand because I have downloaded the jax-ws 2.1.1 api and no other libraries are imported in my project. :-(
    I wonder if it is not related to netbeans...

  • How to deploy a BC4J application as a Session Bean to OC4J?

    I want to deploy a BC4J application as an Session Bean to Oracle9iAS Containers for J2EE instead to the 9iAS-DB (= Oracle8i database). How to package the EJB JAR(s), EAR(s), Client JAR(s) ...???
    The main question is: Is it generally possible to deploy/run a BC4J application as an Session Bean to/on Oracle9iAS Containers for J2EE???

    One of the cool things about BC4J framework is the way you can deploy the BC4J application.
    The BC4J application is independent of the deployment mode.
    Irrespective of which mode you actually deploy the applicaiton, you would still get all the framework services.
    It is also easily switchable from one deployment mode to another.
    Today you can decide to deploy it in the local mode and a later stage if you need to deploy it as EJB Session Bean you don't have rewrite your Appplication.
    All you do use the Design Time Wizards for the APplication Module and make it remotable as EJB Session Bean and everything is taken for you.
    BC4J white paper available on technet gives more details
    http://technet.oracle.com/products/jdev/info/techwp20/wp.html
    raghu

Maybe you are looking for