-
1. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 26, 2013 5:01 PM (in response to nwhitehead)There are 2 ways to use Snowdrop.
1) Install the Module into EAP/AS.
2) Add the libraries to your .ear or .war
I would suggest option 1. That will keep it out of the way of your app and testing.
You can either deploy the module yourself from the zip OR use the source from github and "mvn install" from the /install. NOTE: read the README
IF you are running into errors or issues please let me know.
I should be releasing the next minor fix tomorrow or this weekend.
Joshua
-
2. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 26, 2013 5:07 PM (in response to jowilson)What specific version of JBoss and of Snowdrop are you using?
Did you know that the Module will have SpringFramework installed into JBoss too? Which version of Spring are you using?
-
3. Re: Re: JBoss AS 7 Snowdrop Hot Deploy
nwhitehead Sep 27, 2013 9:47 AM (in response to jowilson)Ah... deploying and activating in an EAR would be cooking with gas !
That's what I have been trying to do, unsuccessfully, but I suspect my EAR is just not correctly structured.
Here's the details you inquired about:
- JBoss EAP 6.1.0.GA
- Java 1.7.0_40 X64 (On Windows 7 64)
- Snowdrop 3.0.1 Final (with Spring)
- Spring 3.2 (using the embedded 3.2 libs but I am shooting for 3.2.3.RELEASE)
I build the EAR in Maven 3 and use the jboss-as plugin to deploy.
I have tried several variations and configuration for my EAR but none of them work, and now I feel like I really don't know how they should packaged, but here's what I am trying to get to work. It's pretty simple and if I can get this to work, I should be in business
My EAR looks like this (although I have tried several variations):
- container.ear
- META-INF
- application.xml
- jboss-deployment-structure.xml
- lib
- (all jars from jboss-spring-subsystem-as7-3.0.1.Final.zip / module-deployer / org / jboss / snowdrop / main)
- (all jars from jboss-spring-subsystem-as7-3.0.1.Final.zip / module-spring / org / springframework / spring / snowdrop)
- snowdrop.jar
- org
- jboss
- snowdrop
- main
- module.xml (from jboss-spring-subsystem-as7-3.0.1.Final.zip / module-deployer / org / jboss / snowdrop / main)
- main
- snowdrop
- jboss
- org
- spring.jar
- org
- springframework
- spring
- snowdrop
- module.xml (from jboss-spring-subsystem-as7-3.0.1.Final.zip / module-spring / org / springframework / spring / snowdrop)
- snowdrop
- spring
- springframework
- org
- spring-context.jar
- META-INF
- jboss-spring.xml
- META-INF
- META-INF
Application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<description>Service Container</description>
<display-name>Service Container</display-name>
<module><java>snowdrop.jar</java></module>
<module><java>spring.jar</java></module>
<module><java>spring-context.jar</java></module>
<library-directory>lib</library-directory>
</application>
The jboss-spring.xml is a super simple bean definition (with a typo in it so I can see if throws an exception, which would mean success...)
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="MBeanServer" class="java.lang.management.ManagementFactory"
lazy-init="false" factory-method="getPlatformMBeanServeXr">
</bean>
</beans>
The output on the console on deploying the ear was:
09:39:09,620 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "container.ear" (runtime-name: "container.ear")
09:39:09,897 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of "null" (runtime-name: "snowdrop.jar")
09:39:09,897 INFO [org.jboss.as.server.deployment] (MSC service thread 1-18) JBAS015876: Starting deployment of "null" (runtime-name: "spring.jar")
09:39:09,897 INFO [org.jboss.as.server.deployment] (MSC service thread 1-10) JBAS015876: Starting deployment of "null" (runtime-name: "spring-context.jar")
09:39:09,898 INFO [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015877: Stopped deployment null (runtime-name: spring.jar) in 0ms
09:39:09,898 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015877: Stopped deployment null (runtime-name: snowdrop.jar) in 0ms
09:39:09,898 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015877: Stopped deployment null (runtime-name: spring-context.jar) in 0ms
09:39:09,919 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment container.ear (runtime-name: container.ear) in 298ms
09:39:09,919 INFO [org.jboss.as.server.deployment] (MSC service thread 1-18) JBAS015876: Starting deployment of "container.ear" (runtime-name: "container.ear")
09:39:10,170 INFO [org.jboss.as.server.deployment] (MSC service thread 1-17) JBAS015876: Starting deployment of "null" (runtime-name: "spring.jar")
09:39:10,170 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "null" (runtime-name: "spring-context.jar")
09:39:10,170 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015876: Starting deployment of "null" (runtime-name: "snowdrop.jar")
09:39:10,227 INFO [org.jboss.as.server] (management-handler-thread - 56) JBAS018562: Redeployed "container.ear"
So no errors, but no action either. So then I tried adding a jboss-deployment-structure.xml to the EAR's META-INF folder, but the server complains that the module names are not recognized (I thought perhaps the module names needed adjusting.... a nice easy fix ?)
<jboss-deployment-structure>
<sub-deployment name="snowdrop.jar">
<dependencies>
<module name="org.jboss.snowdrop" />
</dependencies>
</sub-deployment>
<sub-deployment name="spring.jar">
<dependencies>
<module name="org.springframework.spring" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
So I'm at a loss. Is the correct approach anywhere near this ?
Thanks Joshua.
//Nicholas
-
4. Re: Re: JBoss AS 7 Snowdrop Hot Deploy
nwhitehead Sep 27, 2013 10:06 AM (in response to jowilson)Sorry, also meant to say that I do not have snowdrop already installed. Trying to use a bare-bones server install and install snowdrop along with my EAR.
-
5. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 27, 2013 1:09 PM (in response to nwhitehead)I am sorry but I don't really follow what you are trying to do. Your .ear only has snowdrop and spring in it. Are you just trying to test those?
Based on your current version numbers, if you are building a regular spring app then you don't need any of this. Just use maven to reference the spring jars that you need in your pom.xml.
There are some features built into Snowdrop that you can use if needed. i.e. injecting EJBs into Spring beans and vice versa. If you don't need that then at this point then you may just want to try building your app without snowdrop first.
I would ask you again, what are you trying to do.
Please let me know how I can help.
Joshua
-
6. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 27, 2013 1:33 PM (in response to jowilson)If you do have a regular Spring based app and you want to embed Spring in it, please check out the docs.
-
7. Re: Re: JBoss AS 7 Snowdrop Hot Deploy
nwhitehead Sep 27, 2013 1:59 PM (in response to jowilson)Hi Joshua;
I guess I should have explained that. I am trying to create a Spring context which I can bind into JNDI and then inject Spring beans into other non-spring sourced services (as well as reference JNDI objects, but that's simple enough without snowdrop)
So as I understood the snowdrop docs, if I have the snowdrop deployer enabled, I could have the spring context created and bound into JNDI based on a jar's jboss-spring.xml which would bootstrap my spring context.
As such, I am simply trying to get the spring context deployed with one simple bean (or, technically, a spring bean exception on account of my typo).
Am I way off here ?
-
8. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 27, 2013 2:50 PM (in response to nwhitehead)Nicholas,
Thanks, that makes more sense. There are a couple of things to bring up now. First I should have Snowdrop 3.0.2 published this afternoon. It is currently available on github. At the moment the Red Hat Snowdrop docs match Snowdrop 2.1.1 more closely then 3.0.2 as version 3.x was just release and we are still working on the docs. So you can use the docs but a bit of the wording may not match, so please keep that in mind. The biggest change was a refactor of the API from Deployers to Interceptors, just so you are aware when you try to access the API.
As I see it you can access the Snowdrop jars/API 3 different ways.
1) Deploy it into the Module system in JBoss. (this is my recommended path)
2) Get the jars from here and add them to your projects lib dir. (This is the 3.0.1 version)
3) Add the jboss nexus repo to your settings.xml and then add the snowdrop jars to your maven pom.xml.
If you want an example please check out the Sportsclub example.
Once you have the jars set up and in whatever location works for you let me know what issues arise. Your idea sounds like it should work, though I have not tried it yet.
Joshua
-
9. Re: Re: JBoss AS 7 Snowdrop Hot Deploy
nwhitehead Sep 27, 2013 3:58 PM (in response to jowilson)Alright. I will lookout for the 3.0.2 release.
The sprotsclub-ear part of the examples was interesting and seems fairly close to what I would like to do.
I guess I am still uncertain on my approach of trying to deploy the snowdrop module itself as part of my EAR, rather than deploying it seperately by copying files into the AS 7 server directories.
In pursuit of this, I attempted a simpler example:
EAR / META-INF:
application.xml
jboss-deployment-structure.xml
jboss-spring.xml
The jboss-spring.xml is the same as before.
The application.xml only contains
<module><java>snowdrop.jar</java></module>
<library-directory>lib</library-directory>
snowdrop.jar is the same as before, containing only the module.xml for snowdrop:
- snowdrop.jar
- org
- jboss
- snowdrop
- main
- module.xml (from jboss-spring-subsystem-as7-3.0.1.Final.zip / module-deployer / org / jboss / snowdrop / main)
- main
- snowdrop
- jboss
- org
And the snowdrop and spring files are in EAR/lib.
Oh, and the jboss-deployment-structure.xml is borrowed from sportsclub.ear:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.slf4j" export="true"/>
<module name="org.javassist" export="true"/>
<module name="org.slf4j.jcl-over-slf4j" export="true"/>
<module name="org.springframework.spring" slot="snowdrop" export="true">
<exports>
<include path="META-INF**"/>
<include path="org**"/>
</exports>
<imports>
<include path="META-INF**"/>
<include path="org**"/>
</imports>
</module>
<module name="org.hibernate" export="true"/>
<module name="org.jboss.snowdrop" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
When I deploy: this is the output:
15:56:16,148 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.module.service."deployment.container.ear.snowdrop.jar".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.container.ear.snowdrop.jar".main: JBAS018759: Failed to load module: deployment.container.ear.snowdrop.jar:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:92) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]
Caused by: org.jboss.modules.ModuleNotFoundException: org.springframework.spring:snowdrop
at org.jboss.modules.Module.addExportedPaths(Module.java:1099) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.Module.addPaths(Module.java:978) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.Module.link(Module.java:1304) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1332) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:226) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:71) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
... 5 more
So I figured since the snowdrop module is actually being deployed in the EAR, the module name in the jboss-deployment-structure.xml perhaps needs to be modified ?
- snowdrop.jar
-
10. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 27, 2013 4:37 PM (in response to nwhitehead)1 of 1 people found this helpfulYou can not (as far as I understand it) deploy modules inside an app. They are only for deployment inside JBoss. You use jboss-deployment-structure.xml if you want to reference jars in a module not in your apps lib dir, as it says in the docs.
Sportsclub only uses the Module option for accessing the jars.
-
11. Re: JBoss AS 7 Snowdrop Hot Deploy
jowilson Sep 27, 2013 4:45 PM (in response to jowilson)Snowdrop 3.0.2.Final is available.