[Messaging, JMS & JBossMQ] - jboss startup with delveryactive set to FALSE
by jlovelace70
Hi
I am using JBOSS jboss-4.0.0 and have implemented a MessageDrivenBean as a singleton which acts as a persistent in inbound message event queue. On occasions I need to restart the jboss container, and have queue content as yet un-processed. I would like to be able to use the JMX org.jboss.ejb.plugins.jms.JMSContainerInvoker startDelivery() method in the JMX GUI to kick off processing the backlogged of events prior upon jboss container restart.
Can you advise how to cause the MessageDataBean to be deployed with DeliveryActive FALSE so that message consumption of back logged messages does not prematurely start during jboss re-start bean deployment, and so I can start the message consumption on my command thru the GUI with startDelivery.
Thanks in advance. Hope I have not missed this in FAQs and other jboss docs I have poured through.
Jim
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009425#4009425
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009425
18Â years, 1Â month
[JBoss jBPM] - Re: A sample with HibernateLongInstance or HibernateStringI
by doballve
Just to give it code example, here is how you would do for a HibernateLongInstance:
First, You have a hibernate entity with id of type Long and a hibernate mapping to your class properly loaded in the same session as JBPM mappings. The mapping:
<class name="mypackage.MyEntity" table="SAMPLE_ENTITY">
| <id name="id" column="id" unsaved-value="0" type="java.lang.Long">
| <generator class="native"/>
| </id>
| ...
| </class>
Then you use a HibernateLongInstance to wrap your entity and store it as any other JBPM variable:
...
| // create my entity an wrap it with HibernateLongInstance
| MyEntity ent = new MyEntity();
| HibernateLongInstance entWrapper = new HibernateLongInstance();
| envWrapper.setObject(ent);
|
| // store it to root token context
| ContextInstance contextInstance = (ContextInstance)
| token.getProcessInstance().getInstance(ContextInstance.class);
| contextInstance.setVariable("my-entity-variable", entWrapper);
| ...
To access it later, just get the wrapped object and class cast it back to your entity:
...
| ContextInstance contextInstance = (ContextInstance)
| token.getProcessInstance().getInstance(ContextInstance.class);
| HibernateLongInstance entWrapper = (HibernateLongInstance)
| contextInstance.getVariable("my-entity-variable");
| MyEntity entData = (MyEntity)entWrapper.getObject();
| ...
That's it!
A warning though: The default configuration has Serializable type mapped before Hibernate and EJB types. That means that if your entity class implements java.io.Serializable it will get serialized as a byte array and not as a Hibernate entity. To avoid this behavior, re-order the types in jbpm.varmapping.xml.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009404#4009404
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009404
18Â years, 1Â month
[Performance Tuning] - performance degradation
by edavis
Hello,
im running a web application on jboss4.0.5.GA using ejb3, hibernate, tomcat, mysql, treecache, prototype for ajax, servlet with pojo based html rendering, etc if more datails are needed ill be happy to provide them.
Im still working in tunning the application to get better performance but the main problem im facing atm is that in time the server performance degrades, day one it works like a charm, and the following days it starts to go slower and slower. Im not leaking db connections, eviction on caches are in the range of one hour so that should not be the problem.
Im using sun jvm 1.5.0_09 and starting jboss with
| java -Dprogram.name=run.sh -server -Xms128m -Xmx1024m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true
The server is an AMD Athlon(tm) 64 Processor 3200+ with 2G ram that is also running mysql and apache under Red Hat 2.6.9-42.0.2.EL
When the server gets slower I look the ServerInfo MBean and none of my classes are blocking any thread.
What should I look for? JVM tunning? another JVM? is this a known issue? is my code faulty?
If this is not the right forum to ask, please point me to the right one.
Also, im very sorry about my raw english, is not my main lang.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009403#4009403
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009403
18Â years, 1Â month
[JBoss Seam] - Simple application component
by quilleashm
Using Seam 1.1.0.GA
I have a simple Seam component which is just for injecting a singleton session factory and a ManagedHibernateSession that uses it. (I'm aware of the HibernateSessionFactory component but I think this problem is more general).
First the session factory wrapper component.
| @Name( "referenceSessionFactory" )
| @Scope( ScopeType.APPLICATION )
| @Intercept( InterceptionType.NEVER )
| public class ReferenceSessionFactory
| {
| @Unwrap
| public SessionFactory getSessionFactory()
| {
| return HibernateSession.getSessionFactory();
| }
| }
|
And a test component
| @Name( "test1" )
| @Scope( ScopeType.EVENT )
| public class Test1
| {
| @In( create = true )
| private Session referenceSession;
|
| @Create
| public void init()
| {
| int i = 1;
| }
|
| public String getStr()
| {
| return "test1";
| }
| }
|
and the components.xml piece.
| <!-- reference session factory wrapper component -->
| <component class="com.azure.spark.web.seam.component.ReferenceSessionFactory" auto-create="true"/>
|
| <!-- managed session from the reference session factory -->
| <core:managed-hibernate-session name="referenceSession" session-factory="#{referenceSessionFactory}"/>
|
| <component class="com.azure.spark.web.bean.security.Test1"/>
|
And my simple test page
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE html
| PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html">
| <head>
| <title></title>
| </head>
| <body>
| <h:outputText value="#{test1.str}"/>
| </body>
| </html>
|
Now if I request a page that references the test1 component str property I get the following error.
| java.lang.IllegalStateException: SessionFactory not found
| at org.jboss.seam.core.ManagedHibernateSession.getSessionFactoryFromJndiOrValueBinding(ManagedHibernateSession.java:156)
| at org.jboss.seam.core.ManagedHibernateSession.createSession(ManagedHibernateSession.java:81)
| at org.jboss.seam.core.ManagedHibernateSession.create(ManagedHibernateSession.java:69)
|
If I remove the @Create annotation from the test1 component then it works as expected (page just renders "test1").
It seems that there is some problem creating and injecting the hibernate session when it is the @Create method that is being intercepted (I can see the Component.callCreateMethod() further down in the stack trace). I haven't seen this problem injecting other components, facesContext and the referenceSessionFactory seem to work fine.
More interestingly if I visit the test page it fails as above. If I visit a different page that has a hibernate session injected and no @Create it works fine. Then if I go back and refresh the test page the error changes to...
| java.lang.ClassCastException: com.azure.spark.web.seam.component.ReferenceSessionFactory
| at org.jboss.seam.core.ManagedHibernateSession.getSessionFactoryFromJndiOrValueBinding(ManagedHibernateSession.java:153)
| at org.jboss.seam.core.ManagedHibernateSession.createSession(ManagedHibernateSession.java:81)
| at org.jboss.seam.core.ManagedHibernateSession.create(ManagedHibernateSession.java:69)
|
Which looks like it's finding something but it returns the Seam component itself rather than the result of the @Unwrap function. This is also when intercepting the call to the @Create method of test1.
Appreciate any advice on whether I'm doing something wrong or if this is a possible bug.
Cheers.
Mike.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009400#4009400
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009400
18Â years, 1Â month