on 02-07-2008 3:53 AM
I have created jndi in my application in ejb-j2ee-engine.xml
<server-component-ref>
<description>
</description>
<name>AddParametersToLocationService</name>
<type>interface</type>
<jndi-name>/wsclients/proxies/xxx.com/admin~WS/com.xxx.folio.admin.wsproxy.lparam.Proxy</jndi-name>
</server-component-ref>
2.created reference in application-j2ee-engine.xml
<reference reference-type="weak">
<reference-target provider-name="sap.com"
target-type="application">admin~WS</reference-target>
</reference>
When i look up for the class it is throwing classcastexception
XXX service = (XXX) context.lookup("java:comp/env/AddService");
I printed the classname and package name of the returned Object. all are ok
Can anyone guide me to resolve classCastexception
Regards
Ganesan S
Hi Ganesan,
Can you paste your complete code for the client class.
When are you getting this error? while calling EJB or while calling Web Service.
Class cast Exception comes when your referenced object is not equlas or similar to calling object.
Regards,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Piyush, Problem was due to wrong typecast, hence it's thrown classcast exception
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am having public getter/setter methods only .
Few more queries----->
1)In which line are you getting this error?
While Casting the returned object I am getting the Classcastexp
2) are you getting error--
a) while calling EJB
b) or calling WS from EJB
While calling WS from facade
Regards
Ganesan S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This is my lookup code
InitialContext context = new InitialContext();
LOCTN_SERVICE ws_SERVICE =(LOCTN_SERVICE)
context.lookup("java:comp/env/RemoveService");
ServiceResponse serviceResponse =
ws_SERVICE.setLoctnService(z4rLoctnService);
Regards
Ganesan S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ganesan,
Can you check the structure for your class z4rLoctnService.
It should contain only variables name and for each variable, there should be public get/set methods.
eg.
class z4rLoctnService
{
int a;
String b;
public void setA(int a);
public int getA();
// similarly setB() and getB()
And also try including this statement in your code
// Cast object returned by the JNDI lookup to the
// appropriate datatype
home = PortableRemoteObject.narrow(ref, CustomerHome.class);
Few more queries----->
1)In which line are you getting this error?
2) are you getting error--
a) while calling EJB
b) or calling WS from EJB
Regards,
Piyush
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.