0 Replies Latest reply: Mar 3, 2008 12:43 AM by Nagendra Kumar RSS

JMS topic

Nagendra Kumar Newbie

Hi Friends,

I am new in ejb topic JMS. i wrote a small program but i am getting bug when i rum my application can any body help me. I am using Jboss-4.0.2 server. I have change JNP port 1099 to 10999

I am getting Exception:-
javax.servlet.ServletException: ejb not bound
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)


ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>HelloListener</ejb-name>
<ejb-class>org.jboss.docs.jms.mdb.bean.HelloListener</ejb-class>
<message-selector></message-selector>
<transaction-type>Container</transaction-type>
<ejb-ref>
The Workers home
<ejb-ref-name> ejb/worker </ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
org.jboss.docs.jms.mdb.interfaces.HelloWorkerHome
org.jboss.docs.jms.mdb.interfaces.HelloWorker
<ejb-link>HelloWorkerBean</ejb-link>
</ejb-ref>
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
</message-driven>

Worker bean
<display-name>HelloWorkerBean</display-name>
<ejb-name>HelloWorkerBean</ejb-name>
org.jboss.docs.jms.mdb.interfaces.HelloWorkerHome
org.jboss.docs.jms.mdb.interfaces.HelloWorker
<ejb-class>org.jboss.docs.jms.mdb.bean.HelloWorkerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</enterprise-beans>
<assembly-descriptor>
<container-transaction>

<ejb-name>HelloListener</ejb-name>
<method-name>*</method-name>

<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>

<ejb-name>HelloWorkerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>

<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>


index.jsp


<%@ page import="javax.naming.InitialContext,
javax.naming.Context,
java.util.Properties,
test.session.MyTestSessionHome,
test.session.MyTestSession,
javax.rmi.PortableRemoteObject,
org.jboss.docs.jms.mdb.interfaces.HelloWorker,
org.jboss.docs.jms.mdb.interfaces.HelloWorkerHome
"%>
<%
test.session.MyTestSessionHome testSessionBean;
long t1 = System.currentTimeMillis();
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:10999");
System.out.println("Poonam kumari from jsp");
Context ctx = new InitialContext(props);
HelloWorkerHome helloWorkerHomes =
(HelloWorkerHome)ctx.lookup(" java:comp/env/ejb/worker ");
%>