• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

java.lang.ClassCastException

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to deploy my EAR application from JBoss 4.0.1RC1 to JBoss 4.3.0 GA.

When I try to use the Application I get the following message :



2008-08-06 16:07:26,561 ERROR [STDERR] java.lang.ClassCastException
2008-08-06 16:07:26,577 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
2008-08-06 16:07:26,577 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
2008-08-06 16:07:26,577 ERROR [STDERR] at com.fsc.util.ejb.EJBService.lookUpManager(EJBService.java:108)
2008-08-06 16:07:26,577 ERROR [STDERR] at com.fsc.controller.cm.LoginMainAction.findForward(LoginMainAction.java:81)
2008-08-06 16:07:26,577 ERROR [STDERR] at oracle.adf.controller.struts.actions.DataAction.findForward(DataAction.java:565)
2008-08-06 16:07:26,577 ERROR [STDERR] at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:164)
2008-08-06 16:07:26,577 ERROR [STDERR] at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:222)
2008-08-06 16:07:26,577 ERROR [STDERR] at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:153)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
2008-08-06 16:07:26,577 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2008-08-06 16:07:26,577 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2008-08-06 16:07:26,577 ERROR [STDERR] at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
2008-08-06 16:07:26,577 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2008-08-06 16:07:26,592 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2008-08-06 16:07:26,592 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
2008-08-06 16:07:26,592 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2008-08-06 16:07:26,592 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
2008-08-06 16:07:26,592 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
2008-08-06 16:07:26,592 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
2008-08-06 16:07:26,592 ERROR [STDERR] Caused by: java.lang.ClassCastException: $Proxy2079 cannot be cast to org.omg.CORBA.Object
2008-08-06 16:07:26,592 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
2008-08-06 16:07:26,592 ERROR [STDERR] ... 34 more
2008-08-06 16:07:26,655 WARN [org.apache.struts.action.RequestProcessor] Unhandled Exception thrown: class java.lang.NullPointerException
2008-08-06 16:07:26,686 ERROR [org.apache.catalina.core.ContainerBase] Servlet.service() for servlet action threw exception
java.lang.NullPointerException
at com.fsc.controller.cm.LoginMainAction.findForward(LoginMainAction.java:82)
at oracle.adf.controller.struts.actions.DataAction.findForward(DataAction.java:565)
at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:164)
at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:222)
at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:153)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


*********************************
from Servlet LoginMainAction.java
*********************************

GnLocationManager manager = (GnLocationManager) EJBService.getFactory().lookUpManager("GnLocationManager", GnLocationManagerHome.class);

**********************************
from EJBService.java
*********************************

/**
* EJB Service Locator routines.
*
* <p>
* This class provides caching of EJB Homes.
* </p>
*
* <p>
* Example:<br>
* <pre>
* For Entity Bean:
* SomeEntityBeanHome sebHome = (SomeEntityBeanHome) EJBServiceFactory.getFactory().
* lookUpHome(SomeEntityBeanHome.class);
*
* For Session Bean:
* SomeSessionBeanService ssbService = (SomeSessionBeanService) EJBServiceFactory.getFactory().
* lookUpManager(SomeSessionBeanService.class);
*/

public class EJBService {

private static final String CONFIG_KEY = "EjbServiceFactory.context.";
private Map ejbHomes;
private static EJBService aFactorySingleton;
private static HashMap hashMap;



private EJBService() {
// ctx = new InitialContext();
this.ejbHomes = new HashMap();
}

public static HashMap getValueMap(String paramName) {


HashMap result = new HashMap();

if (hashMap != null) {
//Iterate the hashmap and return the value
Iterator iterator = hashMap.keySet().iterator();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.startsWith(paramName)) {
String value = (String) hashMap.get(key);
result.put(key, value);
}
}
}
return result;
}

private Properties getProps() {
Properties props = new Properties();

HashMap hashMap1 = getValueMap(CONFIG_KEY);
if (hashMap1.size() > 0) {
Iterator iterator = hashMap1.keySet().iterator();
while (iterator.hasNext()) {
String key = (String) iterator.next();
String value = (String) hashMap1.get(key);
props.put(key.substring(CONFIG_KEY.length()), value);
}
}

return props;
}

/**
* Returns instance of EJBServiceFactory
*
* @return EJBServiceFactory
* @throws NamingException
*/
public static EJBService getFactory() {
if (EJBService.aFactorySingleton == null) {
EJBService.aFactorySingleton = new EJBService();
}
return EJBService.aFactorySingleton;
}

/**
* Returns Remote Session Bean (XXXManager).
*/
public Object lookUpManager(String managerName,Class homeClass) {
Object anEJBRemote = null;
try {
// create an initial context using the above environment properties
// Context context = new InitialContext();
// Perform look up using JNDI name of ejb object Object boundObject = context.lookup("ObjectName");
// Narrow the reference of the object returned by lookup() method
final Context cxt = new InitialContext();
Object obj = cxt.lookup(managerName);

EJBHome homeInterface = (EJBHome)PortableRemoteObject.narrow(obj, homeClass);
// create an EJB instance
Method ejbCreate = homeInterface.getClass().getMethod("create", null);
anEJBRemote = ejbCreate.invoke(homeInterface, null);

}
catch (Exception e) {
e.printStackTrace();
// throw new NamingException("Error creating remote interface class, JNDIName:'" + managerName + "' not found! " + e.getMessage());
}
return anEJBRemote;
}


}
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"lim sp"

Please check your private message for a message from JavaRanch.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the object being returned from the lookup is the type that you are expecting? If yes, then it might be a classloading issue. See this for debugging classcastexceptions.
 
lim see peng
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for javax.rmi.PortableRemoteObject

******************************
The search result from jmx console :

javax.rmi.PortableRemoteObject Information
Not loaded in repository cache

******************************

for org.omg.CORBA.Object


***********************************
The search result from jmx console :

org.omg.CORBA.Object Information
Repository cache version:
org.omg.CORBA.Object(d1ef03).ClassLoader=null
++++Null CodeSource
Implemented Interfaces:

### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@b33d0a{ url=null ,addedOrder=2}

****************************************

What is mean by Null CodeSource? I think not because of duplicate class loaded.Can give me some Advice? Thanks!
 
mooooooo ..... tiny ad ....
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic