Results 1 to 3 of 3
  1. #1
    mohiit is offline Member
    Join Date
    May 2008
    Posts
    3
    Rep Power
    0

    Question EJB 3 Stateful Application

    Hi all,

    I am having EJB 3 stateful application. Code is shown below

    try {
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
    props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
    InitialContext ic = new InitialContext(props);
    //InitialContext ic = new InitialContext();
    System.out.println("JSP INIT Befor lookup=============");
    //Object obj = (Object) ic.lookup("StatefulCode/AccountBean/remote");
    account = (AccountRemote) ic.lookup("StatefulCode_1/AccountBean/remote");

    //account = (AccountRemote)javax.rmi.PortableRemoteObject.narr ow(obj,AccountBean.class);

    System.out.println("JSP INIT After lookup=============");
    //System.out.println("JSP INIT After lookup test============="+obj.getClass().getName());
    System.out.println("Loaded Account Bean");

    } catch (Exception ex) {
    ex.printStackTrace();
    }

    When I run the application, I am facing

    java.lang.ClassCastException: $Proxy72
    ERROR [STDERR] at org.apache.jsp.ejb3.WebClient_jsp.jspInit(WebClien t_jsp.java:28)
    ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.init(HttpJsp Base.java:51)
    ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getSer vlet(JspServletWrapper.java:158)


    In JBoss, in Global JNDI Namespace it is showing

    +- StatefulCode_1 (class: org.jnp.interfaces.NamingContext)
    | +- AccountBean (class: org.jnp.interfaces.NamingContext)
    | | +- remote (class: java.lang.Object)
    | | +- remoteStatefulProxyFactory (proxy: $Proxy73 implements interface org.jboss.ejb3.ProxyFactory)

    I was not able to solve. Can anyone suggest what can be the possible remedy for this ?

  2. #2
    mohiit is offline Member
    Join Date
    May 2008
    Posts
    3
    Rep Power
    0

    Default Please reply of the above question

    hi,

    Any one can give the answer of above question?

  3. #3
    danielstoner's Avatar
    danielstoner is offline Senior Member
    Join Date
    Apr 2008
    Location
    Canada
    Posts
    191
    Rep Power
    6

    Default

    You have to structure your question in such a way people are able to respond without a huge effort. Put the code between code marks so it is displayed properly. Explain what you want to do. Explain how it fails. Give all the details. Provide compilable code not only a random piece. Doing things this way will improve your chances to get an answer and also maybe to find the answer yourself.

    By the way you have lots of commented lines there. Why? Also you have a smilie in an URL.
    Daniel @ [www.littletutorials.com]
    Language is froth on the surface of thought

Similar Threads

  1. [SOLVED] Invoking a Stateful Session Bean as Stateless
    By JThangiah in forum Enterprise JavaBeans (EJB)
    Replies: 3
    Last Post: 07-17-2008, 09:35 AM
  2. Replies: 0
    Last Post: 02-16-2008, 09:31 PM
  3. Stateful Session Bean
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-29-2007, 12:39 PM
  4. Calling a Stateful Session bean in NetBeans
    By JavaForums in forum NetBeans
    Replies: 0
    Last Post: 07-31-2007, 09:21 AM
  5. Introduction to Stateful Session Bean In NetBeans
    By JavaForums in forum NetBeans
    Replies: 0
    Last Post: 07-31-2007, 09:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •