-
1. Re: Porting application from WebSphere to JBoss
apemberton Jul 30, 2009 2:39 AM (in response to straypet)I don't have experience specifically migrating websphere apps to jboss, but I do have extensive experience with both websphere and jboss portal.
The first place to start with this kind of task is to ensure you're not using any vendor proprietary APIs (IBM in this case). You'll want to use the relevant portlet specification-defined APIs for your environment.
I'm assuming your either migrating:
- from websphere portal 6.0.X or earlier to jboss portal 2.6.X
- from websphere portal 6.0.X to jboss portal 2.7.X
Assuming you wouldn't be migrating off websphere 6.1 or 7, because they're both fairly new, so - you'll want to make sure you're migrating only JSR168-specific code to jboss.
It may help if you:
- describe your environment(s) in detail
- PortletContext (in neither JSR168 nor JSR286) have a getService method - can you explain more about what API you're using here?
- explain what you mean by "get the delegating methods"
Hope this is helpful. -
2. Re: Porting application from WebSphere to JBoss
straypet Jul 30, 2009 9:33 AM (in response to straypet)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