users@glassfish.java.net

Re: [JMS] ConnectionFactory & Topic not set!

From: Alexis Midon <alexismidon_at_gmail.com>
Date: Wed, 27 Sep 2006 01:12:20 +0200

shame on me.
give me gun...

On 9/26/06, Cheng Fang <Cheng.Fang_at_sun.com> wrote:
>
> new PublisherBean().publishNews();
>
> seems to be wrong. You don't instantiate a bean class; you need to look
> up or use injection:
>
> public class NewsPublisherServlet extends HttpServlet {
> @EJB
> private PublisherRemote p;
>
> Cheng
>
>
>
>
> Alexis Midon wrote:
>
> > Hi all,
> >
> > I try to post messages into a topic from a servlet through a stateless
> > ejb.
> > To that aim I've followed successfully the sun jee tutorial,
> > especially the clientsessionmdb example
> > (javaeetutorial5\examples\jms\clientsessionmdb).
> > Everything works fine in the default domain, but when it comes to test
> > on my domain, I get some exceptions.
> >
> > In a first time, I simply copy/paste the tutorial code, having create
> > the same jms resources (and use "asadmin list-*" to check)
> > But at runtime some NullPointerExceptions occur :(
> >
> > With more logging in my PublisherBean, it seems that Glassfish does
> > not consider my bean as a bean, I bean that the interceptor methods
> > are not invoked, my ConnectionFactory and Topic are null, despite the
> > @Resource annotations. However deployment runs fine.
> >
> > Next step is to understand the reason why, and that's not the easy part!
> > Activating logging is useless, even FINEST on the root logger does not
> > dump any additional info.
> > I'm stuck with that NullPointerException.
> >
> > So my questions are:
> > Do you no any tricks to point out the problem?
> > Is there any security settings (roles, rights, etc)?
> > What can be wrong?
> >
> > Many thanks in advance for your help!
> >
> > Alexis
> >
> > ==============================
> > Servlet Source Code
> > ==============================
> >
> > public class NewsPublisherServlet extends HttpServlet {
> >
> > private final String cname = this.getClass().getName();
> >
> > protected void service(HttpServletRequest request,
> > HttpServletResponse response) throws ServletException, IOException {
> > String mname = "service";
> > Trace.entering(cname, mname);
> >
> > try {
> > // Gets the PublisherBean
> > new PublisherBean().publishNews();
> >
> > // Goes to the index page passing the request
> >
> > getServletContext().getRequestDispatcher("/index.jsp").forward(request,
> > response);
> > } catch (Exception e) {
> > Trace.throwing(cname, mname, e);
> >
> > getServletContext().getRequestDispatcher("/error.jsp?exception=While
> > publishing messages!").forward(request, response);
> > }
> > }
> > }
> >
> >
> > =====================================
> > Exceptions
> > =====================================
> > [#|2006-09-26T17:33:
> 24.962+0200|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=23
> > ;_ThreadNam
> >
> e=httpWorkerThread-8080-0;_RequestID=f74c3809-7e28-49c1-aad8-6c25d3c608c6;|ApplicationDispatcher[/hello]
> > "Servlet.servic
> > e()" pour la servlet jsp a lancé une exception
> > java.lang.NullPointerException
> > at org.apache.jsp.error_jsp._jspService(error_jsp.java:25)
> > at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java :820)
> > at
> > org.apache.jasper.servlet.JspServletWrapper.service(
> JspServletWrapper.java:353)
> > at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
> > at org.apache.jasper.servlet.JspServlet.service
> > (JspServlet.java:317)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.servletService(
> ApplicationFilterChain.java:397)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.doInvoke(
> ApplicationDispatcher.java:850)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(
> ApplicationDispatcher.java:697)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest
> > (ApplicationDispatcher.java:532)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(
> ApplicationDispatcher.java:465)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.forward(
> ApplicationDispatcher.java
> > :353)
> > at
> > com.yaps.hello.web.servlet.jms.NewsPublisherServlet.service(Unknown
> > Source)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.servletService
> > (ApplicationFilterChain.java:397)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:278)
> > at
> > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
> :566)
> >
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> :536)
> > at
> > org.apache.catalina.core.StandardContextValve.invokeInternal(
> StandardContextValve.java:240)
> > at org.apache.catalina.core.StandardContextValve.invoke
> > (StandardContextValve.java:179)
> > at
> > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
> :566)
> > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java
> :73)
> > at org.apache.catalina.core.StandardHostValve.invoke
> > (StandardHostValve.java:182)
> > at
> > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
> :566)
> > at
> > com.sun.enterprise.web.VirtualServerPipeline.invoke(
> VirtualServerPipeline.java:120)
> > at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:137)
> > at org.apache.catalina.core.StandardPipeline.doInvoke
> > (StandardPipeline.java:566)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> :536)
> > at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
> > at org.apache.coyote.tomcat5.CoyoteAdapter.service
> > (CoyoteAdapter.java:231)
> > at
> > com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(
> ProcessorTask.java:667)
> > at
> > com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked
> (ProcessorTask.java
> > :574)
> > at
> > com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(
> ProcessorTask.java:844)
> > at
> > com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(
> ReadTask.java:287)
> > at
> > com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java
> :212)
> > at
> > com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
> > at com.sun.enterprise.web.connector.grizzly.WorkerThread.run
> > (WorkerThread.java:75)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>