Sorry for bumping this, but does anybody have any idea about creating these interceptors?
Is this the wrong forum? I tried to read the different jboss docs but they weren't very helpful for this.
To simplify the question (and maybe I have to forget about spring integration):
- how can I create an Interceptor that is loaded by the same classloader as the web application (.war), so that I can share the code and more importantly share the state of the classes (singletons, caches, etc.).
Do I need to create an .ear, .sar, my own xxx-servixce.xml or something else for this to work?
I tried a different approach to this by dynamically adding interceptors to the stack.
I can get a reference to the InterceptorFactory object and list the two default interceptors in it.
But how can I add interceptors?
The addInterceptor() method is located in the class JBossInterceptorStackFactory, but how can I get an instance of this?
If I try to cast the InterceptorFactory I got it throws a ClassCastException, because it is of type "$proxy242".
The class show this when I print it:
I get the object using the following (which seems to be working when using the interface and not the implementation class):
MBeanServer server = MBeanServerLocator.locate(); m_mbeanProxy = MBeanProxyExt.create(m_proxyInterface, m_objectName, server);
Instead of the dynamic interceptor approach, package your application as a sar archive
Make your sar archive self-contained with all your dependencies inside it including the Spring files and your war files.
Register your mbean via the META-INF/jboss-service.xml technique.
When packaged properly, the CMS Interceptor stack should pick up your MBEAN and call it
Thanks for this, I will try it and report back.
I hadn't yet tried this because I didn't know if the portal (ie. my own .war) also gets correctly installed this way, and I'm not that well versed in all the different deployment formats (war, ear, sar, rar...)
Tried this and didn't quite get it to work. Probably because I'm not an jboss-expert but anyways...
I made a .sar file with a file META-INF/jboss-service.xml, which contained the following:
<server> <mbean code="TestInterceptor" name="portal:service=Interceptor,type=Cms,name=Test" xmbean-dd="" xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean"> <xmbean /> </mbean> </server>
If I put this .sar in the deploy directory I get the following errors:
20:48:23,468 INFO [EjbModule] Deploying Sequence 20:48:23,531 WARN [EjbModule] Could not load the org.jboss.resource.connectionmanager.CachedConnectionInterceptor interceptor for this cont ainer javax.management.InstanceNotFoundException: jboss.jca:service=CachedConnectionManager is not registered.
and a bit later
ble: (java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.portal.jems.as.system.JBossServiceModelMBean)
If I put jboss-jars in the lib folder of my jar I can get rid of the ClassNotFoundException, or if I put the .sar under deploy/jboss-portal.sar it also only complains about the following:
20:50:27,421 INFO [EjbModule] Deploying Sequence 20:50:27,484 WARN [EjbModule] Could not load the org.jboss.resource.connectionmanager.CachedConnectionInterceptor interceptor for this cont ainer javax.management.InstanceNotFoundException: jboss.jca:service=CachedConnectionManager is not registered.
Any ideas or pointers?
Alright, I think I got a little bit further (I had a jboss class in my lib folder which apparently caused problems for jboss's own services, go figure...)
But now my problem is that my webapp uses a datasource, but it can't find it because it seems that the web archive (which is in the .sar) is deployed before the datasource is registered.
I can see the datasource in the JMX console so it gets deployed correctly (and it of course worked before I tried this .sar stuff).
Try deploying the war files by themselves then outside the sar.
Got this to work somehow by specifying dependencies so the services load in the correct order, and adding classpath items in the jboss-service.xml to get the .war and mbean to use the same classloader and classes.
It's quite a hacky solution, must think of something better.
Is it possbile to customize/intercept Jboss portal actions (CMS file upload)?
I want to generate dynamic page displaying the message 'Succesfully uploaded file <filename> on <datet/ime>' after file is browsed & uploaded from Jboss CMS (content management system).
As i never used interceptors, I will appreciate if u give me steps to create/configue CMS interceptors with sample.
Thanks in advance.