Having looked at the code it would seem that this is not supported. Seam can be reinitialises, as done in the seam servlet context listener, but this causes the seam contexts to be reset. It would be nice to be able to specify a new url to be scanned for seam components and for these to be added to the current set of components.
Manually adding components to the application context also works:
component = new Component(this.getClass().forName("com.company.MyComponent"), "myComponent"); Contexts.getApplicationContext().set("myComponent.component", component);
but could circumvent important initialisation, which I don't have time to check...
Any plans to in the future?
Actually, maybe if you add the external EJB jar to the classpath of the EAR it might get picked up as Seam - give it a go.
It's not on the roadmap, but add an issue to JIRA and we can see if it gets many votes.
An external EJB jar is picked up if the jar is already on the classpath at the time when seam is being initialised, but won't be if you deploy a jar after initialisation is complete.
I shall add this issue to JIRA.
Ok. I think then it's even further down the list of priorities, as it would require a big change to the way seam boots.
Maybe Web Beans will support this...
hmmmm, you keep saying have it on the classpath which is confusing....do you mean have it in the same classloader really? and if so, on jboss, how do I make sure an external jar is in the same classloader as my jar with my EJB's.....my app already gets the EntityManagerFactory through JNDI, but it can't seem to load the beans in that same external jar..it can only use them as EJBs just fine...just doesn't load the seam components in the external jar. Is there a way to do this as we are sharing this one jar between 10 different applications and it is a jar of lots of classes....we can't deploy that jar 10 times or the memory is ridiculous.
Maybe we need something along the lines of:
then components could perhaps be added programmatically.
Or some way of rescanning the classpath for new components again using the seam.properties identifier.
What do you mean classpath? I am in an AppServer...not much classpath to deal with but plenty of classloaders to deal with.
I could have sworn I was involved with a post that had this solved. I have a war and jar(not an ear) and just want the war and jar to be in same classloader but I thought they would be if I didn't specify a unified classloader, but it doesn't pick up the seam components :(.
We have this jar being successfully used by many JBoss applications(MBeans deployed inside jars), and our seam webapp is loading the beans as EJB's just fine, but is just not loading the seam stuff...why would the EntityManager stuff work but not the seam components :(.
I DEBUGGED it and found out something very interesting. Seam picks up all my annotated classes just fine but then fails on this check...
if ( scannedClass.isAnnotationPresent(Name.class) )
That seems a bit bizarre. It is like seam has a classloadeer problem and my name annotation is not being picked up BUT the ones with Name annotation showed up in the classes list while other entities where skipped so at one point scanning for these annotations in seam startup succeeded!!!!