jspInit() throwing NamingException when extracting a factory object from JNDI context

2005-02-03 Thread Yogi



BUG ID: http://issues.apache.org/bugzilla/show_bug.cgi?id=33307


Problem:
 
jspInit() throwing NamingException when extracting a factory
object
  from JNDI context.

Description: 

 When the container has been configured to load the JSP page 
 during startup by including the Load-On-Startup tag in web.xml,
the
 NamingException has been reported( can be viewed in the
attachment).

The Tomcat Version which we are using is Tomcat 4.1.3.

How to Reproduce the problem:
-
Step 1) create a directory under webapps (say test) and unzip the
attached 
   jsppax.zip into the test dir under webapps.
Step 2) add the following lines to server.xml
   
   Context path=/test docBase=d:\jakarta-tomcat-4.1.30\webapps\test
debug=0/
 !-- DefaultContext --
DefaultContext reloadable=true crossContext=true
useNaming=true
!-- bean/MyBeanFactory --
   Resource name=bean/MyBeanFactory auth=Container
type=com.mycompany.MyBean/
   ResourceParams name=bean/MyBeanFactory
parameter
namefactory/name
 
valueorg.apache.naming.factory.BeanFactory/value
/parameter
parameter
namebar/name
value23/value
/parameter
   /ResourceParams
   /DefaultContext
!-- /DefaultContext --  

Step 3) start the server 
During startup, the NamingException has been reported.

We tried with couple of other Tomcat versions aswell it is poping that 
NamingException with them also.

Please letus know if you had any issues while reproducing the above
exception. 
You can refer to the bugid :33307 if you need more information. Please
let us 
Know if it is a configuration issue or a bug in JSP-TomCat. Awaiting yor
response..

Thanks in Advance
Yogi



Confidentiality Notice  
The information contained in this electronic 
message and any attachments to this message are
intended for the exclusive use of the addressee(s)
and may contain confidential or privileged information.
If you are not the intended recipient, please notify 
the sender at Wipro or [EMAIL PROTECTED] immediately 
and destroy all copies of this message and any attachments.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: jspInit() throwing NamingException when extracting a factory object from JNDI context

2005-02-03 Thread Yogi


Appreciate if any one has some inputsWe couldn't decide whether it
is a bug or usage issue,...


Details @ http://issues.apache.org/bugzilla/show_bug.cgi?id=33307


Problem:
 
jspInit() throwing NamingException when extracting a factory
object
  from JNDI context.

Description: 

 When the container has been configured to load the JSP page 
 during startup by including the Load-On-Startup tag in web.xml,
the
 NamingException has been reported( can be viewed in the
attachment).

The Tomcat Version which we are using is Tomcat 4.1.3.

How to Reproduce the problem:
-
Step 1) create a directory under webapps (say test) and unzip the
attached 
   jsppax.zip into the test dir under webapps.
Step 2) add the following lines to server.xml
   
   Context path=/test docBase=d:\jakarta-tomcat-4.1.30\webapps\test
debug=0/
 !-- DefaultContext --
DefaultContext reloadable=true crossContext=true
useNaming=true
!-- bean/MyBeanFactory --
   Resource name=bean/MyBeanFactory auth=Container
type=com.mycompany.MyBean/
   ResourceParams name=bean/MyBeanFactory
parameter
namefactory/name
 
valueorg.apache.naming.factory.BeanFactory/value
/parameter
parameter
namebar/name
value23/value
/parameter
   /ResourceParams
   /DefaultContext
!-- /DefaultContext --  

Step 3) start the server 
During startup, the NamingException has been reported.

We tried with couple of other Tomcat versions aswell it is poping that 
NamingException with them also.

Please letus know if you had any issues while reproducing the above
exception. 
You can refer to the bugid :33307 if you need more information. Please
let us 
Know if it is a configuration issue or a bug in JSP-TomCat. Awaiting yor
response..

Thanks in Advance
Yogi



Confidentiality Notice  
The information contained in this electronic 
message and any attachments to this message are
intended for the exclusive use of the addressee(s)
and may contain confidential or privileged information.
If you are not the intended recipient, please notify 
the sender at Wipro or [EMAIL PROTECTED] immediately 
and destroy all copies of this message and any attachments.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Confidentiality Notice  
The information contained in this electronic 
message and any attachments to this message are
intended for the exclusive use of the addressee(s)
and may contain confidential or privileged information.
If you are not the intended recipient, please notify 
the sender at Wipro or [EMAIL PROTECTED] immediately 
and destroy all copies of this message and any attachments.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



jspInit() throwing NamingException when extracting a factory object from JNDI context

2005-02-03 Thread Yogi

I feel, we tried many combinations to see if it is a configurations
issue, but of now use.
It seems to be a bug in Tomcat  it is present in all the versions we
tried out. We are
declaring it as a bug, let us know if any one has any other
suggestions/soln to try out.

Thanks in advance,
Yogi

-Original Message-
From: Yogi [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 03, 2005 7:47 PM
To: 'Tomcat Users List'
Subject: RE: jspInit() throwing NamingException when extracting a
factory object from JNDI context

Appreciate if any one has some inputsWe couldn't decide whether it
is a bug or usage issue,...

Details @ http://issues.apache.org/bugzilla/show_bug.cgi?id=33307

Problem:
 
jspInit() throwing NamingException when extracting a factory
object
  from JNDI context.

Description: 

 When the container has been configured to load the JSP page 
 during startup by including the Load-On-Startup tag in web.xml,
the
 NamingException has been reported( can be viewed in the
attachment).

The Tomcat Version which we are using is Tomcat 4.1.3.

How to Reproduce the problem:
-
Step 1) create a directory under webapps (say test) and unzip the
attached 
   jsppax.zip into the test dir under webapps.
Step 2) add the following lines to server.xml
   
   Context path=/test docBase=d:\jakarta-tomcat-4.1.30\webapps\test
debug=0/
 !-- DefaultContext --
DefaultContext reloadable=true crossContext=true
useNaming=true
!-- bean/MyBeanFactory --
   Resource name=bean/MyBeanFactory auth=Container
type=com.mycompany.MyBean/
   ResourceParams name=bean/MyBeanFactory
parameter
namefactory/name
 
valueorg.apache.naming.factory.BeanFactory/value
/parameter
parameter
namebar/name
value23/value
/parameter
   /ResourceParams
   /DefaultContext
!-- /DefaultContext --  

Step 3) start the server 
During startup, the NamingException has been reported.

We tried with couple of other Tomcat versions aswell it is poping that 
NamingException with them also.

Please letus know if you had any issues while reproducing the above
exception. 
You can refer to the bugid :33307 if you need more information. Please
let us 
Know if it is a configuration issue or a bug in JSP-TomCat. Awaiting yor
response..

Thanks in Advance
Yogi



Confidentiality Notice  
The information contained in this electronic 
message and any attachments to this message are
intended for the exclusive use of the addressee(s)
and may contain confidential or privileged information.
If you are not the intended recipient, please notify 
the sender at Wipro or [EMAIL PROTECTED] immediately 
and destroy all copies of this message and any attachments.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat 5.5 and jndi context naming error

2004-12-22 Thread Ken Hall
I've been trying out many different avenues to make this work and
finally found the following bug, hopefully this will save other people
some time:

 

http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg64410.html

 

which says:

 

And finally i find the solution,that is to remove all Naming-*.jar out 

from /%myapp_home%/WEB-INF/lib.I firmly think there's some disorder
with 

tomcat classloader.In other words,ClassLoader may not check which class
to be 

loader first and which to be loaded second and which have already be
loaded!

 

-Ken

 



From: Ken Hall 
Sent: Thursday, December 16, 2004 3:41 PM
To: '[EMAIL PROTECTED]'
Subject: tomcat 5.5 and jndi context naming error

 

Since downloading the new version of Tomcat 5.5.4, I have been
experiencing problems with jndi resources within my web app. I am
porting over from an existing server where that resource is working. The
error is listed at the bottom.

 

I saw in the release notes that naming-common.jar (JNDI Context
implementation) is one of the required files but it does not appear to
be included in the download. When I include it from a previous release,
it appears to not like it. When I leave it out, it can not find the jndi
context either.
 
java.lang.NoSuchMethodError:
org.apache.naming.NamingContextBindingsEnumeration.
init(Ljava/util/Iterator;)V
at
org.apache.naming.resources.FileDirContext.listBindings(FileDirContex
t.java:335)
at
org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirCont
ext.java:515)
at
org.apache.catalina.util.ExtensionValidator.validateApplication(Exten
sionValidator.java:178)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3
934)
 
 
Here is my set up. Any help is greatly appreciated. I can't do anything
with this release till this is solved. Thanks!

-Ken Hall

 

According to the docs, the preferred method is not messing with the
server.xml but creating an application.xml. I've tried both name value
pairs and resource parameters. This is done and placed in the
conf\Catalina\localhost directory:

 

?xml version='1.0' encoding='utf-8'?

Context docBase=c:/jakarta-tomcat-5.5/webapps/myapp path=/myapp
workDir=work\Catalina\localhost\myapp

Resource auth=Container name=jdbc/myapp
type=javax.sql.DataSource/

ResourceParams name=jdbc/myapp

  parameter

namemaxWait/name

value5000/value

  /parameter

  parameter

namemaxActive/name

value6/value

  /parameter

  parameter

nameusername/name

valuexx/value

  /parameter

  parameter

nameremoveAbandoned/name

valuetrue/value

  /parameter  

  parameter

namepassword/name

valuexx/value

  /parameter  

  parameter

nameurl/name

valuejdbc:jtds:sqlserver://server:1433/myapp/value

  /parameter

  parameter

namedriverClassName/name

valuenet.sourceforge.jtds.jdbc.Driver/value

  /parameter

  parameter

namemaxIdle/name

value2/value

  /parameter

/ResourceParams  

/Context

 

 

In my app's web.xml I have:

 

/servlet-mapping 

 

  resource-ref 

res-ref-namejdbc/myapp/res-ref-name

res-typejavax.sql.DataSource/res-type

res-authContainer/res-auth

  /resource-ref

 

welcome-file-list

 

 

 

My application is referencing the context like this: 

InitialContext initContext = new javax.naming.InitialContext();

Context envContext=(Context)initContext.lookup(java:comp/env);

DataSource ds = (DataSource)envContext.lookup(jdbc/myapp);

 

 

 

//Error upon calling context

SEVERE: Null component
Catalina:type=DataSource,path=/myapp,host=localhost,class=javax.sql.Data
Source,name=jdbc/myapp

Unable to connect to myapp database. Class Not Found.Name java:comp is
not bound in this Context

javax.naming.NameNotFoundException: Name java:comp is not bound in this
Context

  at org.apache.naming.NamingContext.lookup(NamingContext.java:768)

  at org.apache.naming.NamingContext.lookup(NamingContext.java:151)

  at javax.naming.InitialContext.lookup(InitialContext.java:351)

  at my.load.servlet

  at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:1053)

  at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:886)

  at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:3817)

  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4079
)

  at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.ja
va:755)

  at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)

  at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525

Re: tomcat 5.5 and jndi context naming error

2004-12-22 Thread Jacob Kjome

There should be away around this type of issue.  I believe Tomcat already
actively avoids loading java, javax, org.xml, org.w3c.dom, org.apache.xerces
packages from WEB-INF/lib (I hope my memory isn't failing me here).  Given
this, maybe Tomcat should endorse certain core libraries so that they won't
be accidentally loaded from WEB-INF/lib, thus avoiding this issue altogether?

Jake

Quoting Ken Hall [EMAIL PROTECTED]:

 I've been trying out many different avenues to make this work and
 finally found the following bug, hopefully this will save other people
 some time:



 http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg64410.html



 which says:



 And finally i find the solution,that is to remove all Naming-*.jar out

 from /%myapp_home%/WEB-INF/lib.I firmly think there's some disorder
 with

 tomcat classloader.In other words,ClassLoader may not check which class
 to be

 loader first and which to be loaded second and which have already be
 loaded!



 -Ken



 

 From: Ken Hall
 Sent: Thursday, December 16, 2004 3:41 PM
 To: '[EMAIL PROTECTED]'
 Subject: tomcat 5.5 and jndi context naming error



 Since downloading the new version of Tomcat 5.5.4, I have been
 experiencing problems with jndi resources within my web app. I am
 porting over from an existing server where that resource is working. The
 error is listed at the bottom.



 I saw in the release notes that naming-common.jar (JNDI Context
 implementation) is one of the required files but it does not appear to
 be included in the download. When I include it from a previous release,
 it appears to not like it. When I leave it out, it can not find the jndi
 context either.

 java.lang.NoSuchMethodError:
 org.apache.naming.NamingContextBindingsEnumeration.
 init(Ljava/util/Iterator;)V
 at
 org.apache.naming.resources.FileDirContext.listBindings(FileDirContex
 t.java:335)
 at
 org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirCont
 ext.java:515)
 at
 org.apache.catalina.util.ExtensionValidator.validateApplication(Exten
 sionValidator.java:178)
 at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3
 934)


 Here is my set up. Any help is greatly appreciated. I can't do anything
 with this release till this is solved. Thanks!

 -Ken Hall



 According to the docs, the preferred method is not messing with the
 server.xml but creating an application.xml. I've tried both name value
 pairs and resource parameters. This is done and placed in the
 conf\Catalina\localhost directory:



 ?xml version='1.0' encoding='utf-8'?

 Context docBase=c:/jakarta-tomcat-5.5/webapps/myapp path=/myapp
 workDir=work\Catalina\localhost\myapp

 Resource auth=Container name=jdbc/myapp
 type=javax.sql.DataSource/

 ResourceParams name=jdbc/myapp

   parameter

 namemaxWait/name

 value5000/value

   /parameter

   parameter

 namemaxActive/name

 value6/value

   /parameter

   parameter

 nameusername/name

 valuexx/value

   /parameter

   parameter

 nameremoveAbandoned/name

 valuetrue/value

   /parameter

   parameter

 namepassword/name

 valuexx/value

   /parameter

   parameter

 nameurl/name

 valuejdbc:jtds:sqlserver://server:1433/myapp/value

   /parameter

   parameter

 namedriverClassName/name

 valuenet.sourceforge.jtds.jdbc.Driver/value

   /parameter

   parameter

 namemaxIdle/name

 value2/value

   /parameter

 /ResourceParams

 /Context





 In my app's web.xml I have:



 /servlet-mapping



   resource-ref

 res-ref-namejdbc/myapp/res-ref-name

 res-typejavax.sql.DataSource/res-type

 res-authContainer/res-auth

   /resource-ref



 welcome-file-list







 My application is referencing the context like this:

 InitialContext initContext = new javax.naming.InitialContext();

 Context envContext=(Context)initContext.lookup(java:comp/env);

 DataSource ds = (DataSource)envContext.lookup(jdbc/myapp);







 //Error upon calling context

 SEVERE: Null component
 Catalina:type=DataSource,path=/myapp,host=localhost,class=javax.sql.Data
 Source,name=jdbc/myapp

 Unable to connect to myapp database. Class Not Found.Name java:comp is
 not bound in this Context

 javax.naming.NameNotFoundException: Name java:comp is not bound in this
 Context

   at org.apache.naming.NamingContext.lookup(NamingContext.java:768)

   at org.apache.naming.NamingContext.lookup(NamingContext.java:151)

   at javax.naming.InitialContext.lookup(InitialContext.java:351)

   at my.load.servlet

   at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
 a:1053)

   at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java

Re: tomcat 5.5 and jndi context naming error

2004-12-17 Thread Román Pena

- Original Message - 
From: Ken Hall [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 16, 2004 10:41 PM
Subject: tomcat 5.5 and jndi context naming error


Since downloading the new version of Tomcat 5.5.4, I have been
experiencing problems with jndi resources within my web app. I am
porting over from an existing server where that resource is working.

I think you shoud change your config. From 5.0 to 5.5, the context xml
files have changed. Now, instead of using resource params, you should
use attributes in the Resource tag. Change this:

Resource auth=Container
  name=jdbc/myapp
  type=javax.sql.DataSource/

ResourceParams name=jdbc/myapp
  parameter
namemaxWait/name
value5000/value
  /parameter
  (...)
/ResourceParams  

To this:

Resource auth=Container
  name=jdbc/myapp
  type=javax.sql.DataSource
  maxWait=5000
  (...)
/ 

 

I had the same problem, but it took me some time and headaches to
notice the documentation had changed. Maybe the docs for 5.5
should have reflected the changes with BIG RED LETTERS or so.
I'd want the people at the Jakarta project to think of it:
If you save half an hour to each developer or admin who migrates
to 5.5, maybe you are saving 2 or 3 lives a month :D
--Steve jobs way of thinking ;)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



tomcat 5.5 and jndi context naming error

2004-12-16 Thread Ken Hall
Since downloading the new version of Tomcat 5.5.4, I have been
experiencing problems with jndi resources within my web app. I am
porting over from an existing server where that resource is working. The
error is listed at the bottom.

 

I saw in the release notes that naming-common.jar (JNDI Context
implementation) is one of the required files but it does not appear to
be included in the download. When I include it from a previous release,
it appears to not like it. When I leave it out, it can not find the jndi
context either.
 
java.lang.NoSuchMethodError:
org.apache.naming.NamingContextBindingsEnumeration.
init(Ljava/util/Iterator;)V
at
org.apache.naming.resources.FileDirContext.listBindings(FileDirContex
t.java:335)
at
org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirCont
ext.java:515)
at
org.apache.catalina.util.ExtensionValidator.validateApplication(Exten
sionValidator.java:178)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3
934)
 
 
Here is my set up. Any help is greatly appreciated. I can't do anything
with this release till this is solved. Thanks!

-Ken Hall

 

According to the docs, the preferred method is not messing with the
server.xml but creating an application.xml. I've tried both name value
pairs and resource parameters. This is done and placed in the
conf\Catalina\localhost directory:

 

?xml version='1.0' encoding='utf-8'?

Context docBase=c:/jakarta-tomcat-5.5/webapps/myapp path=/myapp
workDir=work\Catalina\localhost\myapp

Resource auth=Container name=jdbc/myapp
type=javax.sql.DataSource/

ResourceParams name=jdbc/myapp

  parameter

namemaxWait/name

value5000/value

  /parameter

  parameter

namemaxActive/name

value6/value

  /parameter

  parameter

nameusername/name

valuexx/value

  /parameter

  parameter

nameremoveAbandoned/name

valuetrue/value

  /parameter  

  parameter

namepassword/name

valuexx/value

  /parameter  

  parameter

nameurl/name

valuejdbc:jtds:sqlserver://server:1433/myapp/value

  /parameter

  parameter

namedriverClassName/name

valuenet.sourceforge.jtds.jdbc.Driver/value

  /parameter

  parameter

namemaxIdle/name

value2/value

  /parameter

/ResourceParams  

/Context

 

 

In my app's web.xml I have:

 

/servlet-mapping 

 

  resource-ref 

res-ref-namejdbc/myapp/res-ref-name

res-typejavax.sql.DataSource/res-type

res-authContainer/res-auth

  /resource-ref

 

welcome-file-list

 

 

 

My application is referencing the context like this: 

InitialContext initContext = new javax.naming.InitialContext();

Context envContext=(Context)initContext.lookup(java:comp/env);

DataSource ds = (DataSource)envContext.lookup(jdbc/myapp);

 

 

 

//Error upon calling context

SEVERE: Null component
Catalina:type=DataSource,path=/myapp,host=localhost,class=javax.sql.Data
Source,name=jdbc/myapp

Unable to connect to myapp database. Class Not Found.Name java:comp is
not bound in this Context

javax.naming.NameNotFoundException: Name java:comp is not bound in this
Context

  at org.apache.naming.NamingContext.lookup(NamingContext.java:768)

  at org.apache.naming.NamingContext.lookup(NamingContext.java:151)

  at javax.naming.InitialContext.lookup(InitialContext.java:351)

  at my.load.servlet

  at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:1053)

  at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:886)

  at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:3817)

  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4079
)

  at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.ja
va:755)

  at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)

  at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

  at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:777)

  at
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:672)

  at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)

  at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1079)

  at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:31
0)

  at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu
pport.java:119)

  at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)

  at
org.apache.catalina.core.StandardHost.start(StandardHost.java:718)

  at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003

Re: AD authentication if exact jndi context not known

2004-03-10 Thread Martin Rostan
Hi, I'm trying to use referrals=follow in the JNDIRealm in order to 
make it work against Active Directory, but it's not working, I' 
receiving the exception below (I'm supposing the AD process is broken).
Also I've found that the JNDI tutorial says that referrals=follow 
doesn't work for AD: 
http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html

Somebody knows if referrals=follow is working with Active Directory? 
if somebody has it working, please send me the version of AD you're using.

Thanks in advance

P.S. Sorry if this message arrives duplicated, I sent it yesterday but I 
don't see it on the mailing list.

2004-03-03 09:01:31 JNDIRealm[Standalone]: Exception performing 
authentication
javax.naming.PartialResultException.  Root exception is 
javax.naming.CommunicationException: neptuno:389.  Root exception is 
java.net.ConnectException: Connection timed out: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
 at java.net.Socket.connect(Socket.java:426)
 at java.net.Socket.connect(Socket.java:376)
 at java.net.Socket.init(Socket.java:291)
 at java.net.Socket.init(Socket.java:119)
 at com.sun.jndi.ldap.Connection.createSocket(Connection.java:346)
 at com.sun.jndi.ldap.Connection.init(Connection.java:181)
 at com.sun.jndi.ldap.LdapClient.init(LdapClient.java:119)
 at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1668)
 at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2528)
 at com.sun.jndi.ldap.LdapCtx.init(LdapCtx.java:275)
 at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:173)
 at 
com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:134) 

 at 
com.sun.jndi.url.ldap.ldapURLContextFactory.getObjectInstance(ldapURLContextFactory.java:35) 

 at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:579)
 at javax.naming.spi.NamingManager.processURL(NamingManager.java:361)
 at javax.naming.spi.NamingManager.processURLAddrs(NamingManager.java:341)
 at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
 at 
com.sun.jndi.ldap.LdapReferralContext.init(LdapReferralContext.java:93)
 at 
com.sun.jndi.ldap.LdapReferralException.getReferralContext(LdapReferralException.java:132) 

 at 
com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreReferrals(LdapNamingEnumeration.java:334) 

 at 
com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:207) 

 at 
com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:170) 

 at 
org.apache.catalina.realm.JNDIRealm.getUserBySearch(JNDIRealm.java:1036)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: howto federate tomcat JNDI to another JNDI context ?

2004-01-27 Thread Nicolas De Loof
Hi mark,

I solved my JNDI federation problem and maybe you are interested to know how ?

JustToRememberMyProblem
I want to get JMS ressources from JNDI. They're stored in a FileSystem JNDI
and I need to federate it to Tomcat JNDI.
/JustToRememberMyProblem


I added a custom factory to tomcat (in commons/classes):

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.Name;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;

public class JndiFederationFactory implements ObjectFactory {

  public Object getObjectInstance(
Object obj,
Name name,
Context nameCtx,
Hashtable environment)
  throws NamingException {

  Reference ref = (Reference) obj;
  Enumeration addrs = ref.getAll();
  String lookup = null;
  Properties props = new Properties();
  while (addrs.hasMoreElements()) {
  RefAddr addr = (RefAddr) addrs.nextElement();
  String type = addr.getType();
  String value = (String) addr.getContent();
  if (type.equals(lookup)) {
  lookup = value;
  } else {
  props.put(type, value);
  }
  }
  InitialContext ctx = new InitialContext(props);
  if (lookup == null) {
throw new NamingException(la propriété lookup doit être définie);
  }
  return ctx.lookup(lookup);
  }
}


I added IBM MQSeries/JMS client classes to commons/lib

I added this conf in server.xml :

  Resource name=jms/QueueConnexionFactory auth=Container
type=javax.jms.QueueConnexionFactory/
  ResourceParams name=jms/QueueConnexionFactory
parameter
  namefactory/name
  valuecom.cgey.JndiFederationFactory/value
/parameter
parameter
  namelookup/name
  valueurlQmgrLocal/value
/parameter
parameter
  namejava.naming.factory.initial/name
  valuecom.sun.jndi.fscontext.RefFSContextFactory/value
/parameter
parameter
  namejava.naming.security.authentication/name
  valuenone/value
/parameter
parameter
  namejava.naming.provider.url/name
  valuefile:///c:/MQSeries/jndi/value
/parameter
  /ResourceParams

Using this, I can lookup in local JNDI from my webapp for jms/QueueConnexionFactory 
and get the MQSeries
QueueConnexionFactory defined in a FileSystem JNDI Context. This is a pseudo JNDI 
Federation, but it works fine.

Nico.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



howto federate tomcat JNDI to another JNDI context ?

2004-01-14 Thread Nicolas De Loof
Hello,

I would like to use tomcat JNDI to lookup JMS Queues (MQSeries) that are registered in 
JNDI using a File System JNDI
Context (com.sun.jndi.fscontext.RefFSContextFactory)

My webapp refers to a JNDI resource named jms/testQueueConnectionFactory, and I need 
to configure tomcat internal JNDI
to federate java:com/env/jms JNDI namespace to the FileSystem JNDI context.

I've not find any example in mailing-list archive about this. Can anyone tell me How 
to configure tomcat to do this ?

Nico.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: howto federate tomcat JNDI to another JNDI context ?

2004-01-14 Thread Mark R. Diggory
Hello Nico,

Yes I've been attempting to do the same thing with suns LDAP Context. 
Unfortunately (even for myself as an Apache Jakarta Developer, neither 
the tomcat user or developer lists have gotten any responses to my emails).

I've done several attempts to start a discussion on this, maybe you will 
find my mistake path helpful:
Tomcat User:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg114976.html
http://www.mail-archive.com/[EMAIL PROTECTED]/msg114923.html

Tomcat Dev:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg51159.html
The nearest I can figure out is that you may have to write your own 
object factory to instantiate the objects even if one is provided by 
Sun. Otherwise your really going to be troubled with what ResourceParams 
are actually getting configured into the federated Context. I actually 
had to decompile the ldap factory com.sun.jndi.ldap.LdapCtxFactory to 
identify the fact that it sets none of these 
ReferenceAddrs/ResourceParams properly into the environment of the new 
context.

If your studying all the JNDI Tutorial stuff and documentation its 
important to note that whats really getting set when you create Resource 
Params like this are Reference/ReferenceAddrs in JNDI.

Resource type=com.sun.jndi.ldap.LdapCtxFactory auth=Container
name=ldap/
ResourceParams name=ldap
   parameter
  namejava.naming.factory.initial/name
  valuecom.sun.jndi.ldap.LdapCtxFactory/value
   /parameter
/ResourceParams
equates to:

Hashtable env = new Hashtable();
Reference ref = (Reference) obj;
Enumeration addrs = ref.getAll();
while (addrs.hasMoreElements()) {
   RefAddr addr = (RefAddr) addrs.nextElement();
   if(!addr.getType().equals(factory))
  env.put(addr.getType(), addr.getContent().toString());
   }
return this.getInitialContext(env);
in the factory (which all kinda sucks for anyone trying to use an 
existing factory that may not actually do this consistently.

Unfortunately the JNDI tutorial is rather weak in substance when it 
comes to actually federating two namespaces.

http://java.sun.com/products/jndi/tutorial/objects/factory/reference.html
http://java.sun.com/products/jndi/tutorial/beyond/fed/index.html
Good Luck, I'm glad to chat with someone having a similar problem.

-Mark Diggory

Nicolas De Loof wrote:
Hello,

I would like to use tomcat JNDI to lookup JMS Queues (MQSeries) that are registered in 
JNDI using a File System JNDI
Context (com.sun.jndi.fscontext.RefFSContextFactory)
My webapp refers to a JNDI resource named jms/testQueueConnectionFactory, and I need 
to configure tomcat internal JNDI
to federate java:com/env/jms JNDI namespace to the FileSystem JNDI context.
I've not find any example in mailing-list archive about this. Can anyone tell me How to configure tomcat to do this ?

Nico.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://osprey.hmdc.harvard.edu
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Accessing JNDI Context from outside Tomcat

2003-12-22 Thread Shapira, Yoav

Howdy,
There's no way, tomcat's JNDI is internal only.  It wouldn't hurt you to
search this list's archives, as this question has been answered many
times in the past including at least once within the last two weeks.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Swaminathan Gurumoorthy [mailto:[EMAIL PROTECTED]
Sent: Friday, December 19, 2003 6:48 PM
To: [EMAIL PROTECTED]
Subject: Accessing JNDI Context from outside Tomcat

I am trying to do some standalone unit testing on my business logic
layer
from outside Tomcat . I am hitting across a snag and I am relatively
new to
JNDI.

Within my application I do a
initCtx = new InitialContext();

 and Tomcat creates me a initial context for lookups. Now I did some
reverse engineering and found out the parameters that Tomcat uses to
configure the initial context.

Based on that, I wrote standalone code to create a initial context:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.java.javaURLContextFactory);

env.put(Context.URL_PKG_PREFIXES,org.apache.naming);

Context ctx = new InitialContext(env);



If I run this I get

javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.naming.java.javaURLContextFactory. Root exception is
java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory.

Is there no way to access JNDI resources set up in Tomcat from outside?
Is
there a provider URL that I need to use? If yes, what is the value?

TIA

Swami



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Accessing JNDI Context from outside Tomcat

2003-12-22 Thread Shapira, Yoav

Howdy,
I've added this to the FAQ (Miscellaneous section).

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Shapira, Yoav
Sent: Monday, December 22, 2003 9:00 AM
To: Tomcat Users List
Subject: RE: Accessing JNDI Context from outside Tomcat


Howdy,
There's no way, tomcat's JNDI is internal only.  It wouldn't hurt you
to
search this list's archives, as this question has been answered many
times in the past including at least once within the last two weeks.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Swaminathan Gurumoorthy [mailto:[EMAIL PROTECTED]
Sent: Friday, December 19, 2003 6:48 PM
To: [EMAIL PROTECTED]
Subject: Accessing JNDI Context from outside Tomcat

I am trying to do some standalone unit testing on my business logic
layer
from outside Tomcat . I am hitting across a snag and I am relatively
new to
JNDI.

Within my application I do a
initCtx = new InitialContext();

 and Tomcat creates me a initial context for lookups. Now I did some
reverse engineering and found out the parameters that Tomcat uses to
configure the initial context.

Based on that, I wrote standalone code to create a initial context:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.java.javaURLContextFactory);

env.put(Context.URL_PKG_PREFIXES,org.apache.naming);

Context ctx = new InitialContext(env);



If I run this I get

javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.naming.java.javaURLContextFactory. Root exception is
java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory.

Is there no way to access JNDI resources set up in Tomcat from
outside?
Is
there a provider URL that I need to use? If yes, what is the value?

TIA

Swami



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended
recipient, please immediately delete this e-mail from your computer
system
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Accessing JNDI Context from outside Tomcat

2003-12-19 Thread Swaminathan Gurumoorthy
I am trying to do some standalone unit testing on my business logic layer from outside 
Tomcat . I am hitting across a snag and I am relatively new to JNDI.
 
Within my application I do a 
initCtx = new InitialContext();

 and Tomcat creates me a initial context for lookups. Now I did some reverse 
engineering and found out the parameters that Tomcat uses to configure the initial 
context.

Based on that, I wrote standalone code to create a initial context:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, 
org.apache.naming.java.javaURLContextFactory);

env.put(Context.URL_PKG_PREFIXES,org.apache.naming);

Context ctx = new InitialContext(env);

 

If I run this I get 

javax.naming.NoInitialContextException: Cannot instantiate class: 
org.apache.naming.java.javaURLContextFactory. Root exception is 
java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory.

Is there no way to access JNDI resources set up in Tomcat from outside? Is there a 
provider URL that I need to use? If yes, what is the value?

TIA

Swami



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

JNDI context read only ??.

2003-10-08 Thread Michael Remijan
Hi,

I want to put an object into the JNDI context, but I get an exception that
says the context is read only.  Is there a way to make it writable?

Context ctx = (Context) new InitialContext().lookup(java:comp/env);
ctx = ctx.createSubcontext(glqso);
ctx.bind(ResourceManager, _rm);

thanks,
Mike


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JNDI context read only ??.

2003-10-08 Thread Shapira, Yoav

Howdy,
The environment context is read-only to apps.  You can search the
archives for more information as this question has been posted several
times.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Michael Remijan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 3:15 PM
To: Tomcat Users List; [EMAIL PROTECTED]
Subject: JNDI context read only ??.

Hi,

I want to put an object into the JNDI context, but I get an exception
that
says the context is read only.  Is there a way to make it writable?

Context ctx = (Context) new InitialContext().lookup(java:comp/env);
ctx = ctx.createSubcontext(glqso);
ctx.bind(ResourceManager, _rm);

thanks,
Mike


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JNDI context read only ??.

2003-10-08 Thread Tim Funk
AFAIK, no. If you need to put stuff in the JNDI context, you can do that via 
this doc:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

-Tim

Michael Remijan wrote:

Hi,

I want to put an object into the JNDI context, but I get an exception that
says the context is read only.  Is there a way to make it writable?
Context ctx = (Context) new InitialContext().lookup(java:comp/env);
ctx = ctx.createSubcontext(glqso);
ctx.bind(ResourceManager, _rm);
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: JNDI Context Environment settings?

2003-09-10 Thread Jon Wilmoth
Unfortunately, it does not appear Tomcat 4.x provides cross-jvm access
to the objects bound to it's jndi implementation.

http://forum.java.sun.com/thread.jsp?thread=190331forum=51message=1824
252

http://renaud.waldura.com/software/java/com.waldura.eclipse.jndibrowser/
doc/COMPATIBILITY.html


-Original Message-
From: Jon Wilmoth 
Sent: Tuesday, September 09, 2003 7:53 PM
To: Tomcat Users List
Subject: JNDI Context Environment settings?

If accessing a Tomcat (4.1.27 in my case) jndi tree from another jvm
(i.e. command line) what values should I use for
Context.INITIAL_CONTEXT_FACTORY, Context.PROVIDER_URL, etc. for Tomcat?

I believe 4.x has a JDNI implementation, but the description of how to
attach to it externally is not very good. If the INITIAL_CONTEXT_FACTORY
is supposed to be org.apache.naming.java.javaURLContextFactory (as
I've seen hinted at elsewhere) what is the syntax of such a url?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JNDI Context Environment settings?

2003-09-09 Thread Jon Wilmoth
If accessing a Tomcat (4.1.27 in my case) jndi tree from another jvm
(i.e. command line) what values should I use for
Context.INITIAL_CONTEXT_FACTORY, Context.PROVIDER_URL, etc. for Tomcat?

I believe 4.x has a JDNI implementation, but the description of how to
attach to it externally is not very good. If the INITIAL_CONTEXT_FACTORY
is supposed to be org.apache.naming.java.javaURLContextFactory (as
I've seen hinted at elsewhere) what is the syntax of such a url?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AD authentication if exact jndi context not known

2003-08-18 Thread carel-j rischmuller
Hi

I've managed to solve this problem by adding the attribute:
referrals=follow to the JNDIRealm element in the server.xml file.

Hope this will help somebody else one day.

Regards
Carel-J

On Tue, 12 Aug 2003 21:18:59 +0200 carel-j rischmuller
([EMAIL PROTECTED]) wrote:

Good day.

I've succeeded in setting  up the JNDIRealm to connect and
authenticate to AD (Active Directory) if the exact context (tree
path)
to the user element is known. I just set the userBase to that exact
context. E.g. userBase=ou=Office1,dc=Company,dc=net

However, I'm having trouble setting up JNDIRealm to connect to AD
*IF*
you don't know the exact context to a user element, but need to
search
through a couple of subtrees to locate it.

Thus, the system need to authenticate users that could be under any
subtree laying below dc=Company,dc=net

I thought that I'd just specify the userBase in the JNDIRealm as:
userBase=dc=Company,dc=net but this generate the exception:
javax.naming.PartialResultException: Unprocessed Continuation
Reference(s); remaining name 'dc=Company,dc=net'

It seems, the way to do multiple subtree searches in JNDI is by means
of Referrals.
(http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html)
but this does not work for AD. In AD you use a Global Catalog to do
subtree (forest) searches.

Now the question: Does anybody know if you can do Global Catalog
searches via JNDI? And if not, is there another way to solve this
problem?

Thanks in advance
carel-j


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AD authentication if exact jndi context not known

2003-08-14 Thread carel-j rischmuller
Good day.

I've succeeded in setting  up the JNDIRealm to connect and
authenticate to AD (Active Directory) if the exact context (tree path)
to the user element is known. I just set the userBase to that exact
context. E.g. userBase=ou=Office1,dc=Company,dc=net

However, I'm having trouble setting up JNDIRealm to connect to AD *IF*
you don't know the exact context to a user element, but need to search
through a couple of subtrees to locate it.

Thus, the system need to authenticate users that could be under any
subtree laying below dc=Company,dc=net

I thought that I'd just specify the userBase in the JNDIRealm as:
userBase=dc=Company,dc=net but this generate the exception:
javax.naming.PartialResultException: Unprocessed Continuation
Reference(s); remaining name 'dc=Company,dc=net'

It seems, the way to do multiple subtree searches in JNDI is by means
of Referrals.
(http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html)
but this does not work for AD. In AD you use a Global Catalog to do
subtree (forest) searches.

Now the question: Does anybody know if you can do Global Catalog
searches via JNDI? And if not, is there another way to solve this
problem?

Thanks in advance
carel-j


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



faking a JNDI context

2003-03-07 Thread Kevin HaleBoyes
First off, Craig, I hope it is not inappropriate for me to CC you
directly.

There was a discussion many months ago, on this list, about the
benifits of using the JNDI mechanism for getting DataSource objects.
The basic code is as follows:

Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup(java:comp/env);
DataSource ds = (DataSource)envCtx.lookup(jdbc/Db);
Connection conn = ds.getConnection();

This requires the proper setup in the server.xml and web.xml
configuration files.

I've been using this for some time now and it works great.

In that discussion, Craig mentioned how to use that same code when
outside of the (Tomcat) servlet environment, for example in a 
stand-alone application.  IIRC, the trick was to instantiate
a DataSource and to put it into the proper context.  Craig even gave
sample code to do that.

I'm after that code.  I've searched the archive but that has proved
to be difficult in that I can't narrow down the search adequately.

Can anyone point me to that discussion in the archives or provide
this sample code?

Thanks,
Kevin.


__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Binding to Tomcat 4.x JNDI context

2003-02-11 Thread Karl Moss
I'd like to be able to bind an object to the JNDI context during the initialization of 
a servlet so that other servlets (within other webapps) can find it. The java:comp/env 
directory is read-only, so where is the best place to bind? If I bind the object in 
the context root it seems to be only visible from within the same webapp; I would like 
to share this object with anyone in the container.

Thanks,

Karl Moss
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Binding to Tomcat 4.x JNDI context

2003-02-11 Thread Shapira, Yoav
Howdy,
Perhaps the GlobalNamingResources is what you're looking for?
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/globalresources.h
tml

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Karl Moss [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 9:49 AM
To: [EMAIL PROTECTED]
Subject: Binding to Tomcat 4.x JNDI context

I'd like to be able to bind an object to the JNDI context during the
initialization of a servlet so that other servlets (within other
webapps)
can find it. The java:comp/env directory is read-only, so where is the
best
place to bind? If I bind the object in the context root it seems to be
only
visible from within the same webapp; I would like to share this object
with
anyone in the container.

Thanks,

Karl Moss
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Binding to Tomcat 4.x JNDI context

2003-02-11 Thread Sean Dockery
You can bind your resources in GlobalNamingResources/ in server.xml, but
you must ResourceLink/ to the global resource in each Context/ where you
want the resource to be accessible.

PS:  JNDI is read-only to web applications because of catalina.policy.  You
can always change the permissions.  :-)

- Original Message -
From: Karl Moss [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 11, 2003 07:49
Subject: Binding to Tomcat 4.x JNDI context


I'd like to be able to bind an object to the JNDI context during the
initialization of a servlet so that other servlets (within other webapps)
can find it. The java:comp/env directory is read-only, so where is the best
place to bind? If I bind the object in the context root it seems to be only
visible from within the same webapp; I would like to share this object with
anyone in the container.

Thanks,

Karl Moss
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: JNDI context in ServletContextListener

2003-02-04 Thread Shapira, Yoav
Howdy,
This is a tricky issue.

First of all, see section SRV 9.11 of the Servlet Specification, v2.3.
Tomcat 4.x is an implementation of that Servlet Specification.  Tomcat
4.x is NOT a J2EE 1.3 implementation, and therefore is not required to
support JNDI lookups as outlined in the J2EE spec.  For servlet spec
2.3, it appears that Resin has implemented the J2EE 1.3 spec in this
area and tomcat 4.x hasn't.

The Servlet Spec 2.3 says changes are expected in the next version.  The
Servlet Spec 2.4 PFD doesn't seem to have changes in this area, however.
(Craig?)

You raise an interesting point.  I'll have to look through the relevant
catalnia code to see exactly what's going on.  But I'd keep this on the
radar screen as it may be a good thing to do for 5.0.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Jason Axtell [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 03, 2003 9:16 PM
To: [EMAIL PROTECTED]
Subject: JNDI context in ServletContextListener

I have a web app that I've been deploying on both Tomcat and Resin
without
any problems for the past several weeks. Originally, I was performing a
JNDI
lookup for a DataSource whenever I needed a database connection (ie.
whenever an HTTP request came in). To improve performance, I decided to
move
the JNDI lookup to a ServletContextListener (in the contextInitialized
method).

My DataSource was bound under key java:comp/env/jdbc/OracleDB

When I ran my modified code on Resin, everything worked just fine.
However,
when I ran it on Tomcat, I got a NameNotFoundException telling me that
'jdbc' wasn't defined in the context (java:comp/env). I couldn't find
any
obvious cause for the problem, since the only change I made to both my
Tomcat and Resin configurations was adding the ServletContextListener.
So,
I
wrote another ServletContextListener to enumerate all the bindings in
my
JNDI context.

Running my new ServletContextListener on Resin produced the following
output:

The following bindings were found in java:comp/env:
jdbc: [ContextImpl jdbc]
servlet: [ContextImpl servlet]
caucho: [ContextImpl caucho]
ejb: [ContextImpl ejb]
Context enumerated.
The following bindings were found in java:comp/env/jdbc:
OracleDB: [DBPool jdbc/OracleDB]
test: [DBPool jdbc/test]
projman: [DBPool jdbc/projman]
Context enumerated.

Running the same code on Tomcat produced this:

The following bindings were found in java:comp/env:
Context enumerated.
javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context
at
org.apache.naming.NamingContext.listBindings(NamingContext.java:438)
...
(stack trace follows)

Now, I don't expect to see the same set of bindings on Tomcat as I do
on
Resin. However, I do expect to see *some* bindings on Tomcat.
Unfortunately,
as far as I can tell, my Tomcat JNDI directory is completely empty at
the
time in the lifecycle that ServletContextListener.contextInitialized is
called. My expectation would be for JNDI to contain all of the global
and
application-specific bindings *before* a ServletContextListener is
called
(this is the way Resin behaves). Is this expectation incorrect?

So, here are my questions:

1. Has anyone else run into this same problem?
2. Is this actually a problem, or have I just run into a part of the
spec
of
which I was previously ignorant?
3. Am I just doing something stupid in my configuration?

Here are the relevant portions of the various files in question:

server.xml:

...
 DefaultContext debug=99
  Resource name=jdbc/OracleDB auth=Container
   type=javax.sql.DataSource/
  ResourceParams name=jdbc/OracleDB
...
  /ResourceParams
 /DefaultContext
...

web.xml:

...
 listener

listener-
classedu.stanford.irt.mesa.bootstrap.JndiBindingsEnumerationServl
etContextListener/listener-class
 /listener
...

JndiBindingsEnumerationServletContextListener.java:

public class JndiBindingsEnumerationServletContextListener implements
ServletContextListener
{
  private void printBindings(Context rootContext, String
subContextName)
throws NamingException
  {
NamingEnumeration names = rootContext.listBindings(subContextName);
System.out.println(The following bindings were found in  +
subContextName + :);
while (names.hasMore()) {
  Binding binding = (Binding)names.next();
  String name = binding.getName();
  Object o = binding.getObject();
  System.out.println(name + :  + o);
}
System.out.println(Context enumerated.);
  }

  /**
   * @see
javax.servlet.ServletContextListener#contextInitialized(ServletContextE
vent
)
   */
  public void contextInitialized(ServletContextEvent event)
  {
try {
  Context context = new InitialContext();
  this.printBindings(context, java:comp/env);
  this.printBindings(context, java:comp/env/jdbc);
}
catch (NamingException e) {
  e.printStackTrace();
}
  }

  /**
   * @see

RE: JNDI context in ServletContextListener

2003-02-04 Thread Craig R. McClanahan


On Tue, 4 Feb 2003, Shapira, Yoav wrote:

 Date: Tue, 4 Feb 2003 09:02:56 -0500
 From: Shapira, Yoav [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: RE: JNDI context in ServletContextListener

 Howdy,
 This is a tricky issue.

 First of all, see section SRV 9.11 of the Servlet Specification, v2.3.
 Tomcat 4.x is an implementation of that Servlet Specification.  Tomcat
 4.x is NOT a J2EE 1.3 implementation, and therefore is not required to
 support JNDI lookups as outlined in the J2EE spec.  For servlet spec
 2.3, it appears that Resin has implemented the J2EE 1.3 spec in this
 area and tomcat 4.x hasn't.


The design goal for Tomcat has to implement JNDI in a manner as close to
the way it's specified for J2EE as possible.

 The Servlet Spec 2.3 says changes are expected in the next version.  The
 Servlet Spec 2.4 PFD doesn't seem to have changes in this area, however.
 (Craig?)

 You raise an interesting point.  I'll have to look through the relevant
 catalnia code to see exactly what's going on.  But I'd keep this on the
 radar screen as it may be a good thing to do for 5.0.


IMHO, if Tomcat doesn't currently expose the webapp's JNDI naming context
to a ServletContextListener, that's a bug and should be reported on
Bugzilla.

 Yoav Shapira
 Millennium ChemInformatics


Craig



 -Original Message-
 From: Jason Axtell [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 03, 2003 9:16 PM
 To: [EMAIL PROTECTED]
 Subject: JNDI context in ServletContextListener
 
 I have a web app that I've been deploying on both Tomcat and Resin
 without
 any problems for the past several weeks. Originally, I was performing a
 JNDI
 lookup for a DataSource whenever I needed a database connection (ie.
 whenever an HTTP request came in). To improve performance, I decided to
 move
 the JNDI lookup to a ServletContextListener (in the contextInitialized
 method).
 
 My DataSource was bound under key java:comp/env/jdbc/OracleDB
 
 When I ran my modified code on Resin, everything worked just fine.
 However,
 when I ran it on Tomcat, I got a NameNotFoundException telling me that
 'jdbc' wasn't defined in the context (java:comp/env). I couldn't find
 any
 obvious cause for the problem, since the only change I made to both my
 Tomcat and Resin configurations was adding the ServletContextListener.
 So,
 I
 wrote another ServletContextListener to enumerate all the bindings in
 my
 JNDI context.
 
 Running my new ServletContextListener on Resin produced the following
 output:
 
 The following bindings were found in java:comp/env:
 jdbc: [ContextImpl jdbc]
 servlet: [ContextImpl servlet]
 caucho: [ContextImpl caucho]
 ejb: [ContextImpl ejb]
 Context enumerated.
 The following bindings were found in java:comp/env/jdbc:
 OracleDB: [DBPool jdbc/OracleDB]
 test: [DBPool jdbc/test]
 projman: [DBPool jdbc/projman]
 Context enumerated.
 
 Running the same code on Tomcat produced this:
 
 The following bindings were found in java:comp/env:
 Context enumerated.
 javax.naming.NameNotFoundException: Name jdbc is not bound in this
 Context
 at
 org.apache.naming.NamingContext.listBindings(NamingContext.java:438)
 ...
 (stack trace follows)
 
 Now, I don't expect to see the same set of bindings on Tomcat as I do
 on
 Resin. However, I do expect to see *some* bindings on Tomcat.
 Unfortunately,
 as far as I can tell, my Tomcat JNDI directory is completely empty at
 the
 time in the lifecycle that ServletContextListener.contextInitialized is
 called. My expectation would be for JNDI to contain all of the global
 and
 application-specific bindings *before* a ServletContextListener is
 called
 (this is the way Resin behaves). Is this expectation incorrect?
 
 So, here are my questions:
 
 1. Has anyone else run into this same problem?
 2. Is this actually a problem, or have I just run into a part of the
 spec
 of
 which I was previously ignorant?
 3. Am I just doing something stupid in my configuration?
 
 Here are the relevant portions of the various files in question:
 
 server.xml:
 
 ...
  DefaultContext debug=99
   Resource name=jdbc/OracleDB auth=Container
type=javax.sql.DataSource/
   ResourceParams name=jdbc/OracleDB
 ...
   /ResourceParams
  /DefaultContext
 ...
 
 web.xml:
 
 ...
  listener
 
 listener-
 classedu.stanford.irt.mesa.bootstrap.JndiBindingsEnumerationServl
 etContextListener/listener-class
  /listener
 ...
 
 JndiBindingsEnumerationServletContextListener.java:
 
 public class JndiBindingsEnumerationServletContextListener implements
 ServletContextListener
 {
   private void printBindings(Context rootContext, String
 subContextName)
 throws NamingException
   {
 NamingEnumeration names = rootContext.listBindings(subContextName);
 System.out.println(The following bindings were found in  +
 subContextName + :);
 while

JNDI context in ServletContextListener

2003-02-03 Thread Jason Axtell
I have a web app that I've been deploying on both Tomcat and Resin without
any problems for the past several weeks. Originally, I was performing a JNDI
lookup for a DataSource whenever I needed a database connection (ie.
whenever an HTTP request came in). To improve performance, I decided to move
the JNDI lookup to a ServletContextListener (in the contextInitialized
method). 

My DataSource was bound under key java:comp/env/jdbc/OracleDB

When I ran my modified code on Resin, everything worked just fine. However,
when I ran it on Tomcat, I got a NameNotFoundException telling me that
'jdbc' wasn't defined in the context (java:comp/env). I couldn't find any
obvious cause for the problem, since the only change I made to both my
Tomcat and Resin configurations was adding the ServletContextListener. So, I
wrote another ServletContextListener to enumerate all the bindings in my
JNDI context. 

Running my new ServletContextListener on Resin produced the following
output:

The following bindings were found in java:comp/env:
jdbc: [ContextImpl jdbc]
servlet: [ContextImpl servlet]
caucho: [ContextImpl caucho]
ejb: [ContextImpl ejb]
Context enumerated.
The following bindings were found in java:comp/env/jdbc:
OracleDB: [DBPool jdbc/OracleDB]
test: [DBPool jdbc/test]
projman: [DBPool jdbc/projman]
Context enumerated.

Running the same code on Tomcat produced this:

The following bindings were found in java:comp/env:
Context enumerated.
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at
org.apache.naming.NamingContext.listBindings(NamingContext.java:438)
...
(stack trace follows)

Now, I don't expect to see the same set of bindings on Tomcat as I do on
Resin. However, I do expect to see *some* bindings on Tomcat. Unfortunately,
as far as I can tell, my Tomcat JNDI directory is completely empty at the
time in the lifecycle that ServletContextListener.contextInitialized is
called. My expectation would be for JNDI to contain all of the global and
application-specific bindings *before* a ServletContextListener is called
(this is the way Resin behaves). Is this expectation incorrect?

So, here are my questions:

1. Has anyone else run into this same problem?
2. Is this actually a problem, or have I just run into a part of the spec of
which I was previously ignorant?
3. Am I just doing something stupid in my configuration?

Here are the relevant portions of the various files in question:

server.xml:

...
 DefaultContext debug=99
  Resource name=jdbc/OracleDB auth=Container
   type=javax.sql.DataSource/ 
  ResourceParams name=jdbc/OracleDB
...
  /ResourceParams
 /DefaultContext
...

web.xml:

...
 listener
 
listener-classedu.stanford.irt.mesa.bootstrap.JndiBindingsEnumerationServl
etContextListener/listener-class
 /listener
...

JndiBindingsEnumerationServletContextListener.java:

public class JndiBindingsEnumerationServletContextListener implements
ServletContextListener 
{
  private void printBindings(Context rootContext, String subContextName) 
throws NamingException
  {
NamingEnumeration names = rootContext.listBindings(subContextName);
System.out.println(The following bindings were found in  +
subContextName + :);
while (names.hasMore()) {
  Binding binding = (Binding)names.next();
  String name = binding.getName();
  Object o = binding.getObject();
  System.out.println(name + :  + o);
}
System.out.println(Context enumerated.);
  }

  /**
   * @see
javax.servlet.ServletContextListener#contextInitialized(ServletContextEvent)
   */
  public void contextInitialized(ServletContextEvent event) 
  {
try {
  Context context = new InitialContext();
  this.printBindings(context, java:comp/env);
  this.printBindings(context, java:comp/env/jdbc);
}
catch (NamingException e) {
  e.printStackTrace();
}
  }

  /**
   * @see
javax.servlet.ServletContextListener#contextDestroyed(ServletContextEvent)
   */
  public void contextDestroyed(ServletContextEvent event) 
  {
  }
}

You will notice right away that I do not have a resource-ref in web.xml. I
contend that I've never needed it before and don't see why I would need it
now.

Thanks in advance for any help,

Jason Axtell
[EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




get JNDI Context from client side

2002-12-04 Thread Kevin Chen
Hi all:

How can I get Tomcat JNDI context from client side??
I wanna write a client side java code that can lookup Tomcat JNDI context.
Here is the code i wrote:

Properties p = new Properties();
  p.put(Context.INITIAL_CONTEXT_FACTORY, 
org.apache.naming.java.javaURLContextFactory);
  p.put(Context.PROVIDER_URL, rmi://localhost:1099);
  
  try
  {
   Context ic = new javax.naming.InitialContext(p);
   Object obj = ic.lookup(java:comp/env);
   ...
   ... 
  }
  

And I got the following error message:
javax.naming.NameNotFoundException: No object bound for java:comp/env

It seems like I didnt get the JNDI context of Tomcat.
Can anyone help??

Thanks!!



RE: get JNDI Context from client side

2002-12-04 Thread Shapira, Yoav
Hi,
The tomcat environment context is only bound within the tomcat JVM
internally, as mandated by the 2.3 servlet spec.  You shouldn't have
direct access to it from an external source, like your client.  And
anyways, would you want your client to require the internal Catalina
jars on its classpath?

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Kevin Chen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 6:39 AM
To: [EMAIL PROTECTED]
Subject: get JNDI Context from client side

Hi all:

How can I get Tomcat JNDI context from client side??
I wanna write a client side java code that can lookup Tomcat JNDI
context.
Here is the code i wrote:

Properties p = new Properties();
  p.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.java.javaURLContextFactory);
  p.put(Context.PROVIDER_URL, rmi://localhost:1099);

  try
  {
   Context ic = new javax.naming.InitialContext(p);
   Object obj = ic.lookup(java:comp/env);
   ...
   ...
  }


And I got the following error message:
javax.naming.NameNotFoundException: No object bound for java:comp/env

It seems like I didnt get the JNDI context of Tomcat.
Can anyone help??

Thanks!!

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: get JNDI Context from client side where???

2002-12-04 Thread maninder s batth
could you pls gime page # in 2.3 servlet spec about enviroment context 
documentation.
i would like to read whole but as of now i am focussed on jndi aspect of 
tomcat.
thank you

Shapira, Yoav wrote:

Hi,
The tomcat environment context is only bound within the tomcat JVM
internally, as mandated by the 2.3 servlet spec.  You shouldn't have
direct access to it from an external source, like your client.  And
anyways, would you want your client to require the internal Catalina
jars on its classpath?

Yoav Shapira
Millennium ChemInformatics


 

-Original Message-
From: Kevin Chen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 6:39 AM
To: [EMAIL PROTECTED]
Subject: get JNDI Context from client side

Hi all:

How can I get Tomcat JNDI context from client side??
I wanna write a client side java code that can lookup Tomcat JNDI
   

context.
 

Here is the code i wrote:

Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.java.javaURLContextFactory);
p.put(Context.PROVIDER_URL, rmi://localhost:1099);

try
{
 Context ic = new javax.naming.InitialContext(p);
 Object obj = ic.lookup(java:comp/env);
 ...
 ...
}


And I got the following error message:
javax.naming.NameNotFoundException: No object bound for java:comp/env

It seems like I didnt get the JNDI context of Tomcat.
Can anyone help??

Thanks!!
   


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

 


--
Your favorite stores, helpful shopping tools and great gift ideas. 
Experience the convenience of buying online with Shop@Netscape! 
http://shopnow.netscape.com/



RE: get JNDI Context from client side where???

2002-12-04 Thread Shapira, Yoav
Hi,
SRV 9.11.  Tomcat is not a J2EE implementation.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: maninder s batth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 1:48 PM
To: Tomcat Users List
Subject: Re: get JNDI Context from client side where???

could you pls gime page # in 2.3 servlet spec about enviroment context
documentation.
i would like to read whole but as of now i am focussed on jndi aspect
of
tomcat.
thank you

Shapira, Yoav wrote:

Hi,
The tomcat environment context is only bound within the tomcat JVM
internally, as mandated by the 2.3 servlet spec.  You shouldn't have
direct access to it from an external source, like your client.  And
anyways, would you want your client to require the internal Catalina
jars on its classpath?

Yoav Shapira
Millennium ChemInformatics




-Original Message-
From: Kevin Chen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 6:39 AM
To: [EMAIL PROTECTED]
Subject: get JNDI Context from client side

Hi all:

How can I get Tomcat JNDI context from client side??
I wanna write a client side java code that can lookup Tomcat JNDI


context.


Here is the code i wrote:

Properties p = new Properties();
 p.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.java.javaURLContextFactory);
 p.put(Context.PROVIDER_URL, rmi://localhost:1099);

 try
 {
  Context ic = new javax.naming.InitialContext(p);
  Object obj = ic.lookup(java:comp/env);
  ...
  ...
 }


And I got the following error message:
javax.naming.NameNotFoundException: No object bound for java:comp/env

It seems like I didnt get the JNDI context of Tomcat.
Can anyone help??

Thanks!!



--
To unsubscribe, e-mail:   mailto:tomcat-user-
[EMAIL PROTECTED]
For additional commands, e-mail: mailto:tomcat-user-
[EMAIL PROTECTED]




--
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: get JNDI Context from client side where???

2002-12-04 Thread Craig R. McClanahan


On Wed, 4 Dec 2002, maninder s batth wrote:

 Date: Wed, 04 Dec 2002 10:47:31 -0800
 From: maninder s batth [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: Re: get JNDI Context from client side where???

 could you pls gime page # in 2.3 servlet spec about enviroment context
 documentation.
 i would like to read whole but as of now i am focussed on jndi aspect of
 tomcat.
 thank you


You'll have to search long and hard to find it in the servlet spec :-).

The JNDI naming context requirements come from the J2EE Platform
Specification http://java.sun.com/j2ee chapter on Naming.  Tomcat cannot
implement all of these features (for example, it doesn't have any EJB
support, so it cannot do much for an ejb-ref), but Tomcat does strive to
implement the subset it can in a manner compatible with J2EE.  That's why
an app programmed to use JNDI resources for data sources, for example,
should be able to run unchanged on any J2EE-based app server.

On the particular feature you are speaking of, J2EE app servers are
required to be able to expose *a* naming context to a J2EE app client
which has been packaged with the appropriate support libraries for that
app server.  However, this naming context would not be the same context
instance as for a web application stored in a server -- it would be one
custom crafted for that app client, based on the app client's deployment
descriptor.

It would be technically feasible (although non-portable) to add a way that
an external client (i.e. running in a separate JVM) could get access to a
webapp's naming context, using CORBA or RMI.  However, even if you went to
all this work, it wouldn't do you very much good -- many of the resources
stored in the webapp naming context, such as data sources, are not
Serializable and could not be acquired and used from a separate JVM
anyway.

My advice would be to abandon the idea of trying to access the webapp's
naming context from an external application.  If you need to have
information that is shared between a webapp and standalone apps, the
simplest thing to do is store it in a database that both of them access.
If the data changes and you need synchronization, investigate things like
JINI and JavaSpaces to maintain the coordination for you.

Craig


 Shapira, Yoav wrote:

 Hi,
 The tomcat environment context is only bound within the tomcat JVM
 internally, as mandated by the 2.3 servlet spec.  You shouldn't have
 direct access to it from an external source, like your client.  And
 anyways, would you want your client to require the internal Catalina
 jars on its classpath?
 
 Yoav Shapira
 Millennium ChemInformatics
 
 
 
 
 -Original Message-
 From: Kevin Chen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 6:39 AM
 To: [EMAIL PROTECTED]
 Subject: get JNDI Context from client side
 
 Hi all:
 
 How can I get Tomcat JNDI context from client side??
 I wanna write a client side java code that can lookup Tomcat JNDI
 
 
 context.
 
 
 Here is the code i wrote:
 
 Properties p = new Properties();
  p.put(Context.INITIAL_CONTEXT_FACTORY,
 org.apache.naming.java.javaURLContextFactory);
  p.put(Context.PROVIDER_URL, rmi://localhost:1099);
 
  try
  {
   Context ic = new javax.naming.InitialContext(p);
   Object obj = ic.lookup(java:comp/env);
   ...
   ...
  }
 
 
 And I got the following error message:
 javax.naming.NameNotFoundException: No object bound for java:comp/env
 
 It seems like I didnt get the JNDI context of Tomcat.
 Can anyone help??
 
 Thanks!!
 
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 

 --
 Your favorite stores, helpful shopping tools and great gift ideas.
 Experience the convenience of buying online with Shop@Netscape!
 http://shopnow.netscape.com/




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




rationale for making jndi context read only?

2002-11-30 Thread anywhere-info
Does any one knows  the rationale for making 
InitialContext(java:comp/env) read only ?


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



Writing to Tomcat's JNDI Context

2002-10-18 Thread Adam Sherman
I've read on the list that java:com/env is read-only for good reason.

If I need to store an object in JNDI during the initialization of my 
servlet, where can I bind it?

I dont't want to tie my data layer to the Servlet, which is why I'm not 
putting in the servlet context.

Thanks,

A.

--
Adam Sherman
Software Developer
Teach and Travel Inc.
+1.613.241.3103



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org



JNDI context not bound when used with external application

2002-04-12 Thread Frank Marx

Hi,

I defined a JDBC Datasource in JNDI which can be looked by a servlet
which is running in the container.
When I try to look up the same datasource using a external application I
always get a exception which says:

javax.naming.NameNotFoundException: Name blahblah is not bound in this
Context, even the code and the environment
settings are the same in both the servlet and the external standalone
application.

Is the TOMCAT JNDI service only available to web-applications which are
running in the countainer ?


Thanks in advance,

Frank Marx


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Passing a Tomcat JNDI context to a jCrontab task

2002-03-28 Thread Steven Elliott

Apologies if this is too off topic.

I am looking at using the jCrontab servlet to do some task scheduling most
of which has to do with mailing reports generated from data in the
application's database.  Although I could do this using the Class.forName()
paradigm I would like to use the same Datasource pool I have already
running.  In order to obtain a reference though, I need the InitialContext.

There seems to be three ways to approach this problem but I am not sure
which are possible much less which may be best.

The first seems to be to have jCrontab make a call to a class which somehow
obtains the InitialContext reference.  My problem is knowing how to access
the Tomcat Context from an application which does not have a implied
reference to the Tomcat context such as a Bean or Servlet would have.

The second seems to be to pass a reference of the Context to the application
but I am not sure it is possible for jCrontab to do that?

The third would be for jCrontab to somehow invoke a servlet or Bean within
the Tomcat context but after studying the Tests suite and reading through
the documentation I am at a loss of how to invoke a class which does not
have main method.

If anyone has a suggestion or even where I might find one I'd appreciate the
hint.

Thanks,

Steven 


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




JNDI Context and Connection Pooling

2002-01-28 Thread Chandramouli Kharidehal

Hi
How can I make Connection Pooling work with JNDI Context in Tomcat
I did browse the archive of meessages but iam not able to run then 
Can u Please help regarding how to do this 

Thanks 
Mouli !!



JNDI Context

2002-01-27 Thread Chandramouli Kharidehal

Hi
 How do i set up connection Pooling with JNDi context I browsed the
archives and did all that were suggested 
 but still it doesn't work . What i need to do to work this Connection
Pooling !! 
   
 %
try {
InitialContext ctext = new InitialContext();
System.out.println(inside INit );
  
javax.naming.Context env = (Context)ctext.lookup(java:comp/env);
  
// use the greetings message
  
   %
p Before lookup /p
%
   OracleDataSource oc =  (OracleDataSource)env.lookup(jdbc/cnamsbld);
  
%
p After lookup /p

%

Connection connection = oc.getConnection();
System.out.println( connection  + connection);
}
 
 catch(Exception e) {
   out.println(e);
 }

Iam running this scriplet but iam getting
javax.naming.NameNotFoundException: Name java:comp is not bound of this
context 

Thanks 
Mouli 



Re: JNDI Context

2001-12-26 Thread Craig R. McClanahan



On Sat, 22 Dec 2001, Frans Thamura wrote:

 Date: Sat, 22 Dec 2001 09:35:02 +0700
 From: Frans Thamura [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: JNDI Context

 Dear All,

 I using JNDI in JBOSS for remote an object, so I cann access the
 object from JBOSS...

 several of it is a EJB class.

 but, in Tomcat 4.01 there is a jndi feature...

 is this component can implement my script that run in JBoss


JBoss includes a feature that lets you integrate Tomcat as the web
container.  You'd be better off asking about its features on a JBoss
mailing list.

 Frans


Craig McClanahan



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




JNDI Context

2001-12-25 Thread Frans Thamura

Dear All,

I using JNDI in JBOSS for remote an object, so I cann access the object from JBOSS...

several of it is a EJB class.

but, in Tomcat 4.01 there is a jndi feature...

is this component can implement my script that run in JBoss

Frans