[jboss-user] [JBoss Portal] - Re: Porting application from WebSphere to JBoss

straypet do-not-reply at jboss.com
Thu Jul 30 09:33:02 EDT 2009


Hi,
We are migrating from WebSphere 5.1 to JBoss Portal 2.6.8.

Here is our previous and new code:
		
  | 	    String JNDINAME = "SMOnlineFacade";
  | 	    String URL = "jnp://localhost:1099";
  | 	    String FACTORY = "org.jnp.interfaces.NamingContextFactory";
  | 	    String PKG_PREFIXES = "org.jboss.naming:org.jnp.interface";
  | 	    
  | 	    Object o = null;
  | 	    SMOnlineFacadeHome home = null;
  | 	    SMOnlineFacadeRemote smOnlineFacade = null;
  | 	    
  | 		try {			
  | 			Hashtable env = new Hashtable();
  | 			
  | 			env.put(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
  |             env.put(Context.PROVIDER_URL, URL);
  |             env.put(Context.URL_PKG_PREFIXES, PKG_PREFIXES);
  |             Context initialContext = new InitialContext(env);
  |             
  | 	    o = initialContext.lookup(JNDINAME);  // The object returned is of type $Proxy###
  | 	    home = (SMOnlineFacadeHome) PortableRemoteObject.narrow(o, SMOnlineFacadeHome.class);
  | 	    smOnlineFacade = home.create();
  | 			
  | 			// Was previously
  | 			// org.apache.jetspeed.portlet.PortletContext portletContext = getPortletConfig().getContext();
  | 			// SMOnlineDelegate delegate = null;
  | 			// org.apache.jetspeed.portlet.PortletService portletService;
  | 			// try {
  | 			// 	 portletService = portletContext.getService(SMOnlineDelegate.class);
  | 			//	 delegate = (SMOnlineDelegate)portletService;
  | 			// } catch (Exception e) {
  | 			//	 e.printStackTrace();
  | 			// }
  | 

By the delegating methods I mean our "interface" towards the backend. All our EJBs are deployd and bound to the correct JNDI's.

I get the ClassCastException you see below...

15:27:30,890 ERROR [STDERR] Caused by: java.lang.ClassCastException
15:27:30,890 ERROR [STDERR]     at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
15:27:30,890 ERROR [STDERR]     at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
15:27:30,890 ERROR [STDERR]     at com.te.unitor.portlets.VesselSearch.getRemoteFacade(VesselSearch.java:892)
15:27:30,890 ERROR [STDERR]     at com.te.unitor.portlets.VesselSearch.getOnlineDelegate(VesselSearch.java:970)
15:27:30,890 ERROR [STDERR]     at com.te.unitor.portlets.VesselSearch.init(VesselSearch.java:132)
15:27:30,890 ERROR [STDERR]     at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.initPortlet(PortletContainerImpl.java:359)
15:27:30,906 ERROR [STDERR]     at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:233)
15:27:30,906 ERROR [STDERR]     ... 73 more
15:27:30,906 ERROR [STDERR] Caused by: java.lang.ClassCastException: $Proxy314
15:27:30,906 ERROR [STDERR]     at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
15:27:30,906 ERROR [STDERR]     ... 79 more

Thanks,
Petter

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246990#4246990

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4246990



More information about the jboss-user mailing list