<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Messaging in AS7
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/el_paso">el_paso</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/635511#635511">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi, </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm trying to make this code&#160; <a class="jive-link-external-small" href="http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/JMS_Examples-A_Pub_Sub_Example.html#A_Pub_Sub_Example-A_JMS_publisher_client">http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/JMS_Examples-A_Pub_Sub_Example.html#A_Pub_Sub_Example-A_JMS_publisher_client</a> but I always get this error:</p><p><span style="font-size: 10pt;">&#160; </span><br/>11:13:51,470 INFO&#160; [stdout] (http--127.0.0.1-8080-4) Begin sendAsync</p><p>11:13:51,470 ERROR [stderr] (http--127.0.0.1-8080-4) javax.naming.NameNotFoundException: ConnectionFactory -- service jboss.naming.context.java.ConnectionFactory</p><p>11:13:51,470 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:87)</p><p>11:13:51,470 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)</p><p>11:13:51,470 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:47)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:209)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.naming.InitialContext.lookup(Unknown Source)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.lsyh.salespotential.CommandOutput.setupPubSub(CommandOutput.java:26)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.lsyh.salespotential.CommandOutput.sendAsync(CommandOutput.java:40)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.lsyh.salespotential.CommandInputBean.sendCommand(CommandInputBean.java:40)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.lsyh.salespotential.CommandInputBean.submitButton(CommandInputBean.java:57)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at java.lang.reflect.Method.invoke(Unknown Source)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.el.parser.AstValue.invoke(AstValue.java:196)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.component.UICommand.broadcast(UICommand.java:300)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)</p><p>11:13:51,473 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)</p><p>11:13:51,475 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</p><p>11:13:51,478 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)</p><p>11:13:51,478 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)</p><p>11:13:51,478 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)</p><p>11:13:51,478 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)</p><p>11:13:51,478 ERROR [stderr] (http--127.0.0.1-8080-4)&#160; at java.lang.Thread.run(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/>Seems the problem is this:</p><p>InitialContext iniCtx = new InitialContext();</p><p>Object tmp = iniCtx.lookup("ConnectionFactory");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Maybe I'm not configuring something but what? </p><p><br/>Please help </p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/635511#635511">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>