cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException

Former Member
0 Kudos

Hi,

Can anyone please tell me why one would get this exception? (Below is just a small snippet).


java.lang.ClassCastException
	at com.sap.tc.webdynpro.progmodel.context.Paths.getAttributeInfoFor(Paths.java:202)
	at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.DropDownByKeyAdapter.setViewAndNodeElement(DropDownByKeyAdapter.java:240)
	at com.sap.tc.webdynpro.clientimpl.html.uielements.adaptmgr.URAdapterManager.getAdapterFor(URAdapterManager.java:231)
	at com.sap.tc.webdynpro.clientimpl.html.uielements.adaptmgr.URAdapterManager.getAdapterFor(URAdapterManager.java:64)
	at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.LabelAdapter.getLabeledControlName(LabelAdapter.java:283)
	at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.LabelRenderer.render(LabelRenderer.java:70)
	at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:285)
	at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:97

Thanks

KG

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi Kunal

Try removing all the imports and organize them again one by one by selecting the appropriate imports.

ClassCastException generally occurs due to unappropriate imports.I have faced a similar problem before. After doing this, if u still have the problem, reply me.

Regards

Vijayakhanna Raman

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kunal-

Can you make sure that the DataSource is still referenced in the table. You might have removed the reference to the DataSource in the view by mistake.

Please let me know if this solves this issue for you.

Hope this helps,

- Vik.

Former Member
0 Kudos

Hi Vik,

Your answer was very close to the solution. I had two dropdowns and had to add a simple type that I had created in the local dictionary to the 'selectedKey' property for the dropdown.

Thanks.

vijayakhanna_raman
Active Contributor
0 Kudos

Hi Kunal

Can u post ur code? The datasource connection should be like this.

try{

InitialContext ctx=new InitialContext();

DataSource ds=(DataSource)ctx.lookup("jdbc/SAPJ2EDB");

Connection con=ds.getConnection();

Statement stmt=con.createStatement();

}catch(Exception e){

wdComponentAPI.getMessageManager().reportSuccess("",+e);

}

Regards

Vijayakhanna Raman