Skip to Content
avatar image
Former Member

Problem wiht GP and Web Dynpro Java

Hi,

I am using one WDJ component to use another WDJ component via the component interfaces. The component being used contains references to EJBs via JNDI Names that I have given.

This will run perfectly when I am calling one component via another inside the WDJ Framework. However, when I try to call the component containing the EJB reference via Guided Procedures - I get a ClassCastException on the line where I have looked up the bean.

The erroneous statement is:

BeanHome home = (BeanHome) new InitialContext().lookup("BeanJDNIName);

I have tried using the narrow() as well - but I get the same result.

I have added the Sharing References to the Bean in both Components.

Any ideas?

Thanks.

p256960

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 29, 2008 at 10:30 AM

    Hi ,

    try this code in wrapper class bean

    
    import com.sap.<ejb project>.<sessionBeanLocal>;
    import com.sap..<ejb project>.<sessionBeanLocalHome>;
    
    
     <SessionBeanLocal>  thecalc = null;
    		< SeesionbeanLocalHome>  Home = null;
    
    InitialContext ctx = new InitialContext();
    			// get ejb home 
    			Home =
    				(<sessionBeanLocalHome>) ctx.lookup(
    					"localejbs/<JNDI name of sessionBean");
    			thecalc = Home.create(); 

    hpe it hlps u

    Regards,

    khushboo

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I separated the one statement out into two as follows:

      Object obj = ctx.lookup("JNDIName");

      EJBHome home = (EJBHome) obj;

      But now I get a ClassCastException on the second statement.

      So apparently the Framework is able to lookup the bean using JNDI - although it is unable to cast it into the Home interface.

      Just to refresh - I am able to perform the casting when my component is called directly.

      And I get an Exception when the same componenet is called via GP.

      Any ideas?

      Thanks.

      p256960

      P.S.: Tried wiht localejbs/JNDIName - but that doesnt resolve the issue.

  • avatar image
    Former Member
    Oct 06, 2008 at 04:06 PM

    resolved this one after some research

    Add comment
    10|10000 characters needed characters exceeded