[jboss-user] [JBoss Portal] - java.lang.ClassCastException in ContextImpl

FredF do-not-reply at jboss.com
Fri Mar 30 09:22:22 EDT 2007


I am trying to retrieve a context for the portalobjectcontainer 

public class PortalService {
  | 	
  | 	private PortalObject po;
  | 	private org.jboss.portal.core.model.portal.Context ctx;
  | 	private org.jboss.portal.core.model.portal.PortalObjectContainer container;
  | 	public PortalService(){
  | 		try{
  | 			MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
  | 			container = (PortalObjectContainer)MBeanProxy.get(PortalObjectContainer.class, new ObjectName("portal:container=PortalObject"), mbeanServer);
  | 			System.out.println("container=" + container);
  | 			ctx = container.getContext();
  | 		}catch ( Exception ex ) {
  | 			ex.printStackTrace();
  | 		}
  | 	}
  | }

but the line

ctx = container.getContext();

gives me an

java.lang.ClassCastException: org.jboss.portal.core.impl.model.portal.ContextImpl

I got this code from a post in this forum some time ago and have made it work but when I tried it again in new class this happens.

thanks

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

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



More information about the jboss-user mailing list