[JBoss Microcontainer Users] - ClassLoadingFactory and AbstractVFSDeployment
by heiko.braun@jboss.com
I am trying to do an in-memory deployment of a web service endpoint. The WS impl. class is created through javassist, and hence I need to pass a classloader into the deployment. One way of doing so seems to be the ClassLoaderFactory attachment, although not recommended.
When I create a VFS based deployment (based on AbstactVFSDeployment) and attach a ClassLoaderFactory, I can see the factory being exectued however it runs into an execption later on:
| Caused by: java.lang.IllegalStateException: ClassLoader has not been constructed for vfsfile:/Users/hbraun/riftsaw-dd3568c
| 6-19d7-4508-8d42-8f271102f901.war/
| at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.visit(VFSDeploymentClassLoader
| PolicyModule.java:153)
| at org.jboss.deployers.vfs.plugins.annotations.FilteredAnnotationEnvironmentDeployer.visitModule(FilteredAnnotatio
| nEnvironmentDeployer.java:88)
| ... 31 more
|
|
I've verified the the DeploymentUnit has a classloader association after the factory is being invoked.
If I do use an AbstractDeployment and provide StructureMetaData manually it works.
What is that I am missing here?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252228#4252228
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252228
15 years, 3 months
[JBoss Portal Users] - Re: Creating Portal Pages Dynamically using Jboss Portal API
by TomHombergs
We used the JBoss Portal API to create pages dynamically. I figured out how to do it by downloading the JBoss Portal source and reverse-engineering the admin-portlets :).
You will need to access the PortalObjectContainer MBean to create pages and add portlets to those pages. Here are some snippets (out-of-context, though):
| // creating a page (parent page must exist)
| PortalObjectPath portalPath = new PortalObjectPath(pathToParentPage, PortalObjectPath.CANONICAL_FORMAT);
| PortalObjectId id = new PortalObjectId("", portalPath);
| PortalObject object = getPortalObjectContainer().getObject(id);
| PageContainer parent = (PageContainer) object;
| Page page = parent.createPage("My Page");
|
| // adding an instance of MyPortlet (instance must be created beforehand)
| Window window = page.createWindow("MyPortletWindow", ContentType.PORTLET, "MyPortletInstance");
|
The PortalObjectContainer can only be accessed through a JTA transaction, if you want to use it outside of a portlet (this code would be in the method getPortalObjectContainer()):
| TransactionManager tm = null;
| try {
| InitialContext ic = new InitialContext();
| tm = (TransactionManager) ic.lookup("java:/TransactionManager");
| tm.setTransactionTimeout(600);
| } catch (NamingException e) {
| throw new RuntimeException("TransactionManager konnte nicht erzeugt werden!", e);
| }
| tm.begin();
| try {
| MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
| PortalObjectContainer container = (PortalObjectContainer) MBeanProxy.get(PortalObjectContainer.class, new ObjectName("portal:container=PortalObject"), mbeanServer);
| return container;
| } finally {
| tm.commit();
| logger.trace("...beende JTA-Transaktion.");
| }
|
Hope this helps. Looking at the source of the JBoss Portal Admin-Portlets helped me a great deal!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252225#4252225
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252225
15 years, 3 months