[jboss-user] [Messaging, JMS & JBossMQ] - Unable to get Connection to send a message on the testQueue

jbosspatni do-not-reply at jboss.com
Fri Aug 31 11:16:00 EDT 2007


Hi,

I am using JBOSS AS 4.2 GA and JBoss Messaging 1.3 GA.I have created an CRUD application with Seam and database is MySQL.From the entity bean created I am trying to send a message to testQueue on the server.The code from the  Stateless session bean messaging example is moved to a utility java class.

So I am getting teh following exception when i try to send te message to teh queue looks like its able to create a connection but fails on connection.start
:08,042 INFO  [STDOUT] Hibernate: insert into dummy.ticket_master (faultid, faulttype, faultdesc, faultpriority, faultlocation, deviceid, engineer, ticketpriority, ticketstatus, ticketresolution, approvalcomments, ticketid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
20:22:08,042 INFO  [STDOUT] The Quename is /queue/testQueue
20:22:08,042 INFO  [STDOUT] Inside Message Utility:send QueueName :/queue/testQueue
20:22:08,042 INFO  [STDOUT] Inside Message Utility:send
20:22:08,042 INFO  [STDOUT] Inside Message Utility:send: Before getting connection
20:22:08,042 INFO  [STDOUT] Inside Message Utility:send.getConnection:cfJBossConnectionFactory->ConnectionFactoryDelegate[1, SID=0]
20:22:08,042 INFO  [STDOUT] Inside Message Utility:send.getConnection:icjavax.naming.InitialContext at e6728c
20:22:08,042 INFO  [STDOUT] Inside Message Utility:send.getConnection:create connection
20:22:08,058 INFO  [STDOUT] Inside Message Utility:send.getConnection:before connection start:conn isJBossConnection->ConnectionDelegate[20254712, ID=4, SID=0]
20:22:08,074 ERROR [STDERR] java.lang.NullPointerException
20:22:08,074 ERROR [STDERR] 	at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:86)
20:22:08,074 ERROR [STDERR] 	at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
20:22:08,074 ERROR [STDERR] 	at org.jboss.jms.client.delegate.ClientConnectionDelegate$start_N8025343665958530775.invokeNext(ClientConnectionDelegate$start_N8025343665958530775.java)
20:22:08,074 ERROR [STDERR] 	at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
20:22:08,074 ERROR [STDERR] 	at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
20:22:08,074 ERROR [STDERR] 	at org.jboss.jms.client.delegate.ClientConnectionDelegate$start_N8025343665958530775.invokeNext(ClientConnectionDelegate$start_N8025343665958530775.java)
20:22:08,074 ERROR [STDERR] 	at org.jboss.jms.client.delegate.ClientConnectionDelegate.start(ClientConnectionDelegate.java)
20:22:08,074 ERROR [STDERR] 	at org.jboss.jms.client.JBossConnection.start(JBossConnection.java:121)
20:22:08,074 ERROR [STDERR] 	at com.dummy.util.MessageUtility.getConnection(MessageUtility.java:178)
20:22:08,074 ERROR [STDERR] 	at com.dummy.util.MessageUtility.send(MessageUtility.java:73)
20:22:08,074 ERROR [STDERR] 	at com.dummy.entity.TicketMasterHome.sendMessage(TicketMasterHome.java:69)
20:22:08,074 ERROR [STDERR] 	at com.dummy.entity.TicketMasterHome.persist(TicketMasterHome.java:47)
20:22:08,074 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:22:08,074 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
20:22:08,074 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
20:22:08,074 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:585)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:43)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.util.Work.workInTransaction(Work.java:39)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
20:22:08,074 ERROR [STDERR] 	at com.dummy.entity.TicketMasterHome_$$_javassist_30.persist(TicketMasterHome_$$_javassist_30.java)
20:22:08,074 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:22:08,074 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
20:22:08,074 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
20:22:08,074 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:585)
20:22:08,074 ERROR [STDERR] 	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:325)
20:22:08,074 ERROR [STDERR] 	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
20:22:08,074 ERROR [STDERR] 	at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
20:22:08,074 ERROR [STDERR] 	at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
20:22:08,074 ERROR [STDERR] 	at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
20:22:08,074 ERROR [STDERR] 	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
20:22:08,074 ERROR [STDERR] 	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
20:22:08,074 ERROR [STDERR] 	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
20:22:08,074 ERROR [STDERR] 	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
20:22:08,074 ERROR [STDERR] 	at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
20:22:08,074 ERROR [STDERR] 	at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
20:22:08,074 ERROR [STDERR] 	at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
20:22:08,074 ERROR [STDERR] 	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
20:22:08,074 ERROR [STDERR] 	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
20:22:08,074 ERROR [STDERR] 	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
20:22:08,074 ERROR [STDERR] 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:63)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
20:22:08,074 ERROR [STDERR] 	at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
20:22:08,074 ERROR [STDERR] 	at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
20:22:08,074 ERROR [STDERR] 	at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
20:22:08,074 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
20:22:08,074 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
20:22:08,074 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
20:22:08,074 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
20:22:08,074 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
20:22:08,074 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
20:22:08,074 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
20:22:08,074 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
20:22:08,074 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:595)
20:22:08,074 INFO  [STDOUT] Exception in persisting and send message java.lang.NullPointerException
20:22:10,932 INFO  [STDOUT] Hibernate: select ticketmast0_.ticketid as ticketid19_, ticketmast0_.faultid as faultid19_, ticketmast0_.faulttype as faulttype19_, ticketmast0_.faultdesc as faultdesc19_, ticketmast0_.faultpriority as faultpri5_19_, ticketmast0_.faultlocation as faultloc6_19_, ticketmast0_.deviceid as deviceid19_, ticketmast0_.engineer as engineer19_, ticketmast0_.ticketpriority as ticketpr9_19_, ticketmast0_.ticketstatus as tickets10_19_, ticketmast0_.ticketresolution as ticketr11_19_, ticketmast0_.approvalcomments as approva12_19_ from dummy.ticket_master ticketmast0_ limit ?
20:22:11,338 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from dummy.ticket_master ticketmast0_



The Code for the entity bean and teh helper class are as follows

package com.dummy.entity;

import javax.naming.InitialContext;

import org.jboss.example.jms.common.ExampleSupport;
import org.jboss.example.jms.queue.QueueExample;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

import com.dummy.util.MessageUtility;

@Name("ticketMasterHome")
public class TicketMasterHome extends EntityHome {

	public void setTicketMasterTicketid(Integer id) {
		setId(id);
	}

	public Integer getTicketMasterTicketid() {
		return (Integer) getId();
	}

	@Override
	protected TicketMaster createInstance() {
		TicketMaster ticketMaster = new TicketMaster();
		return ticketMaster;
	}

	public void wire() {
	}

	public boolean isWired() {
		return true;
	}

	public TicketMaster getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}
	@Override
	public String persist(){
		String retValue="";
		try
		{
			retValue = super.persist();
			//QueueExample.main(null);
			sendMessage();
		}
		catch(Exception ex)
		{
			System.out.println("Exception in persisting and send message "+ex);
		}
		return retValue;
	}
	public void sendMessage() throws Exception{
		
		InitialContext ic = new InitialContext();
        MessageUtility bean = new MessageUtility();
//	      StatelessSessionExampleHome home =
//	         (StatelessSessionExampleHome)ic.lookup("ejb/StatelessSessionExample");            
//	      
//	      StatelessSessionExample bean = home.create();
//	                  
	      String queueName = "/queue/"+ ExampleSupport.DEFAULT_QUEUE_NAME;
	      String text = "Hello!";                          
	      System.out.println("The Quename is " + queueName);
	      //bean.drain(queueName);
	      bean.initiate();                 
	      bean.send("Helloooo", queueName);
	      System.out.println("The " + text + " message was successfully sent to the " + queueName + " queue");
	          
	      int num = bean.browse(queueName);
	           
	      System.out.println("Queue browse result: " + num);            
	      
	      String result = bean.receive(queueName);
	      System.out.println("Received " + result);            
	      
	}
}






View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080045#4080045

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080045



More information about the jboss-user mailing list