[Installation, Configuration & DEPLOYMENT] - How to isolate my class from the lib jar
by alessandro_rizzi
Problem: I need to use an old version of Hibernate3.jar but in JBoss 4.0.4 there is a new version that I do not want
Solution 1: delete Hibernate3.jar from \lib folder. Works, but it's so ugly.
I've tried to add in my jboss-app.xml:
<loader-repository>
jboss.test:loader=my.ear
<loader-repository-config>
java2ParentDelegation=true
</loader-repository-config>
</loader-repository>
But, nothing changes, I see that \lib jar are seen before mine. (I've made a test class with same name but different behaviour in the \lib folder and in my ear folders and I see the \lib one)
If I write java2ParentDelegation=true ... JBoss do not start at all, because during deploy of my.ear I need, of course, some of the \lib jars of JBoss.
My .ear is somehow "strange" because I do have many subfolders and the path of them is written in the jboss-service.xml of the .sar (inside .ear), using the classpath tag.
Thanks for any suggestion.
Regards
Alessandro Rizzi
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088959#4088959
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088959
18 years, 7 months
[JBoss Seam] - Re: seam and batch/queue-processing
by motte79
No, i don't think so ...
I need something like the following
PseudoCode:
| @Stateful
| @Startup
| @Name("batch")
| @Scope (ScopeType.APPLICATION)
| @TransactionManagement (TransactionManagementType.BEAN)
| public class BatchBean implements Batch {
|
| private AtomicBoolean atomicBoolean = new AtomicBoolean();
|
| // Stateless bean
| @In IncomingMessages incomingMessages;
| // Stateless bean
| @In Task task;
| @Resource SessionContext sessionContext;
|
| @Asynchronous
| @Create
| public void parent () {
|
| atomicBoolean.set(Boolean.TRUE);
| task.init (incomingMessages);
|
| while (atomicBoolean.get()) {
|
| try {
| Thread.sleep(100);
| } catch (InterruptedException ie ) {
| // nothing
| }
|
|
| while (atomicBoolean.get()) {
| UserTransaction tx = sessionContext.getUserTransaction();
| try {
| tx.begin();
| Object o = incomingMessages.next();
| if (o != null) {
| // synchonous call
| task.doTask(o);
| tx.commit();
| } else {
| tx.commit();
| break;
| }
| } catch (Exception e) {
| tx.rollback();
| }
| }
| }
| }
|
| @Shutdown
| public void destroy () {
| task.finishLastMessageAndClose();
| atomicBoolean.set(Boolean.FALSE);
| }
| }
|
@Shutdown is called before @Destroy and @Remove on undeployment and server-shutdown
This approach is not possible because an applicationbean cannot be invoked by two different threads at the same time ... (the parent- and the destroy-method)
Second there is no @Shutdown which waites for the asynchronous 'parent'-method to finish after invokation of the @Shutdown - method ...
As asked in another thread i had also problems to get BEAN-managed transactions work with seam-components .. For the most components i need CONTAINER-managed Transactions, therefore i've installed
<transaction:ejb-transaction/>
in components.xml
The MBean - approach above (Fri Sep 21, 2007 10:41 AM) creates a simple Thread, initialize it with the beans and have it run, but this has the sideeffect, that the method-invokations incomingMessages.next() and task.doTask() are running both in there own transactions ... that could cause the loss of messages ... ). As described before there is also a problem to synchronize the MBean with the Component-creation (Task, IncomingMessages) because the MBean is earlier up than seam. And second the MBean lives on shutdown and on undeploy longer than seam ..
Maybe i'm mixing some concepts which should better stand alone ..
I've not much experience with EJB3, Jboss, etc.
;)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088956#4088956
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088956
18 years, 7 months