users@glassfish.java.net

Re: Accessing a JMS Resource on a Remote Server

From: rdblaha1 <rd_blaha_at_hotmail.com>
Date: Fri, 4 Jan 2008 12:51:42 -0800 (PST)

Thanks. Your help is very much appreciated. I think you have headed me in
the right direction. I'm still stumbling somewhere.


glassfish wrote:
>
> OK, I think you're confusing two things here: "Application Client
> component" and "stand-alone Java client". The differences are described
> here:
> https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#AppClientDef
>

You are right about the "Application Client component" and "stand-alone Java
client". The description of the differences I believe were obfuscated quite
nicely in the link you provided. (Believe me, I am trying.)


glassfish wrote:
>
> Here's what I think:
> Application Client component is an AppServer client program which is
> running in an AppServer-managed environment. This configuration requires
> the AppServer presence on the same computer the client is running since it
> is run by an AppServer command: "appclient" (this is why I don't see any
> reason why one should develop an application client this way - yeah, it's
> really a pretty cool thing to use all the EJB 3.0 annotations in a
> client-side application, but it's not really a client side application if
> it's run on the server side, is it? - or maybe there's something I got
> terribly wrong here, but I've done a lot of reading (but still not
> enough...) so far but no further explanation was found). So this is
> Application Client.
>

I can see having two machines each having their own AppServer on them.
That was actually my second step in my learning process.
(First step, get a Producer and Consumer to work on one AppServer on my PC.
Second step, get a Producer via the AppSever on my PC to place messages in a
queue or topic than can be consumed by a Consumer via the AppServer on the
network system.
My current step is (as I believe you understand) is to not use an AppServer
on my PC, but still place messages in the queue or topic that can be
consumed by a Consumer viat the AppServer on the network system.
The step after will be to reverse the roles - Producer on the network
system, Consumer on my PC.)



> A stand-alone Java client is the real thing I think. It can run anywhere,
> that's why it is standalone. You start it like "java -jar myapp.jar" and
> it does the rest. No AppServer presence is needed.
>

Exactly where I am headed.



> Now, the following steps are required for a stand alone remote client to
> access EJBs of a remote server:
> https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
>

Sorry, I'm not utilizing an EJB at this time. I am using the Producer as
given in the
http://java.sun.com/javaee/5/docs/tutorial/backup/doc/index.html
http://java.sun.com/javaee/5/docs/tutorial/backup/doc/index.html Chapter
32: The Java Message Service API >> Writing Simple JMS Client Applications
>> Running JMS Client Programs on Multiple Systems




> (this is what i've written down in my previous reply - by the way I really
> suggest reading it very carefully 'cause it's very-very-very easy to miss
> important bits of information there - at least that's what happened to
> me).
>
> The java tutorial uses Application Client. If you read it carefully and
> follow it step by step, it should really work, 'cause for me it did,
>
> Anyway, what I THINK you should do is this:
> Create a new ConnectionFactory and a new Queue using the Admin Console on
> your server. Leave everything on it's default value for the connection
> factory, just set it's jndi name and delete it's propertyes (truth be
> told, I don't know how to use any kind of authentication for connection
> factory, I'm still a newbie here). For the queue, give a jndi name and a
> unique physical name and you're done, you should be able to use them in
> your stand-alone java client program.
>

Tried your idea resulting in (I think I missed one of the verys in reading
very-very-very carefully):

java -cp
C:\Sun\SDK\lib\javaee.jar;C:\Sun\SDK\lib\appserv-rt.jar;C:\Sun\SDK\lib\appserv-deployment-client.jar;C:\Sun\SDK\lib\a
ppserv-ext.jar;C:\Sun\SDK\lib\appserv-admin.jar;C:\Sun\SDK\lib\imqjmsra.jar
-jar
 dist\ProducerSA.jar queue 3
Destination type is queue
Exception in thread "main" javax.naming.NoInitialContextException: Need to
speci
fy class name in environment or system property, or as an applet parameter,
or i
n an application resource file: java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown
Source)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at producersa.Main.main(Main.java:117)


-- 
View this message in context: http://www.nabble.com/Accessing-a-JMS-Resource-on-a-Remote-Server-tp14580977p14624684.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.