[JBoss/Spring Integration] - Using Spring to integrate POJOs as MBeans in JBoss
by dima.frid
Hi,
I am trying to use Spring to eliminate the need to use SAR XML method descriptors for MBeans (like the following:
<?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
| <mbean>
| <description>Some Services</description>
| <descriptors>
| <persistence persistPolicy="Never"/>
| <currencyTimeLimit value="0"/>
| <state-action-on-update value="keep-running"/>
| </descriptors>
| <class>package a.b.AServicesImpl</class>
|
| <operation impact="ACTION">
| <description>Does something</description>
| <name>doSomething</name>
| <parameter>
| <description>name</description>
| <name>name</name>
| <type>java.lang.String</type>
| </parameter>
|
| ...),
and use annotations instead.
So I have a POJO implementing the logic, and the following XML:
<?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
| <beans>
| <bean id="aServices" class="a.b.AServicesImpl"/>
| </beans>
|
I assume that JBoss successfully loads the MBean judging by the following log fragment:
2007-08-02 19:21:31,656 [ScannerThread] (XmlBeanDefinitionReader.java:347) INFO - Loading XML bean definitions from URL [file:/.../EJBContainer/server/aCong/tmp/deploy/tmp28215jboss-bean-spring.xml]
2007-08-02 19:21:31,671 [ScannerThread] (AbstractBeanFactoryLoader.java:102) INFO - Bean factory [jboss-bean-spring] binded to local JNDI.
2007-08-02 19:21:31,671 [ScannerThread] (SpringDeployer.java:134) INFO - Deployed Spring: file:/.../AppServer/mbeans/jboss-bean-spring.xml
But I do not see this bean in JBoss JMX management console.
So I guess that either my code isn't annotated properly, or something more profoundly wrong.
Please, advise (an example would be a great help).
Thanks a lot in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070930#4070930
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070930
18Â years, 8Â months
[Management, JMX/JBoss] - Re: Managing JBoss programmatically?
by BogusException
PeterJ,
Thanks for writing, as always!
anonymous wrote : You are attempting to write a stand-alone Java application (one not deployed to JBoss AS) that you can use to deploy applications.
Not quite. I'm just looking for ideas as how to do this from within a deployed app on the same server.
I think it is becoming clear that having a local application running as the JBoss user and accessed via JCA would be overly complex and perhaps even impractical.
What might hold promise is JMX, as you suggest, but through a program like Maven. According to http://mojo.codehaus.org/jboss-maven-plugin/,
anonymous wrote : jboss:deploy Deploys a directory or file to JBoss via JMX, which would seem to fit the bill. Maven has 2 parts, though.. one for JBoss, and the stand-alone portion (command line exes).
Anyway, the objective is the same. I'd like to have pre-compiled (EJB3) classes jar'd, sar'd, etc. with any variables needed passed to them (via env, etc.) and copied to the ./deploy dir. Simply put, that has been the objective all along.
The rub seems to be getting a deployed app to interact with files outside the container. So to make a simple list of one possible action (we haven't discussed the logically inevitable undeploy) would be:
1. An EJB3 bean decides to, or is told to, deploy (for the purposes of this example) an EJB3 bean that will facilitate REGEX matching.
2. That bean communicates to an application outside the container (or...?) the name of the file(s) to be deployed, and the text of the match.
3. That app brings together the needed package, XML descriptors, env vars (like the regex match string), and creates the jar, sar, war, ear, etc.
4. That app then copies the archive to the ./deploy dir.
5. Done.
Yes, I know regex is a bad example, because you could pass the regex into the class with each request, but for this example we don't want to add that fat to every requesting class to pass via aever MDB... You get the point.
So with this strategy I can un-/deploy beans and services programmatically from within the deployed application(s).
TIA for any insights! :)
Bogus Exception
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070924#4070924
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070924
18Â years, 8Â months