[JBoss Messaging] - Re: Jboss Messaging How To
by sudheer_java26
Please tell me how to create durable topic in jboss messaging ?
when i changed method
before
|
| TopicSubscriber recv = session.createSubscriber(topic);
|
| after
|
| TopicSubscriber recv = session.createDurableSubscriber(topic,"My Durable Exp....");
even after stop sending my sender.java program my lister is able to listen the messages ? i gusss this is unlike JBOSSMQ.
Listener.java code
============
| import java.util.Properties;
|
| import javax.jms.JMSException;
| import javax.jms.Message;
| import javax.jms.MessageListener;
| import javax.jms.TextMessage;
| import javax.jms.Topic;
| import javax.jms.TopicConnection;
| import javax.jms.TopicConnectionFactory;
| import javax.jms.TopicSession;
| import javax.jms.TopicSubscriber;
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
|
| public class Listener implements MessageListener {
|
| String url_;
| String name_;
| TopicConnection conn = null;
| TopicSession session = null;
| Topic topic = null;
|
| public Listener(String url, String name) {
| super();
|
| url_ = url;
| name_ = name;
|
| try {
| this.initializeListener();
| } catch (Exception e) {
| System.out.println("Error creating listener: " + e);
| e.printStackTrace();
| }
|
| }
|
| public void onMessage(Message msg) {
|
| TextMessage tm = (TextMessage) msg;
|
| try {
| System.out.println("Incoming message: " + tm.getText());
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
| private void initializeListener() throws JMSException, NamingException {
|
| Properties props = new Properties();
| props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
| props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
| props.setProperty("java.naming.provider.url", url_);
|
| Context context = new InitialContext(props);
| System.out.println("performing lookup...");
|
| Object tmp = context.lookup("MyExampleConnectionFactory");
| System.out.println("lookup completed, making topic");
|
| TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
| conn = tcf.createTopicConnection();
| topic = (Topic) context.lookup(name_);
|
| session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
| conn.start();
|
| //TopicSubscriber recv = session.createSubscriber(topic);
|
| TopicSubscriber recv = session.createDurableSubscriber(topic,"My Durable Exp....");
| recv.setMessageListener(this);
| }
|
|
| public void disconnect() throws JMSException {
| if(conn != null) {
| conn.stop();
| }
|
| if(session != null) {
| session.close();
| }
|
| if(conn != null) {
| conn.close();
| }
| }
|
| public static void main(String args[]) {
|
| System.out.println("Starting JMS Example Listener");
| System.out.println("Program will be active for 1 minute.");
|
| //change these values to your situtation:
| Listener listener = new Listener("localhost:1099", "topic/myTopic3");
|
|
| //leave it open for 2 minutes:
| try {
| Thread.sleep(5000);
| } catch(Exception e) {
| System.out.println("Error sleeping: " + e);
| e.printStackTrace();
| }
|
| try {
| listener.disconnect();
| } catch(Exception e) {
| System.out.println("Error terminating listener JMS objects: " + e);
| e.printStackTrace();
| }
|
| System.out.println("Done listening");
| }
|
| }
I guess to create "durable topic" we need to create user, role for durable.
i referred the docs but i did't found prper information .
please help me
-----------
-Sudheer
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145831#4145831
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145831
18 years
[JBoss jBPM] - Re: Problem in deploying processdefinition in a war file - S
by syedtaj
Solved the problem
When we use the following code
ProcessDefinition.parseXmlResource(âÂÂAutomationService/processdefintion.xmlâÂÂ)
to parse the xml so that we can deploy it, It uses a ClassLoader internally instantiated by its own custom class â ClassLoaderUtil.java to load the resource, and for some reason it searches for the resources with respect to where the lib file â jbpm-jpdl.jar is present.
Till now I had placed the jar files in the <Jboss_home>\server\default\lib. I removed them and placed them in the automation.war/WEB-INF/lib and now it works. Am I missing something. How can the resource loader search with respect to where the lib is placed, shouldnâÂÂt it searching the entire classpath?
If I create my own class loader I am able to place it in the classpath and it picks it up, but since that would instantiate a separate class loader, it cannot find the action classes that would have been loaded by JBOSS class loader.
I know I am missing something, though it works now, I really would like to know why is the above phenomenon occurring.
Cheers.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145830#4145830
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145830
18 years
[JBoss Portal] - Unable to itrate through portal nodes
by shankarkhanna
Hi,
I am not able to get childeren of a portal node. I am getting this exception ( org.hibernate.HibernateException: Unable to locate current JTA transaction
)
Here is my code:
protected void doView(JBossRenderRequest req, JBossRenderResponse res) throws PortletException, PortletSecurityException, IOException {
|
| res.setContentType("text/html");
| PortalNode portalNode = req.getPortalNode();
|
| Locale locale = req.getLocale();
| if (locale == null)
| locale = Locale.getDefault();
|
| while (portalNode.getType() != PortalNode.TYPE_PORTAL)
| {
| portalNode = portalNode.getParent();
| System.out.println(portalNode.getDisplayName(locale));
| System.out.println(portalNode.getName());
| System.out.println(portalNode.getType());
| }
|
| Iterator childrenIt = portalNode.getChildren().iterator();
|
| while (childrenIt.hasNext())
| {
| PortalNode child = (PortalNode)childrenIt.next();
| System.out.println(child.getDisplayName(locale));
| }
| }
Code does not work at this line:
Iterator childrenIt = portalNode.getChildren().iterator();
This is an exception that i am facing
18:46:04,984 ERROR [PortalPermissionCollection] Permission check against the repository failed
| org.hibernate.HibernateException: Unable to locate current JTA transaction
| at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
| at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:544)
| at org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNode(PersistentPortalObjectContainer.java:252)
| at org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.getPermission(AbstractPortalObjectContainer.java:166)
| at org.jboss.portal.core.model.portal.PortalObjectPermission.implies(PortalObjectPermission.java:227)
| at org.jboss.portal.security.PortalPermissionCollection.implies(PortalPermissionCollection.java:96)
| at org.jboss.portal.security.impl.jacc.Permissions.implies(Permissions.java:93)
| at org.jboss.portal.security.impl.jacc.SecurityContext.implies(SecurityContext.java:81)
|
|
|
| Please Help
|
|
| Shankar Khanna
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145826#4145826
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145826
18 years
[Clustering/JBoss] - Re: Worker thread initialization failure
by Sarfaraz
I am using 4.2.2 GA.
I too am getting similar error
Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
java.io.OptionalDataException
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:175)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy0.create(Unknown Source)
at com.pcm.rules.service.blaze.BlazeEJBExecutor.getEJBHandle(BlazeEJBExecutor.java:82)
... 5 more
Caused by: java.io.OptionalDataException
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.invocation.unified.marshall.InvocationUnMarshaller.read(InvocationUnMarshaller.java:48)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
... 17 more
Plz assist
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145823#4145823
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145823
18 years