Re: InitParameters Question

2004-01-15 Thread Michael Duffy
Found the answer at the Java Forum:

http://forum.java.sun.com/thread.jsp?forum=33&thread=482125

I think it's a case of RTFM here.  I should have
understood that difference between ServletConfig and
ServletContext.  Now I do. - MOD


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

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



Re: InitParameters Question

2004-01-14 Thread Liem Do
> It appears that the init params of the servlet and its
> context are different.  Can someone clear up this
> misunderstanding for me?
Yes you are right.

>
> There's also a getInitParameter() method in the
> javax.servlet.ServletContext class.  I thought it,
> too, gave access to the  values.
>
The getInitParameter() from the javax.servlet.ServletContext comes from
 tags specified in web.xml for the whole application and not
within  tags.

Hope that clears it up a little.
LD


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



InitParameters Question

2004-01-14 Thread Michael Duffy

Init parameters for a servlet are specified in
web.xml, using the  child of the 
tag.

These can be accessed using the
javax.servlet.GenericServlet.getInitParameter().  So
far, so good.

There's also a getInitParameter() method in the
javax.servlet.ServletContext class.  I thought it,
too, gave access to the  values.

But in my application, ServletContext doesn't provide
access to the init param names.  My servlet does call
" super.init(config);" in the first line of its init()
method.

It appears that the init params of the servlet and its
context are different.  Can someone clear up this
misunderstanding for me?  Thanks - MOD


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

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



application initParameters disappearing (or overwritten)

2003-07-20 Thread Gil Hauer
Hi,

I'm experience something completely mysterious and I'm sure I'm doing
something wrong -- the question is "what?".

I've set some init parameters in server.xml as follows:


  
  


... and in my JSP page, I have the following code:

String store_id = 
(String)application.getInitParameter("creditcard.store_id");
session.setAttribute("creditcard.store_id", store_id);

 String api_token =
(String)application.getInitParameter("creditcard.api_token");
session.setAttribute("creditcard.api_token", api_token);

Occasionally when I load the JSP page the  init parameters have the
correct values but sometimes they contain null.

What would cause the parameters to be overwritten?

Thanks,
Gil




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



Weird problem using ant undeploy/deploy: InitParameters not inited

2003-04-05 Thread johannes . fiala
Hi there,

I'm facing a strange problem sometimes when I'm doing an ant 
undeploy/deploy:

Sometimes, the Context InitParameters don't get initialized, they simply 
resume to "null". 

Does anybody have any idea what might cause this? It is reproducible but 
happens at different times. 
The problem occurs especially often on our production machine, which is 
running AIX 4.3.

thx alot
Johannes

RE: How to get InitParameters.

2002-07-18 Thread Luminous Heart

Howdy back :)

This code, 
out.println("Try tip from **[EMAIL PROTECTED]**: "
+ getServletConfig().getInitParameter("host"));

out.println("");

out.println("Servlet init parameters");
java.util.Enumeration e = getInitParameterNames();
while (e.hasMoreElements()) {
String key = (String)e.nextElement();
String value = getInitParameter(key);
out.println("   " + key + " = " + value + "");

}


Try tip from **[EMAIL PROTECTED]**: null 

Servlet init parameters
logVerbosityLevel = ERROR


out.println("Servlet init parameters");
java.util.Enumeration e = getInitParameterNames();
while (e.hasMoreElements()) {
String key = (String)e.nextElement();
String value = getInitParameter(key);
out.println("   " + key + " = " + value + "");

}
Will result in:


Context init parameters
FoldersListFile = .mailfolderlist
SMTPHost = mail.myDomain.com
mbox = Inbox
other_mbox = Inbox
UploadDir = /usr/local/tomcat/webapps/xApp/upload/
BaseDir = /xApp/
imapsockettimeout = 1800
host = MyDomain.com
protocol = imap
imapconnectionzise = 4
MailUserHome = /home/mailuser/
imapconnectiontimeout = 1800
another shot at host: MyDomain.com 


>From my xApp/WEB-INF/web.xml:

 
testbed
Mail/testbed.jsp

  protocol
  imap

  
 
  mbox
  Inbox


  MailUserHome
  /home/mailuser/


  BaseDir
  /xApp/


  host
  myDomain.com

  
  SMTPHost
  mail.myDomain.com


  imapconnectiontimeout
  60 * 30


  imapsockettimeout
  60 * 30

 

  imapconnectionzise
  4


  UploadDir
 
/usr/local/tomcat/webapps/xApp/upload/

 

  FoldersListFile
  .mailfolderlist

  
 
>From my /usr/local/tomcat/conf/server.xml:

  

  
  
  
  
  
 
  
  
  
 
  
  
 
  


if you notice the imapsockettimeout = 1800 exists in
server.xml while in web.xml it is  60 * 30 as in :
imapsockettimeout
  60 * 30

And yes, my tomcat starts fine, and all the apps on it
work just fine. The only thing is passing parameters
to jsp on start.

Thank you for your help.

--- "Shapira, Yoav" <[EMAIL PROTECTED]> wrote:
> Howdy,
> Getting init parameters is usually a simple deal. 
> Please post the code
> you're using to get the parameters, and the results
> you get.  I'm
> assuming your tomcat environment is set up
> correctly, no errors on
> startup, the examples run, etc.?
> 
> Typically,
> getServletConfig().getInitParameter("param-name")
> will get
> you back "param-value".  
> 
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> >-Original Message-
> >From: Luminous Heart
> [mailto:[EMAIL PROTECTED]]
> >Sent: Thursday, July 18, 2002 2:03 PM
> >To: Tomcat Users List
> >Subject: How to get InitParameters.
> >
> >I can access my parameters if I put them in this
> >format.
> >
> > 
> >
> >But if I use this format, which what I really want,
> I
> >can not access them using getInitParameter(name)
> >
> >
> >testbed
> >Mail/testbed.jsp
> >
> >  protocol
> >  imap
> >
> >
> >  mbox
> >  Inbox
> >
> >
> > 
> >  host
> >  localhost
> >
> >  
> >
> >What am I doing wrong! I am using tc4.
> >
> >__
> >Do You Yahoo!?
> >Yahoo! Autos - Get free new car price quotes
> >http://autos.yahoo.com
> >
> >--
> >To unsubscribe, e-mail:   <mailto:tomcat-user-
> >[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> <mailto:tomcat-user-
> >[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

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




RE: How to get InitParameters.

2002-07-18 Thread Shapira, Yoav

Howdy,
Getting init parameters is usually a simple deal.  Please post the code
you're using to get the parameters, and the results you get.  I'm
assuming your tomcat environment is set up correctly, no errors on
startup, the examples run, etc.?

Typically, getServletConfig().getInitParameter("param-name") will get
you back "param-value".  


Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Luminous Heart [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, July 18, 2002 2:03 PM
>To: Tomcat Users List
>Subject: How to get InitParameters.
>
>I can access my parameters if I put them in this
>format.
>
> 
>
>But if I use this format, which what I really want, I
>can not access them using getInitParameter(name)
>
>
>testbed
>Mail/testbed.jsp
>
>  protocol
>  imap
>
>
>  mbox
>  Inbox
>
>
> 
>  host
>  localhost
>
>  
>
>What am I doing wrong! I am using tc4.
>
>__
>Do You Yahoo!?
>Yahoo! Autos - Get free new car price quotes
>http://autos.yahoo.com
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>


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




How to get InitParameters.

2002-07-18 Thread Luminous Heart

I can access my parameters if I put them in this
format.

 

But if I use this format, which what I really want, I
can not access them using getInitParameter(name)


testbed
Mail/testbed.jsp

  protocol
  imap


  mbox
  Inbox


 
  host
  localhost

  

What am I doing wrong! I am using tc4.

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: InitParameters missing in ServletConfig when Servlet-loadingtriggerd through Re

2002-05-18 Thread Craig R. McClanahan

Servlet initialization parameters are only visible to servlets that are
mapped directly in a .  If you access a servlet
indirectly via the invoker (i.e. "/servlet/*"), you are *not* going to see
these parameters.

Craig


On Thu, 16 May 2002, Karl Leipzig wrote:

> Date: Thu, 16 May 2002 11:52:54 +
> From: Karl Leipzig <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: InitParameters missing in ServletConfig when Servlet-loading
> triggerd through Re
>
> Hello,
> using Tomcat 4.0.3 (and 4.0.2 also) I encounter the following problem:
>
> Problem setup:
> My servlet has no  set.
>
> I start Tomcat.
> I trigger the loading of servlet A through a RequestDispatchers forward as
> quoted below.
> I trace my servlet A's ServletConfig init-parameters in the init() method
> call.
> The newly loaded servlet A's ServletConfig DOES NOT contain the
> init-parameters I specifed in web.xml!
>
> Unsatisfying solution setup:
> This time I specify a 1 in web.xml:
>
> I start Tomcat.
> The loading of servlet A is triggerd through the container on startup.
> I trace my servlet A's ServletConfig init-parameters in the init() method
> call.
> The newly loaded servlet A's ServletConfig as expected DOES contain all
> init-parameters I specifed in web.xml.
>
> Why are my init-parameters missing in the first case?
>
> Thank you,
> Philipp.
>
>
> Code used for forwarding:
> RequestDispatcher requestDispatcher =
> getServletContext().getRequestDispatcher("/servlet/" +
> responsibleServletName);
> requestDispatcher.forward(servletRequest, servletResponse);
>
>
> _
> Werden Sie Mitglied bei MSN Hotmail, dem größten E-Mail-Service der Welt.
> http://www.hotmail.com
>
>
> --
> 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]>




InitParameters missing in ServletConfig when Servlet-loading triggerd through Re

2002-05-18 Thread Karl Leipzig

Hello,
using Tomcat 4.0.3 (and 4.0.2 also) I encounter the following problem:

Problem setup:
My servlet has no  set.

I start Tomcat.
I trigger the loading of servlet A through a RequestDispatchers forward as 
quoted below.
I trace my servlet A's ServletConfig init-parameters in the init() method 
call.
The newly loaded servlet A's ServletConfig DOES NOT contain the 
init-parameters I specifed in web.xml!

Unsatisfying solution setup:
This time I specify a 1 in web.xml:

I start Tomcat.
The loading of servlet A is triggerd through the container on startup.
I trace my servlet A's ServletConfig init-parameters in the init() method 
call.
The newly loaded servlet A's ServletConfig as expected DOES contain all 
init-parameters I specifed in web.xml.

Why are my init-parameters missing in the first case?

Thank you,
Philipp.


Code used for forwarding:
RequestDispatcher requestDispatcher = 
getServletContext().getRequestDispatcher("/servlet/" + 
responsibleServletName);
requestDispatcher.forward(servletRequest, servletResponse);


_
Werden Sie Mitglied bei MSN Hotmail, dem größten E-Mail-Service der Welt. 
http://www.hotmail.com


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: InitParameters missing in ServletConfig when Servlet-loading triggerd through RequestDispatcher

2002-05-16 Thread Greg Trasuk

What you'll probably find is that even though you can get the
servlet's init() method to print out its parameters, when you actually
invoke the servlet through /servlet/classname, you are invoking another
instance of the servlet class that is not initialized with your parameters.
All you're doing by loading it at startup is creating a named instance of
the servlet, but not mapping any requests to it.

Using the "/servlet/classname" form of invoking the servlet causes
the default servlet invoker (another servlet) to be used.  The servlet
invoker typically doesn't have init parameters in it.  In order for your
servlet to be initialized, you need to declare it in web.xml AND map the url
to it using a url-mapping element.  For example,



CompressionFilterTestServlet


compressionFilters.CompressionFilterTestServlet






CompressionFilterTestServlet


/CompressionTest




It's actually bad form to use the "/servlet/classname" invoker to
call a servlet, since the presence of the invoker is not guaranteed by the
servlet spec.

You can also forward to the servlet by using the name declared in
the  element, without mapping the servlet to a URL.  This has
the advantage of hiding the existence of the target servlet.

Cheers,



Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

> -Original Message-
> From: Philipp von Hartrott [mailto:[EMAIL PROTECTED]]
> Sent: May 16, 2002 09:40
> To: Tomcat Users List
> Subject: InitParameters missing in ServletConfig when Servlet-loading
> triggerd through RequestDispatcher
> 
> 
> Hello,
> using Tomcat 4.0.3 (and 4.0.2 also) I encounter the following problem:
> 
> Problem setup:
> My servlet has no  set.
> 
> I start Tomcat.
> I trigger the loading of servlet A through a 
> RequestDispatchers forward as quoted below.
> I trace my servlet A's ServletConfig init-parameters in the 
> init() method call.
> The newly loaded servlet A's ServletConfig DOES NOT contain 
> the init-parameters I specifed in web.xml!
> 
> Unsatisfying solution setup:
> This time I specify a 1 in web.xml:
> 
> I start Tomcat.
> The loading of servlet A is triggerd through the container on startup.
> I trace my servlet A's ServletConfig init-parameters in the 
> init() method call.
> The newly loaded servlet A's ServletConfig as expected DOES 
> contain all init-parameters I specifed in web.xml.
> 
> Why are my init-parameters missing in the first case?
> 
> Thank you,
> Philipp.
> 
> 
> Code used for forwarding:
> RequestDispatcher requestDispatcher = 
> getServletContext().getRequestDispatcher("/servlet/" + 
> responsibleServletName);
> requestDispatcher.forward(servletRequest, servletResponse);
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



winmail.dat
Description: application/ms-tnef

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


InitParameters missing in ServletConfig when Servlet-loading triggerd through RequestDispatcher

2002-05-16 Thread Philipp von Hartrott

Hello,
using Tomcat 4.0.3 (and 4.0.2 also) I encounter the following problem:

Problem setup:
My servlet has no  set.

I start Tomcat.
I trigger the loading of servlet A through a RequestDispatchers forward as quoted 
below.
I trace my servlet A's ServletConfig init-parameters in the init() method call.
The newly loaded servlet A's ServletConfig DOES NOT contain the init-parameters I 
specifed in web.xml!

Unsatisfying solution setup:
This time I specify a 1 in web.xml:

I start Tomcat.
The loading of servlet A is triggerd through the container on startup.
I trace my servlet A's ServletConfig init-parameters in the init() method call.
The newly loaded servlet A's ServletConfig as expected DOES contain all 
init-parameters I specifed in web.xml.

Why are my init-parameters missing in the first case?

Thank you,
Philipp.


Code used for forwarding:
RequestDispatcher requestDispatcher = 
getServletContext().getRequestDispatcher("/servlet/" + responsibleServletName);
requestDispatcher.forward(servletRequest, servletResponse);

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: InitParameters

2001-10-01 Thread Bo Xu


I suggest you need to use your "" to invoke your Servlet if you
want
to use your "",  it will force your "" to be included,
for example:
http://xxx.xxx.xxx.xxx:8080/myapp/servlet/remoteServlet

if you use your "Servlet class name" to invoke your Servlet, for example:
http://xxx.xxx.xxx.xxx:8080/myapp/servlet/ch.hephaistos.web.RemoteServlet

now (I only have tried TC4.0),  the "default Servlet-declaration(instance)" of
your Servlet
class will be invoked, which doesn't include your ""

if you include the  tag, now I guess because it will force
your Servlet
engineer Not to use the "default Servlet-declaration(instance)", so you can get
the ""


Bo
Oct.01, 2001




Alessandro Di Maria wrote:

> Hello!
>
> I have some problems to read the init-parameters for my servlet.
>
> I'm usign tomcat  3.2.3, mod-jk. But tested with tomcat standalone on
> port 8080.
>
> Here's my web.xml, located on TOMCAT_HOME/webapps/test/WEB-INF/
>
> 
> 
> remoteServlet
> ch.hephaistos.web.RemoteServlet
>
> 
> server-host
> localhost
> 
> 
> server-name
> ServletServer
> 
> 
> timeout
> 8
> 
> 5
> 
> 
>
> if I don't include the  tag the init-param will never
> be read !
>
> and here's a snippet of my servlet code:
>
> public class RemoteServlet extends HttpServlet implements RRemoteServlet {
>
> private String serverHost="localhost";
>
> private String severName="ServletServer";
>
> private RServletServer server;
>
> private int timeout=6;
>
> private static int count=0;
>
> private int number;
>
> public void init(ServletConfig config) throws ServletException {
> super.init(config);
> processes = new Hashtable(5);
>
> // config Log4J
> String prefix =
> this.getServletContext().getRealPath("/WEB-INF/conf/");
> Log.loadConfig(prefix+"log4j.lcf");
> Log.log.debug("Log4J configuration laoded");
>
> // load configuration
> serverHost  = config.getInitParameter("server-host");
> Log.web.info("Remote Host: "+serverHost);
> severName   = config.getInitParameter("server-name");
> Log.web.info("Server Name: "+severName);
> String timeoutInit = config.getInitParameter("timeout");
> try{
> timeout = Integer.parseInt(timeoutInit);
> } catch (NumberFormatException nfe){
> timeout = 6;
> }
> Log.web.info("Timeout: "+timeout);
>
>
> // test only use DEBUG-Mode
> count++;
> Log.web.debug("Servlet Instance Nr."+count);
> number=count;
> Log.web.debug("Servlet Nr."+number);
>
> // prepare Servlet for callbacks
> try{
> UnicastRemoteObject.exportObject(this);
> } catch(RemoteException re){
> re.printStackTrace();
> }
> this.lookup(serverHost,severName);
> try{
> this.server.register(this);
> Log.rmi.info("Servlet registred to "+severName);
> } catch (RemoteException re){
> Log.rmi.fatal("Register to ["+severName+"] failed!",re);
> }
> }
>
> Here the output I get from Tomcat:
>
> 2001-10-01 11:56:46 - ContextManager: Adding context Ctx( /test )
> 0 DEBUG [main] hephaistos.log init - Log4J configuration laoded
> 21INFO  [main] hephaistos.web init - Remote Host: localhost
> 21INFO  [main] hephaistos.web init - Server Name: ServletServer
> 21INFO  [main] hephaistos.web init - Timeout: 8
> 21DEBUG [main] hephaistos.web init - Servlet Instance Nr.1
> 21DEBUG [main] hephaistos.web init - Servlet Nr.1
> 241   INFO  [main] hephaistos.rmi init - Servlet registred to ServletServer
> 2001-10-01 11:56:47 - PoolTcpConnector: Starting HttpConnectionHandler
> on 8080
> 2001-10-01 11:56:47 - PoolTcpConnector: Starting Ajp12ConnectionHandler
> on 8007
> 9594  DEBUG [Thread-21] hephaistos.log init - Log4J configuration laoded
> 9594  INFO  [Thread-21] hephaistos.web init - Remote Host: null
> 9594  INFO  [Thread-21] hephaistos.web init - Server Name: null
> 9594  INFO  [Thread-21] hephaistos.web init - Timeout: 6
> 9594  DEBUG [Thread-21] hephaistos.web init - Servlet Instance Nr.2
> 9594  DEBUG [Thread-21] hephaistos.web init - Servlet Nr.2
> 11868 ERROR [Thread-21] hephaistos.rmi lookup - Lookup for [null] failed!
> java.rmi.UnknownHostException: Unknown host: null; nested exception is:
> java.net.UnknownHostException: null
> java.net.UnknownHostException: null
> at java.net.InetAddress.getAllByName0(InetAddress.java:571)
>  .
>
> Thread [main] is launched on tomcat's startup, Thread [21] on the first
> request for this servlet.
>
> I don't understand why tomcat has initialized another intance of the
> servlet, he does it for every new request.
> If I don't read any init-params tomcat only uses one instance

InitParameters

2001-10-01 Thread Alessandro Di Maria

Hello!

I have some problems to read the init-parameters for my servlet.

I'm usign tomcat  3.2.3, mod-jk. But tested with tomcat standalone on 
port 8080.

Here's my web.xml, located on TOMCAT_HOME/webapps/test/WEB-INF/



remoteServlet
ch.hephaistos.web.RemoteServlet


server-host
localhost
   

server-name
ServletServer


timeout
8

5
 


if I don't include the  tag the init-param will never 
be read !

and here's a snippet of my servlet code:

public class RemoteServlet extends HttpServlet implements RRemoteServlet {
   
private String serverHost="localhost";
   
private String severName="ServletServer";
   
private RServletServer server;
   
private int timeout=6;
   
private static int count=0;
  
private int number;
   
public void init(ServletConfig config) throws ServletException {
super.init(config);
processes = new Hashtable(5);
   
// config Log4J
String prefix =  
this.getServletContext().getRealPath("/WEB-INF/conf/");
Log.loadConfig(prefix+"log4j.lcf");
Log.log.debug("Log4J configuration laoded");
   
// load configuration
serverHost  = config.getInitParameter("server-host");
Log.web.info("Remote Host: "+serverHost);
severName   = config.getInitParameter("server-name");
Log.web.info("Server Name: "+severName);
String timeoutInit = config.getInitParameter("timeout");
try{
timeout = Integer.parseInt(timeoutInit);
} catch (NumberFormatException nfe){
timeout = 6;
}
Log.web.info("Timeout: "+timeout);
   
   
// test only use DEBUG-Mode
count++;
Log.web.debug("Servlet Instance Nr."+count);
number=count;
Log.web.debug("Servlet Nr."+number);
   
// prepare Servlet for callbacks
try{
UnicastRemoteObject.exportObject(this);
} catch(RemoteException re){
re.printStackTrace();
}
this.lookup(serverHost,severName);
try{
this.server.register(this);
Log.rmi.info("Servlet registred to "+severName);
} catch (RemoteException re){
Log.rmi.fatal("Register to ["+severName+"] failed!",re);
}
}

Here the output I get from Tomcat:

2001-10-01 11:56:46 - ContextManager: Adding context Ctx( /test )
0 DEBUG [main] hephaistos.log init - Log4J configuration laoded
21INFO  [main] hephaistos.web init - Remote Host: localhost
21INFO  [main] hephaistos.web init - Server Name: ServletServer
21INFO  [main] hephaistos.web init - Timeout: 8
21DEBUG [main] hephaistos.web init - Servlet Instance Nr.1
21DEBUG [main] hephaistos.web init - Servlet Nr.1
241   INFO  [main] hephaistos.rmi init - Servlet registred to ServletServer
2001-10-01 11:56:47 - PoolTcpConnector: Starting HttpConnectionHandler 
on 8080
2001-10-01 11:56:47 - PoolTcpConnector: Starting Ajp12ConnectionHandler 
on 8007
9594  DEBUG [Thread-21] hephaistos.log init - Log4J configuration laoded
9594  INFO  [Thread-21] hephaistos.web init - Remote Host: null
9594  INFO  [Thread-21] hephaistos.web init - Server Name: null
9594  INFO  [Thread-21] hephaistos.web init - Timeout: 6
9594  DEBUG [Thread-21] hephaistos.web init - Servlet Instance Nr.2
9594  DEBUG [Thread-21] hephaistos.web init - Servlet Nr.2
11868 ERROR [Thread-21] hephaistos.rmi lookup - Lookup for [null] failed!
java.rmi.UnknownHostException: Unknown host: null; nested exception is:
java.net.UnknownHostException: null
java.net.UnknownHostException: null
at java.net.InetAddress.getAllByName0(InetAddress.java:571)
 .

Thread [main] is launched on tomcat's startup, Thread [21] on the first 
request for this servlet.

I don't understand why tomcat has initialized another intance of the 
servlet, he does it for every new request.
If I don't read any init-params tomcat only uses one instance, even if I 
would implement the SingleThreadModel.

What's wrong here?!

Alessandro Di Maria





Re: Multiple servlets using same initParameters

2001-08-14 Thread Jan Labanowski

In web.xml:


  open-port
  7180
  Port for regular HTTP via Apache


  secure-port
  7143
  Port for HTTPS via Apache


and in the jsp page:



parameters are:
open-port=<%= application.getInitParameter("open-port") %>
secure-port=<%= application.getInitParameter("secure-port") %>



or in the servlet:

String open_port = getServletContext().getInitParameter("open-port");
String secure_port = getServletContext().getInitParameter("secure-port");

Jan
Jan K. Labanowski|phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center|Internet: [EMAIL PROTECTED] 
1224 Kinnear Rd, |http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163  |http://www.osc.edu/


On Tue, 14 Aug 2001 [EMAIL PROTECTED] wrote:

> I have multiple servlets in the same directory and they all get the same
> init-params from web.xml.
> 
> Currently, I have 5 servlets and am required to repeat all the init-params
> 5 times, one for each servlet.  So if one parameter changes, I have to
> change it five times in web.xml. I'd like to only have them in the web.xml
> file once and all servlets use them.  How is this possible?
> 
> One approach I took was to create a servlet that all my other servlets
> subclassed and all it did was grab the init-params.  I couldn't get it to
> work.
> 
> Any ideas?
> 
> Thanks,
> 
> JEB
> 





RE: Multiple servlets using same initParameters

2001-08-14 Thread Jim Urban

This may not work, but is worth a try...

Create a servlet which does nothing other then read the init parameters into
static variables and provides static functions to access the variables
containing the init parameters.  Then in web.xml tell this servlet
1 so it will be always be the first
servlet loaded.  Then when you need to change a parameter you simply change
it once and restart Tomcat.

Jim Urban
Product Manager
Netsteps Inc.
Suite 505E
1 Pierce Pl.
Itasca, IL  60143
Voice:  (630) 250-3045 x2164
Fax:  (630) 250-3046


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 4:38 PM
To: [EMAIL PROTECTED]
Subject: Multiple servlets using same initParameters


I have multiple servlets in the same directory and they all get the same
init-params from web.xml.

Currently, I have 5 servlets and am required to repeat all the init-params
5 times, one for each servlet.  So if one parameter changes, I have to
change it five times in web.xml. I'd like to only have them in the web.xml
file once and all servlets use them.  How is this possible?

One approach I took was to create a servlet that all my other servlets
subclassed and all it did was grab the init-params.  I couldn't get it to
work.

Any ideas?

Thanks,

JEB





RE: Multiple servlets using same initParameters

2001-08-14 Thread Martin van den Bemt

Use a config file or properties file makes life a bit easier.. (at least
that's the way I do it)

Mvgr,
Martin

> -Original Message-
> From: Peter Davison [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 14, 2001 11:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Multiple servlets using same initParameters
>
>
> How about this:
>
> Set up your init params for one of your servlets.
> Make sure that this servlet get's pre-loaded first before the other
> servlets.
> Have the init() method of that servlet store all the parameters as
> System properties and let the other servlets retrieve the parameters
> as System properties instead of init params.  A bit of a hack but it
> works.
>
> P.
>
>
> On Tue, 14 Aug 2001 17:38:26 -0400
> [EMAIL PROTECTED] wrote:
>
> > I have multiple servlets in the same directory and they all get the same
> > init-params from web.xml.
> >
> > Currently, I have 5 servlets and am required to repeat all the
> init-params
> > 5 times, one for each servlet.  So if one parameter changes, I have to
> > change it five times in web.xml. I'd like to only have them in
> the web.xml
> > file once and all servlets use them.  How is this possible?
> >
> > One approach I took was to create a servlet that all my other servlets
> > subclassed and all it did was grab the init-params.  I couldn't
> get it to
> > work.
> >
> > Any ideas?
> >
> > Thanks,
> >
> > JEB
>




Re: Multiple servlets using same initParameters

2001-08-14 Thread Peter Davison

How about this:

Set up your init params for one of your servlets.
Make sure that this servlet get's pre-loaded first before the other
servlets.
Have the init() method of that servlet store all the parameters as 
System properties and let the other servlets retrieve the parameters
as System properties instead of init params.  A bit of a hack but it 
works.

P.


On Tue, 14 Aug 2001 17:38:26 -0400
[EMAIL PROTECTED] wrote:

> I have multiple servlets in the same directory and they all get the same
> init-params from web.xml.
> 
> Currently, I have 5 servlets and am required to repeat all the init-params
> 5 times, one for each servlet.  So if one parameter changes, I have to
> change it five times in web.xml. I'd like to only have them in the web.xml
> file once and all servlets use them.  How is this possible?
> 
> One approach I took was to create a servlet that all my other servlets
> subclassed and all it did was grab the init-params.  I couldn't get it to
> work.
> 
> Any ideas?
> 
> Thanks,
> 
> JEB



Multiple servlets using same initParameters

2001-08-14 Thread JBrawner

I have multiple servlets in the same directory and they all get the same
init-params from web.xml.

Currently, I have 5 servlets and am required to repeat all the init-params
5 times, one for each servlet.  So if one parameter changes, I have to
change it five times in web.xml. I'd like to only have them in the web.xml
file once and all servlets use them.  How is this possible?

One approach I took was to create a servlet that all my other servlets
subclassed and all it did was grab the init-params.  I couldn't get it to
work.

Any ideas?

Thanks,

JEB