InitialContext configuration

2002-12-13 Thread Rod Frey
This question seems to have been asked about a thousand times: I
apologize for bringing it up again.  I was unable to find a solution
that worked from among prior responses.
 
I want to configure Tomcat's InitialContext with Jboss' JNDI info.  Life
is good as long as I do things in code:
 
  Hashtable env = new Hashtable();
  env.put(java.naming.factory.initial,
org.jnp.interfaces.NamingContextFactory);
  env.put(java.naming.factory.url.pkgs,
org.jboss.naming:org.jnp.interfaces);
  env.put(java.naming.provider.url, freud:1099);
  Context context = new InitialContext(env);


However, I obviously would like to put this in a jndi.properties file,
or externalize it in some other way.  I've tried putting the
jndi.properties file in the following locations:
 
$JAVA_HOME/lib
$JAVA_HOME/lib/ext
$TOMCAT_HOME/common/classes
$TOMCAT_HOME/common/shared
$TOMCAT_HOME/webapps/myapp/WEB-INF/classes
$TOMCAT_HOME/webapps/myapp/WEB-INF/lib
 
Nothing works: when I check system properties just before creating an
InitialContext, I get the following output:
 
java.naming.factory.initial is
org.apache.naming.java.javaURLContextFactory
java.naming.factory.url.pkgs is org.apache.naming
java.naming.provider.url is null

Followed by the inevitable exception:
 
javax.naming.NameNotFoundException: Name PartnerManager is not bound in
this Context

How can I externalize these system properties?  I've also mucked with
the server.xml file quite extensively, without success.
 
I'm using Redhat 8.0, JDK1.4.1, and Tomcat 4.1.12.
 
Thanks!
Rod



RE: InitialContext configuration

2002-12-13 Thread Rod Frey
Thanks for the reply.

I should have mentioned that I started encountering these problems when
I put the Tomcat server on a different machine.  There was no trouble
when I was running Tomcat embedded.  Right now, there's no trace of
Jboss on the Tomcat server.

Thanks again!
Rod

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]] 
Sent: Friday, December 13, 2002 10:38 AM
To: Tomcat Users List
Subject: Re: InitialContext configuration


Hello Rod,

I think this is a JBoss question.  I think that JBoss takes over
configuration of Tomcat when Tomcat is embedded in JBoss.  So, I would
think that the JNDI config would be located within JBoss, not external
to the server or under the normal Tomcat standalone configuration. That
said, I haven't tried this and don't know for sure.  I just thought I'd
fill you in on my hunch.


Jake

Friday, December 13, 2002, 10:39:12 AM, you wrote:

RF This question seems to have been asked about a thousand times: I 
RF apologize for bringing it up again.  I was unable to find a solution

RF that worked from among prior responses.
 
RF I want to configure Tomcat's InitialContext with Jboss' JNDI info.  
RF Life is good as long as I do things in code:
 
RF   Hashtable env = new Hashtable();
RF   env.put(java.naming.factory.initial,
RF org.jnp.interfaces.NamingContextFactory);
RF   env.put(java.naming.factory.url.pkgs,
RF org.jboss.naming:org.jnp.interfaces);
RF   env.put(java.naming.provider.url, freud:1099);
RF   Context context = new InitialContext(env);


RF However, I obviously would like to put this in a jndi.properties 
RF file, or externalize it in some other way.  I've tried putting the 
RF jndi.properties file in the following locations:
 
RF $JAVA_HOME/lib
RF $JAVA_HOME/lib/ext
RF $TOMCAT_HOME/common/classes
RF $TOMCAT_HOME/common/shared 
RF $TOMCAT_HOME/webapps/myapp/WEB-INF/classes
RF $TOMCAT_HOME/webapps/myapp/WEB-INF/lib
 
RF Nothing works: when I check system properties just before creating 
RF an InitialContext, I get the following output:
 
RF java.naming.factory.initial is 
RF org.apache.naming.java.javaURLContextFactory
RF java.naming.factory.url.pkgs is org.apache.naming
RF java.naming.provider.url is null

RF Followed by the inevitable exception:
 
RF javax.naming.NameNotFoundException: Name PartnerManager is not bound

RF in this Context

RF How can I externalize these system properties?  I've also mucked 
RF with the server.xml file quite extensively, without success.
 
RF I'm using Redhat 8.0, JDK1.4.1, and Tomcat 4.1.12.
 
RF Thanks!
RF Rod



-- 
Best regards,
 Jacobmailto:[EMAIL PROTECTED]


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





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




Log4J.xml location?

2002-12-13 Thread Rod Frey
Until a few days ago, I've been running Tomcat embedded in JBoss.  When
I moved Tomcat to a separate machine a few days ago, I lost all Log4j
messages.
 
How can I get them back?  I've added the following to my server.xml
file:
 
Logger className=org.apache.catalina.logger.FileLogger
 directory=logs  prefix=localhost_log. suffix=.txt
timestamp=true/

Logger className=org.apache.catalina.logger.SystemOutLogger
verbosity=4 /

I've got a ConsoleAppender going in my log4j.xml file that worked as
expected under JBoss.  My expectation is that the log4j ConsoleAppender
would send various messages to stdout, and the SystemOutLogger would put
them on the console.  
 
However, it doesn't work: I don't see any logger.info messages at all,
on the screen or in any of the log files.
 
I expect that I'm not seeing the log4j.xml file.  But I don't know where
to put it so it can be seen: I've tried WEB-INF/lib, WEB-INF/classes,
TOMCAT_HOME/common/classes, and TOMCAT_HOME/common/lib.
 
Any help would be very appreciated.  I really don't want to go through
80,000 lines of code to replace the logging statements!
 
Rod.



IE calls servlet multiple times for one request

2001-06-04 Thread Rod Frey

I've got a threading issue that I can't work out.

I've got a servlet that gets called from my web application.  It
takes an object model that's stored in the session, asks the object
model to cough up a representation of itself in XML-FO, then
generates a PDF representation using FOP.  It then writes that to the
response output stream.

The servlet is mapped to the name report.pdf:, because using that
extension seems to be the only way I can get IE to open the thing
inline, even tho' I call resp.setContentType(application/pdf).  (IE
reports the content-type as text/html, although other browser seem to
get it fine).  Other browsers work fine.  That's not the item,
though. 

The item is that my servlet gets called four times in succession by
IE.  Eventually, (on the fourth go), the servlet throws an IO
exception (Broken Pipe) on the out.write(byte[]) call that I use to
write the PDF file to the Servlet's outputstream.  After that, the
file displays fine in IE.

Here's the code after the PDF is generated and put into the byte[]
data:

outs = resp.getOutputStream();
resp.setContentType(application/pdf);
resp.setContentLength(data.length);
resp.setDateHeader(Expires, 0L);
resp.setHeader(Cache-Control, no-cache);
outs.write(data);
outs.flush();
resp.flushBuffer();

The outputstream is closed in a finally block.

I've also tried wrapping the outputstream in a bufferedoutput stream.
I've also tried a call to 

resp.setBufferSize(data.length);

neither of which had any effect: IE calls the servlet four times; the
fourth time the call to outs.write(data) fails with an IO exception,
and the page displays successfully in the IE window.

This doesn't happen with other browsers: Netscape and Opera both call
the servlet only once. I could live with it (big hack: just catch the
fourth-call IO exception), except generation of the PDF is a 4-5
second operation.

The data I'm sending is about 200k in length.

Any ideas?
Rod