-
1. Re: HOWTO deploy webapp dynamically
alesj Feb 21, 2008 6:27 AM (in response to thomas.diesler)Where do you get the warURL?
Here?
- http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123146
Who uses WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP?
Or what is its purpose?
You don't need to create whole new deployment.
You probably just need to add another deployer in the chain of deployers that modify WebMetaData/JBossWebMetaData, like Scott's MergedJBossMetaDataDeployer does.
e.g. pseudo chain :-)
1) Deployer that creates WebMD/JWebMD (usually some parser)
2) MergedJBossMetaDataDeployer that merges JBoss specific inputs with common one's
3) Your modifier deployer that adds WS specific info
4) TomcatDeployer that turns WMD/JWMD into ServiceMetadata
5) Real ServiceDeployer
There are of course other deployers in that chain, but those should not be relevant for you. -
2. Re: HOWTO deploy webapp dynamically
alesj Feb 21, 2008 6:30 AM (in response to thomas.diesler)"alesj" wrote:
2) MergedJBossMetaDataDeployer that merges JBoss specific inputs with common one's
Aha, this is really for ejbs.
So basically this is what you need to do, but for the web metadata. -
3. Re: HOWTO deploy webapp dynamically
adrian.brock Feb 21, 2008 6:41 AM (in response to thomas.diesler)All you need to do is add the WebMetaData into the attachments
and make sure your deployer runs before the other WebMetaData processing deployers.
These other deployers will then turn that metadata into a web/tomcat deployment.
The other web deployers don't care whether the WebMetaData came from parsing
a web.xml or if you created it programmatically. -
4. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 21, 2008 9:15 AM (in response to thomas.diesler)ok, done.
-
5. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 26, 2008 4:03 AM (in response to thomas.diesler)Using the JAX-WS Endpoint API it is possible to setup a WS endpoint for a given endpoint bean and web context.
Prior to the changes above we used to generate webapp descriptors and deployed them through the client deployer API.
Please show me how to do this in memory. I generate the JBossWebMetaData ,but I don't have a deployment unit to attach it to.DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class); if (unit != null) { unit.addAttachment(JBossWebMetaData.class, jbwmd); unit.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE); } else { // TODO: endpoint API cannot use an existing deployment unit }
-
6. Re: HOWTO deploy webapp dynamically
alesj Feb 26, 2008 5:10 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
I generate the JBossWebMetaData ,but I don't have a deployment unit to attach it to.
Where do you try to do this?
Where outside deployers? -
7. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 26, 2008 5:20 AM (in response to thomas.diesler)Any component can setup an endpoint using the endpoint API.
The impl of that API uses the WS deployment aspect shown above - we do not have a deployer at that time. i.e. the component initiates the deployment at runtime.// Create the endpoint EndpointBean epImpl = new EndpointBean(); endpoint = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, epImpl); // Create and start the HTTP server SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); HttpServer httpServer = spiProvider.getSPI(HttpServerFactory.class).getHttpServer(); httpServer.start(); // Create the context and publish the endpoint HttpContext context = httpServer.createContext("/jaxws-endpoint"); endpoint.publish(context);
-
8. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 26, 2008 5:28 AM (in response to thomas.diesler)In other words, I have JBossWebMetaData. How can I deploy it?
-
9. Re: HOWTO deploy webapp dynamically
alesj Feb 26, 2008 5:36 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
In other words, I have JBossWebMetaData - how do I deploy them?
OK, I still don't see where you create it.
Where does the owner thread come from - who triggers the creation?
From Adrian's response:"adrian@jboss.org" wrote:
The other web deployers don't care whether the WebMetaData came from parsing
a web.xml or if you created it programmatically.
You create Deployment on the fly, attach JBWMD to it, and just push it to the deployers.
They will pick the metadata the same way as if it came from parsing jboss-web.xml. -
10. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 26, 2008 5:40 AM (in response to thomas.diesler)
You create Deployment on the fly, attach JBWMD to it, and just push it to the deployers.
Yes, please show me the code that does this. -
11. Re: HOWTO deploy webapp dynamically
alesj Feb 26, 2008 5:49 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
Yes, please show me the code that does this.
A bunch of our tests do this. ;-)
OK, but here it goes:DeployerClient main = getMainDeployer(); Deployment deployment = createSimpleDeployment("some_name"); MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects(); mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd); main.deploy(deployment);
-
12. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 26, 2008 6:36 AM (in response to thomas.diesler)Now I get
Caused by: org.jboss.deployers.spi.DeploymentException: Structure can only be determined for VFSDeployments org.jboss.deployers.client.plugins.deployment.AbstractDeployment@1f0eb99 at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.determineStructure(VFSStructuralDeployersImpl.java:211) at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:77) at org.jboss.deployers.plugins.main.MainDeployerImpl.determineStructure(MainDeployerImpl.java:743) at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:280) at org.jboss.deployers.plugins.main.MainDeployerImpl.deploy(MainDeployerImpl.java:384) at org.jboss.wsf.container.jboss50.WebAppDeploymentAspect.create(WebAppDeploymentAspect.java:84)
-
13. Re: HOWTO deploy webapp dynamically
adrian.brock Feb 26, 2008 6:46 AM (in response to thomas.diesler)If you're not using the VirtualFile then you need to tell it what the structure is.
See
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java?revision=70043&view=markup
and its subclasses for how to do things.
e.g.protected Deployment createSimpleDeployment(String name) { AbstractDeployment unit = createAbstractDeployment(name); // HERE There is one top level deployment factory.addContext(unit, ""); return unit; }
If you don't want to do some research and are just going to post
exceptions into the forum, then please use the user forum not the dev forums. -
14. Re: HOWTO deploy webapp dynamically
thomas.diesler Feb 26, 2008 7:10 AM (in response to thomas.diesler)I read http://labs.jboss.com/file-access/default/members/jbossmc/freezone/docs/2.0.x/userGuide/pt04.html
Is there anywhere else this is documented?
How do I set the deployments class path?
I cant do// There is one top level deployment ContextInfo context = factory.addContext(unit, ""); context.addClassPathEntry(entry);
because the classpath is not file based.
In my case, the deployment should use the context class loader of the calling component.
I getCaused by: java.lang.IllegalArgumentException: Null policy at org.jboss.classloader.spi.base.BaseClassLoaderSystem.registerClassLoaderPolicy(BaseClassLoaderSystem.java:112) at org.jboss.classloader.spi.ClassLoaderSystem.registerClassLoaderPolicy(ClassLoaderSystem.java:328) at org.jboss.deployers.plugins.classloading.AbstractClassLoaderSystemDeployer.createClassLoader(AbstractClassLoaderSystemDeployer.java:143) at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.createClassLoader(AbstractDeploymentContext.java:510)