I understand JBoss is a container and provide the
service to its components.
I have a stand-alone test program (not a component
inside the JBoss directories) and try to get a
connection from JBoss. If a JSP page (it is not inside
the JBoss container) can
get a connection, why can't a stand-alone client program
get a connection?
In the interest tutorial program
provided by JBoss, it has a client program
InterestClient.java, it is run outside the container,
It works perfectly well.
So I should be able to get a connection even it is
outside of the JBoss.
Thanks for any help.
Ed Wu
----- Original Message -----
From: "Guy Rouillier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 09, 2001 7:54 AM
Subject: Re: [JBoss-user] cann't get a connection from outside of the jboss
container.
> Use
>
> lookup("java:comp/env/jdbc/mySQLDS")
>
> in your bean, then in your ejb-jar.xml use something like this
>
> <resource-ref>
> <description>A jdbc connection</description>
> <res-ref-name>jdbc/mySQLDS</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> and finally in your jboss.xml use something like this:
>
> <resource-managers>
> <resource-manager>
> <res-jndi-name>mySQLDSndi-name>
> <res-name>jdbc/mySQLDSame>
> </resource-manager>
> </resource-managers>
>
> where the res-jndi-name is the name that shows up in the jboss console
> (after the java:/). What exactly do you mean by "My java code (outside of
> the jboss container)"? The whole purpose of JBoss (any app server) is to
> run inside the container. If you are running outside, you don't need
jboss.
>
>
> ----- Original Message -----
> From: "Ed Aihua Wu" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, April 08, 2001 3:00 AM
> Subject: [JBoss-user] cann't get a connection from outside of the jboss
> container.
>
>
> > Hi,
> >
> > I am using jboss 2.1 and I am trying to get a connection
> > from the jboss connection pool.
> >
> > I have installed a jdbc driver in jboss,
> > then I started the jboss, I can see my driver
> > is started.
> > [mySQLDS] Starting
> > [mySQLDS] XA Connection pool mySQLDS bound to java:/mySQLDS
> > [mySQLDS] Started
> >
> > My java code (outside of the jboss container) is something like this:
> > (I have tryed java:comp/env/mySQLDS, it doesn't work either.)
> >
> > System.setProperty("java.naming.factory.initial",
> > "org.jnp.interfaces.NamingContextFactory");
> > System.setProperty("java.naming.provider.url",
> > "localhost:1099");
> > Context initial = new InitialContext();
> > DataSource dataSource =
> > (DataSource)initial.lookup("java:/mySQLDS");
> > return dataSource.getConnection();
> >
> > The exception is something like this:
> >
> > javax.naming.NameNotFoundException: mySQLDS not bound
> > at
> > sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
> > RemoteCall.java:245)
> > at
> > sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
> > 220)
> > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
> > at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
> > at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:295)
> > at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
> > at javax.naming.InitialContext.lookup(InitialContext.java:350)
> > at JDBCTest.getJbossConnection(JDBCTest.java:79)
> > at JDBCTest.go(JDBCTest.java:40)
> > at JDBCTest.main(JDBCTest.java:29)
> >
> > Thanks for any help.
> >
> > Ed Wu
> >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user