Linking Sessions

2004-09-19 Thread SH Solutions
Hi

Is there a way to link a session?
I have the following scenario:

I have multiple domains on a server. Some links on these pages need to
switch to another domain, exspecially, when I need to switch to
ssl-protected sites, since all these virtual domains share the same ssl
domain (one ip only).

So my problem is, that inter-domain-links by default loose their session. Is
is a problem.
(Putting things into a shopping cart is okay, but when switching to ssl for
credit card information, the cart my not be lost.)

Now, I have special links, that lead to a servlet that puts every attribute
of the local session into a hashmap and jumps to another special servlet on
the other domain, which itself copies attributes from the hashmap back to
the new session.

This schema works, but it is a bottleneck in many ways.

So I am searching a way to link to a KNOWN session instead if creating a new
one.
Is there a way for this?

Regards,
  Steffen


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



AW: SSL for multiple domains and one application with Tomcat

2004-09-18 Thread SH Solutions
Hi

> What I've read in my research is that it is a limitation of SSL to have
multiple domain names authenticate with the same IP.

Correct. You cannot have "virtual hosts" with SSL. Each and every SSL host
needs it's own ip.
(Exception are wildcard-certificates, wich allow you to use use any
subdomain with one ip and one certificate.)

> So if that is a limitation and we have to get a second IP to connect to
the server, how would we configure Tomcat for that?

Setup two connectors for SSL and use the address="1.2.3.4" attribute to bind
that connector to one ip only.
Each connector will serve one ip and has attributes to access one
certificate.

Regards,
  Steffen


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



AW: Windows 2003 Java VM memory leak due to C# garbage collection algorithm

2004-09-17 Thread SH Solutions
Hi

> What I want to know is even if our program has a memory leak, it should
crash the JVM right?

No, your program (better your webapp) should get OutOfMemoryExceptions and
should continue running. Mostly, it will not do sensful things any more, but
it should NEVER crash the JVM.

> It should not keep increasing the memory allocated from the Windows Server
2003 O/S.

Right. It should go about 64 MB over your max heap setting (which is approx.
the jvm overhead), but not 1 GB above. There is something wrong. Are you
sure you specified both MIN AND MAX heap values? Can you show your OPTS? How
are you starting tomcat - as service or as application?

> Could this be a issue with the Windows server 2003 garbage collection as I
read it is written using C#? anyone has any idea if this is the problem? 

No.
Windows 2003 server has nothing to do with applications garbage collection.
Java JVM have their own garbage collector, you can even choose one from
command line - what you could try.
Windows 2003 itself has no garbage collection at all. Windows 2003 provides
.net by default, which itself works semtantically like a VM and which itself
DOES HAVE a garbage collector. That one IS used for C#, but I doubt it is
written in C#.
And even if it would be written in C#, that should not be the problem, since
it is used in really huge applications and has not shown to be a big source
of leaks so far.

Regards,
  Steffen


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



SSL certs

2004-09-15 Thread SH Solutions
Hi

I want to install SSL to my tomcat server.
I do have a signed ceritificate as .key, .csr and .crt files.
How do I get tomcat to use these?

Regards,
  Steffen


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



AW: How many connections can be made to Tomcat on Windows?

2004-09-14 Thread SH Solutions
Hi

> in the even you're using windows professional, it is limited to 10 inbound
connections, which is easy to overlook and forget.

NO.
The limit of 10 inbound connections apply to _windows shares only_. It's a
limitation to prevent usage of "professional" as "server".

However, the tcp/ip stack of professional and server are the _SAME_ and
there is _NO_ limitation on incoming or outgoing connections, as long as the
hardware can handle them.

One exception: Windows xp sp2 has a limit for the rate of creating outgoing
connection, which is suppost to slow down worms, but it can be disabled in
registry. However, this does NOT apply to incoming connections.

However, 1000 request/second is propably way to much for one system. Buy two
and use load balancers, or do very good cashing in your webapp. But do not
access the database for every page hit.

Regards,
  Steffen


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



AW: Tomcat-Apache and SSL- Re-Post

2004-09-12 Thread SH Solutions
Hi

> ... that the source port from the load balancer has changed from port 80
to port 8000 so our app will behave correctly and will present our pages as
secure.

Are you sure, you are talking about source ports?
Since you need to contact tomcat on the same port every time and your target
and source ips are always the same too, there would be no way for the tcp/ip
stack to associate packets with connection...

Regards,
  Steffen


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



AW: error: duplicate local variable

2004-09-12 Thread SH Solutions
Hi

> You already had declared another List named "values" just a few lines
above, as shown in the edited version below:

Though it should work, since the second "values" is in another scope.

Regards,
  Steffen


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



AW: [OFF-TOPIC]Yoav --> RE: Some pretty basic Tomcat ConnectionPooling Questions????

2004-09-10 Thread SH Solutions
Hi

Sorry, I haven't read the whole treads, but:

> Before I made this change I didn't have a conn.close() statement or a
finally clause anywhere either (I DID have resultset.close and
statement.close()).

Never never do that.
If you do not call connection.close(), the connection is NOT returned to the
pool. So ALWAYS close().
(Maybe you are lucky and there are some special precautions of the pool
driver, that make this work, but most drivers do not.)

Regards,
  Steffen


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



AW: More than one thread part II

2004-09-09 Thread SH Solutions
Hi

> if a set the autoDeploy="false" for each virtual host has no effect. So
still 8 host, so 8x8 initialisations.

Setting autoDeploy will simply disable mouting your webapps automatically
when tomcat starts.
If you still want all web applications to be available from all hosts, there
is nothing you can do.
If you want only some application to be available per host, use different
appBases or work with autoDeplay = false.

Regards,
  Steffen


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



Programmatically assign servlet mappings

2004-09-08 Thread SH Solutions
Hello

I want to archive the following:

I want to start my application using some ContextListener.
Then my application shall register the required servlet-mappings.
In my web.xml I do NOT want to have any servlet-mappings at all.

The reason for this is, that my cms system serves different content types
with different servlets. One servlet per type. Additionally every servlet is
a module, managed by my cms system.
Basically this means, that I do not know, which modules and hence, which
servlets need to be mapped, if any.

Is there a way to do this?
I assume yes, because embedded tomcat need such things too, I think.

Additionally, is there a way to do this container independent - is there a
servlet-api way to do it?

Regards,
  Steffen


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



AW: More than one thread part II

2004-09-08 Thread SH Solutions
Hi

> I have defined 7 (virtual) hosts in my  tag (server.xml). And
during startup Tomcat initiated 7 times (I think for each host all the hosts
again) each application, but one time is enough or not??

You have 7 hosts. Each applications belongs to EXACTLY ONE host.
If your appBase is the same, the application is loaded FOR EACH host again.

But you have more problems:
The application is not only initialized multiple times, each application
instance is loaded in it's own classloader.
One implication of this is, that even static data is not shared...

Rule: Use default host to match any Domain, do not use virtual hosts.

Regards,
  Steffen


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



AW: Tomcat 5.5.0 Shared classes does not work

2004-09-07 Thread SH Solutions
http://learn.to/quote
 

-Ursprüngliche Nachricht-
Von: Hongsong Zhou [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 8. September 2004 00:02
An: [EMAIL PROTECTED]
Betreff: Re: Tomcat 5.5.0 Shared classes does not work

I did try jar my classes and put in the jar in shared/lib, still does not
work.

>>> [EMAIL PROTECTED] 09/07/04 04:53PM >>>
On Tue, 07 Sep 2004 15:45:08 -0500, Hongsong Zhou
<[EMAIL PROTECTED]> wrote:
> I installed tomcat 5.5.0 and put some classes in 
> $CATALINA_HOME$/shared/classes, but when I try to use them in my 
> webapps, it always said class not found. I checked classloader 
> document at 
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.htm
> l, nothing is wrong. I use these in tomcat 4 and tomcat 5.0.19, all 
> works fine.

It's an early alpha build, so I suppose something could be bad with the
initialization of the classloader (it did change: we're now using a standard
URL classloader for that). If you jar your classes and put the jar in
shared/lib, does it work ?

--
x
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
x

-
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]


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



AW: TOMCAT_OPT questions (-Xms, -Xmx)

2004-09-07 Thread SH Solutions
Hi

> 1. I see a lot of java process running on my machine when I do a 'ps' to
show the process list. So how many JVM are actually started by the tomcat
instance? 

No. You see just one java process.
However, your version of ps cannot handle threads correctly.
The JVM is multi-threaded.

> If there are more than one JVM, and each JVM uses the min/max I specified
in the TOMCAT_OPTS, I think my RAM will quickly used up by the tomcat?

No, it is the very same part of memory all the time. Don't fear.

> 2. What is the best -Xms and -Xmx value to use for a site that has about
200-300 concurrent users?

Depends completely on your application.
Basic rule: Do a lot of load testing of common application usage patterns.
Use a profiler for this. Set -Xm? to the highest values you observe that
one.
Do not subtract the memory used by the profiler, leave it as buffer.

Regards,
  Steffen


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



AW: Tomcat5 and Servlet Timeout: Possible?

2004-09-07 Thread SH Solutions
Hi

> So if one thread hangs, it hangs forever.
> If it blocks other threads, the whole app hangs...

So, yes, if you application has a bug, it has a bug.

I would NOT want tomcat to kill one of my threads, doing security-relevant
modifications in some kind of transaction.
Not even if other threads are waiting for these core modifications to
complere.

Regards,
  Steffen


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



AW: ThreadPool: Pool exhausted with 100 threads

2004-09-05 Thread SH Solutions
Hi

> Has anyone been able to solve or work around this problem under Tomcat
3.2.1?

Any reasaon for this?
There is hardly anyone who can help you with 3.x.
3.x is of stone age, 4.0.x is already very old, 4.1.x is maintained but also
not current, and 5.0 is already stable for a while.
Even 5.5 is available but in early stages.

If possible, try to upgrade to 4.1.30 or 5.0.27.

Regards,
  Steffen


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



AW: Configuration Assistance Request - Apache 2.0.5 - Tomcat 4.1.3 - Tomcat 4.1.3 Connector - JK2

2004-09-05 Thread SH Solutions
HI

> Got Jakarta 4.1.3 installed from fresh copy that I got from the jakarta
site.

You are joking?
4.1.30 is current. I hope, you ment 4.1.30 and not 4.1.3...

Regards,
  steffen


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



AW: Unable to integrate Apache 2.0.24, mod_jk2 with Tomcat 5.

2004-09-03 Thread SH Solutions
Hi

> Servlets are still not being forwarded - Apache reports - "404 file 
> not
found" when I click on, for example, - http://localhost/MyServlet.
MyServlet exists on my root_path as MyServlet.class . Can anyone tell me how
to prevent this error and forward the request to Tomcat5?

First, simply copying Java Classes to root_path does not work.
Servlets need to be
1. inside WEB-INF
2. NOT packageless
3. mapped in web.xml

Try to get tomcat with it's own html-connector to work first.
It is much easier than with apache / mod_jk.

THEN think about using tomcat without apache.
And only LAST, put mod_jk inbetween.
In that case, think about updateing your fairly old version of Apache2.
2.0.50 is current stable. 2.0.24 is old and has much more bugs. There should
be no problems, since the apache2 api is stable since 2.0.22.

Regards,
  Steffen


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



AW: Request for an Immediate Solution

2004-08-14 Thread SH Solutions
Hi

> TomCat Version is 4.0.3

Use 5.0.27 or later instead.

4.0.3 is not only old, but very old. 
If you have to stick to 4.x, use 4.1.30.

There is no reason whatsoever to use 4.0.3.

Regards,
  Steffen


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



AW: tomcat output gets mixed up for different requests

2004-08-03 Thread SH Solutions
Hi

> So it seems that Tomcat does not spawn a new servlet for a new request,
althought my web.xml file contains:
> 
>  Navigation
>  Navigation
>  5
> 

Load-on-startup lets you set initialization ORDER, not instance COUNT.

It is totally up to tomcat, how many instances of the servlet are created.
At least one is. Maybe more, maybe only one.
This might also change between versions.

Do not use "synchronized" doXXX methods. Use local variables.

Regards,
  Steffen


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



AW: detecting the shutdown of tomcat in a servlet

2004-07-31 Thread SH Solutions
Hi

Where can I find an example or documentation about how to use a
ServletContextListener ?
Implementation is not the problem, but where to configure tomcat to call it?

Regards,
  Steffen


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



AW: full webapp path from servlet api

2004-07-30 Thread SH Solutions
Hi

> I searched the ServletContext ... but didn't find anything.

You propably missed ServletContext.getRealPath( "/mywebapp/" );

Regards,
  Steffen


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



Logging, Analysis and Forwarding

2004-07-28 Thread SH Solutions
Hi

I have 3 questions:

1. How can I enable redirection of errorLogs, accessLogs AND stdout/stderr
into MONTHLY files with tomcat 5.0.27+?
2. Is there any freeware tool to analyse tomcats accessLogs?
3. Is there an easy way to forward host/test/... to
http://127.0.0.1:8080/test/ (there is apache in 8080, tomcat on 80). I
read that filters could do so, but found no example...

Maybe someone can help me. Thanks.

Regards,
  Steffen


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



RE: I've officially decided that JSTL is one of the worstthingsto ever happen

2004-07-04 Thread SH Solutions
Hi

> > Right now, I would say that java applications (if well written) are at 
> > least half as fast as c applications (also well written).

> Which means that when your java app is in competition with a native app,
youve lost the market.

In some very rare situations, maybe. Most software nowadays is waiting for
the user 99% of the time.
And even, when speed is important, reliability is always more important.
In general, Java programs turn out to be much more stable.

Furthermore, they are plattform independent.

Regards,
  Steffen


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



Sessions and Domains

2004-07-04 Thread SH Solutions
Hi

I've got a problem with sessions.
I have sessions for every user. There are a few information in these
session, include their login account.

Under some circumstands I need to redirect these users to other domains
running the same webapp.
Right now, when I detect this, I copy all information into a hashmap,
genereate a unique key, redirect them to a special page on the new domain,
set all session attributes again from the hashmap, which can be found using
the unique key. and redirect them inside the new domain to the page, they
should go to.

This works fine, but creates a second session. If the user already opened a
new browser window before klicking the domain-changing link, these two
sessions are different. This is not, what I want.

Is there a way to link a existing session to a new request, which has no
session that far?
There is NO request.setSession( oldSession )...

It is no problem to get hands on the session, which needs to be linked, but
i cannot link it.

Regards,
  Steffen


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



RE: I've officially decided that JSTL is one of the worst thingsto ever happen

2004-07-04 Thread SH Solutions
Hi

> It's not. But the use case is. 
> While Java is definitely a good approach for business apps, it's
unacceptable for edited apps, for which "look and feel" remains a top
criteria when the customer makes his choice.

I totally agree on this, even though there is a lot of progress going on.

> While Java is definitely a good approach for business apps, it's
unacceptable for edited apps, for which "raw performance" remains a top
criteria when the customer makes his choice.

I do not agree on this any more. Java has prooven to be very efficient and
is still improving more and more.
Right now, I would say that java applications (if well written) are at least
half as fast as c applications (also well written).

Suns promotion gives you this:
http://research.sun.com/techrep/2002/smli_tr-2002-114.pdf
I agree, that Sun has interests on saying that java is fast, but read it.

Java is even a lot faster in some areas of computing:
Assume, you have code that needs to allocate lots (thousands) of very small
objects for a short period of time in memory. In C, where you do not have a
garbage collector, you need to free these memory peaces one by one, which is
a burdon for memory management and will slow down things. In Java,
allocation is fast (just one pointer operation) and there is no need to free
things. The garbage collector throws all unreferenced objects of the
youngest collection away at once, not processing them one by one. Obviously,
in such situations, Java has performance advantages. This seems to be a
seldom situation, but it occurs much more often, then you might think.
Especially in Java, where every function, that returns more then one value
needs to return an temporary object. This seemed to be very costly for me,
when I startet using Java, but right now I understood that this is has
constant costs - like in no conservative language.

Regards,
  Steffen


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



RE: I've officially decided that JSTL is one of the worst things to ever happen to mankind

2004-07-04 Thread SH Solutions
Hi

> After getting convinced to try JSTL, I learned the following things:

..

Having read points 1-6, I thought, there must be a truth in your remarks.
(I did'nt use JSTL or EL yet, but I am about to try.)

But then I got to:

> Why was C++ invented?  To give programmers jobs.  No other reason
whatsoever, C does whatever C++ does just as good, and better. 

At that point, you just showed to be very closed-minded.
(C++ does have an accurate object model, which improves a lot. Yes, you can
do similar things with macros, but cumbersomely. From your point of view, go
ahead and programm assembly code. Believe me, it dies whatever C does just
as good, and better.)

No more trusting any of your remarks...

Regards,
  Steffen


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



RE: Is tomcat a suitable server for our application ?

2004-06-15 Thread SH Solutions
Hi

>   We are planning to host a web application which is estimated to have

> around 3000 concurrent users. We are using SQL Server 2000 as database 
> and Struts 1.1 framework.
> 
> ...
> 
>   Do you think that Tomcat is a suitable web server for our 
> application?

For 3000 connections you should use multiple tomcats with some load balancer
in front of it.
And don't forget to check heap sizes regulary. You need to configure the JVM
to use more than 64 MB and you might need to buy more Ram, if you have huge
sessions. [And for 3000 connections you should really think about caching a
lot of memory information in you application instead of drangling the
database - but this requires even more memory.]

Regards,
  Steffen


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



RE: How do I run servlets on the root directory of localhost?

2004-06-14 Thread SH Solutions
Hi

> Thanks Stephen,  it did.  except now I have no standard out.  ugh..

Sorry, what do you mean?

Regards,
  Steffen


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



RE: JK2 - tomcat 5 - apache 2.0.49

2004-06-13 Thread SH Solutions
Ho

> When I dowload the binaries of JK2 for windows, I have a mod_jk2.0.49.so
and not .dll, is this normal and can I use it as is with Apache ?

>From what I read on this list, yes, this is normal. (for apache2)
But I havn't used it myself yet.

> Also, if you have any good link explaining how to integrate these
components on XP ...

Sorry, no idea.

Regrads,
  Steffen


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



RE: How do I run servlets on the root directory of localhost?

2004-06-13 Thread SH Solutions
Hi

> So if '/' is a bad servlet mapping what should it be for the root?

Thats a problem i was suffering a long time from when porting to tomcat
comming from resin.
Resin allowed regular expression matching on paths, tomcat does not.

Anyway, since Tomcat 5.0 (at least) it is possible to set a servlet as
welcome-file.
Simply mount your servlet as /home and set "home" to be your welcome-file.
It will solve your problems.

Regards,
  Steffen


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



RE: URL validation

2004-06-08 Thread SH Solutions
Hi

> ... So problem here.

Meant: No problem here.

Sorry, regards,
  Steffen


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



RE: URL validation

2004-06-08 Thread SH Solutions
Hi

> Here is my problem, I am looking for a way to syntactically valid a given
URL without having to actually creating an URL object.

try {
  new URL( myUrl );
  return true;
} catch ( Throwable t ) {
  return false;
}

Why not creating it?
Javas young generation garbage collection should dispose this immediatly. So
problem here.

Regards,
  Steffen


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



RE: Porting from Resin to Tomcat

2004-06-08 Thread SH Solutions
Hi

> We are porting an application from Resin running on WinNT/IIS to Tomcat on
Linux.  However, we are noticing a lot of errors coming up on Tomcat that do
not occur on Resin.
> Is there anyone on the list that has ported an app between the two
platforms?  What are some known issues in the porting?

Yes, I did.
For some time, our app was even supported on both plattforms.

The only problem we got into, was that resin automatically parses mutipart
post content. Tomcat does not. So we went for commons-fileupload and we are
fine with that.

Nothing else needed to be changed. (We are only using servlets, no JSPs.)

> However, a lot of the errors coming up seem to be java based errors (which
is odd, since Java is a write once, run anywhere language).

Neither tomcat nor resin are running your classes. The VM does. So there
really is no difference.
Tell us, which errors come up, maybe we can help.

Keep in mind, that you have to develop container-independent. Both resin and
tomcat give you some functionallity only with their own classes. As far as I
can tell, this is mostly the case only for things which are not defined in
the servlet specs. Try to avoid them as much as possible, since they will
definitly make your application plattform dependent. And writing an
application that supports both is a burden in java. (I think this is really
a problem of the language.)

Regards,
  Steffen


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



DataSources

2004-06-04 Thread SH Solutions
Hi

I am using a DataSource inside a a servlet. Until now I am configuring it
with my own code (Creating instance and using setters.)
What I would like to do now is, I would like to move that database
configuration to the web.xml file.

So far, I have a correct fragmet for server.xml:




  
factory
org.firebirdsql.pool.FBWrappingDataSource  
  
  
userName
sysdba
  
  ...


Anyway, I would like to have it in web.xml instead.
Is there a way to do that? And how do I get hold of that DataSource from my
Java Code?

Is this method compatible with other servlet engines?
I would like to prevent non-standart methods.


Regards,
  Steffen


BTW: Are HttpSessionListeners and ContextListeners standart or
tomcat-specific?


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



RE: Tomcat as 'root' insecure? (again)

2004-05-26 Thread SH Solutions
Hi

> Okay, I suppose you all are right saying that it's better not to run as
root. But does the same apply to Windows?

No, on Windows usual users are allowed to bind ports below 1024, which is
the only problem for tomcat.
Create any user account you want, give it sufficient access rights to
tomcats folders. Done.
(Maybe you need to give it some read rights for the registry configuration
of the service loader. If thats a problem start tomcat using srvany
(deprecated!).)
[Also, you might need to give that user rights to "log on as service and log
on locally", but surely no special file oder registry access rights other
that those mentioned above.]

> We're using Tomcat 4.1.24 on Windows 2000 Server, and up till now we've
always run Tomcat as root.

There is nothing in Windows which equals "root". There is NO user, which has
any right anywhere.
[You could configure this though, but you should not. It is nice for
different admins to have private folders, where no other admin can look
inside. And a lot more, you know.]

> I don't see a jvsc-script or directory. Do I need to upgrade to TC5 to be
able to use the script?

You shouldnot need, afaict. Simply change the service's user.

Regards,
  Steffen


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



RE: HTTP Servlet - How to use the same connection for GET URL?

2004-05-26 Thread SH Solutions
Hi

> I considered HTTP/1.1 but left it out for a few reasons, mostly that in
this case it would lead to hackishness. ;)

Hey, noone said it's gonne be easy. :D

> For example, the socket may timeout if there aren't enough requests within
a given timeframe.  Another is that, if the servlet and server aren't
managed/owned by the same people, it's a little rude to maintain a 24/7
socket to someone else's machine for a "stateless" protocol...

But an open socket between these would be even bettern than thousands of
connections opening and closing all the time.
Further, most systems only do at most around 100 request on persistent
connections, so the sockets would not be connected that long.

Regards,
  Steffen


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



RE: HTTP Servlet - How to use the same connection for GET URL?

2004-05-26 Thread SH Solutions
Hi

> If I understand your question, there's no good way around this if you
*must* use an HTTP call. HTTP is all about stateless, quick-hit requests,
and it sounds like you're aiming for more of a stateful, constant-connection
protocol.  Furthermore, if you're opening connections to different hosts
each time, then reusing the same socket is moot anyhow.

Not absolutely.

You could use a HTTP Client library, which understands http 1.1 (if the
server in questions does), and put connections into a central
Map. If queries for the same host occur, you could
reuse them, if they are not timed out.

This will imply a lot of synchronization and timer programming though.

Maybe there is a package, which already does this? May be even
commons-httpclient? I dunno.

Regards,
  Steffen


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



RE: HTTP AUTH

2004-05-25 Thread SH Solutions
Hi

> Can you explain yourself here?  It is not obvious to me.  How does the
number of users make any difference here.  Just set up BASIC Auth in
web.xml.  You don't have to define your users and roles in web.xml, if
that's what you are implying.

Alright, that is what I was thinking.
So, is it possible, to use web.xml security together with our own login
handler?
Especially with certificates?

Regards,
  Steffen


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



RE: HTTP AUTH

2004-05-25 Thread SH Solutions
Hi

> How about use web.xml to configure your security rather than doing it by
hand?
> That way tomcat does all the hard work.

We have a complex CMS system with about 35000 users.
We obviously do NOT want to use web.xml.

Regards,
  Steffen


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



HTTP AUTH

2004-05-25 Thread SH Solutions
Hi

I managed to set up HTTP BASIC AUTH using the following:

  HttpServletResponse response = request.getResponse();
  response.setStatus( 401 );
  response.setHeader( "WWW-Authenticate", "BASIC realm=\"realm\"" );

Now I want to go a step further and implement certificate authentification.
Can someone give me a hint?

Obviously I need to send something else than BASIC and a bit more.
But I need a place to start...

Regards,
  Steffen


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



HTTP BASIC Authentication

2004-05-14 Thread SH Solutions
Hi

Our CMS is using it's own security control system.
We can login users using forms.

Now I want to use BASIC Authentication.
So (upon clicking a special link) a login form should appear (browser
build-in) and I need to get the username and password inside my servlet. How
can I do this?

Any hints are welcome.

Thanks,
  Steffen


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



RE: Connecting the HTTP Server and Tomcat

2004-04-07 Thread SH Solutions
Hi

Currently I use
  catalina.sh start | stop
to control tomcat 4.1.x and 5.0.x running as root.

Can I change it easily to use commons-daemon (running as non-root)?
A lot of command line options are set in catalina.sh. Would I need to do
this manually ?

Regards,
  Steffen


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



RE: Starting and stopping connections in Tomcat 4.2

2004-04-06 Thread SH Solutions
Hi

Subject: Starting and stopping connections in Tomcat 4.2

Cool, where did you get this one?

Regards,
  Steffen


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



RE: Memory Issues

2004-04-03 Thread SH Solutions
Hi

> Thanks a lot for the information. I am using java 1.4.1_02 . 

I am not sure, maybe someone else can jump in, but I think, this was one the
those VM releases I mentioned here:

> It was said, that where were StringBuffer memory leaks in at least one of
the recent versions.

So this might be the first thing to update instantly.

Regards,
  Steffen


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



RE: Memory Issues

2004-04-03 Thread SH Solutions
Hi


> I have an application running on tomcat4.1.24.

Upgrade. 4.1.30 is latest in 4.1.x.
I can even recommend 5.0.19, that I am running without problems. For some it
has shown to be even faster.


> I force the GC to run so that the memory is freed.

No. You can not. You can tell the system, that it should. You cannot enforce
it.


> What I don't understand why is the total memory maximum.

USE A PROFILER. This is a important step. You may be able to adjust some
parameters to take the OoME to happen less frequently, but it will NOT solve
your memory leaks.


> I want tomcat to deallocate and resize the heap so that the total memory
doesn't max out.

Tomcat cannot deallocate anything, since tomcat is also only a java program.
If you do have memory leaks, no java code can change anything. Solve your
leaks.


> And also I need the GC to run more aggressively.

There are some VM options that allow you to control the way, GC works. Read
its release notes.

BTW, which VM are you using? Upgrade to latest. It was said, that where were
StringBuffer memory leaks in at least one of the recent versions.


Regards,
  Steffen


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



RE: JK Connector versus mod_proxy

2004-03-30 Thread SH Solutions
Hi

The primary benefit is, that using mod_jk, the request is not pushed to a
proxy.
Having a proxy in between gives serveral problems:

- Authentication issues (as David mentioned)
- Logging issues
- Security issues

All the last two come from the point, that each and every request is done by
the same client [out of tomcats view], namely the apache server. Using
proxy, the apache-server itself acts as HTTP Client and connects to tomcat.

Using mod_jk, all request parameters are forwarded to tomcat, not using http
at all. Tomcat can therefor see the clients IP and other things, that get
hidden, if a proxy is in between.

However, remember to diable access to tomcats AJP-port from the internet,
since any attacker could also use the AJP protocol to give tomcat facked
information. He could do a lot of attacks, giving a faked ip address and
tomcat would log the wrong information.

Regards,
  Steffen


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



RE: JK2 and SHM

2004-03-29 Thread SH Solutions
Hi

> [shm]
> file=anonymous

Works, thank you.

> > This leaves only one problem open:
> > How to tell tomcat to use unix sockets to talk to mod_jk2 ?
> > I know how to set up mod_jk2 for this, but I don't know how to specify 
> > the socket in tomcat.
>
> Unix sockets like JNI is platform specific, IMO wasn't touched in 2.0.4.

Anyway, I didn't use JK2 before, and I cannot get it running.
Can you help me on this?

Regards,
  Steffen


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



RE: JK2 and SHM

2004-03-28 Thread SH Solutions
Hi

> It would be helpful if you provide at least the platform and apache
version running.

Sorry. I am using debian sarge and apache 2.0.48.

> Also if I understood you correctly, you've created the shm file? Why?

Because it was mentioned to do so on one of the very few really helpful
pages:
http://cymulacrum.net/writings/tomcat5/c831.html#JK2_BUILD_MOD_JK2

> The jk2 will create that file by itself. Doing that by yourself will
create the zero length file that cannot be attached to, and will probably
create the mentioned error.

Cool, I deleted my file and it works. Great!
Sorry, I didn't get this idea.

> Also, the preferred way of using shm is using 'anonymous' for shm file
name.
> Doing that will use the anonymous shared memory instead file based. The
file based is only for the platforms that lack the anon shm support.

Does this work on debian? What do I have to set in workers2.properties?
I would pefer not to specify it anyway.

This leaves only one problem open:
How to tell tomcat to use unix sockets to talk to mod_jk2 ?
I know how to set up mod_jk2 for this, but I don't know how to specify the
socket in tomcat.

Regards,
  Steffen


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



RE: Tomcat and JApplet / Applet

2004-03-28 Thread SH Solutions
Howdy,

> But then it is possible for third part to download and read the code in
the applet? or?
> How do I protect my applets?

No. You need to make your class files accessible only. You do not need
tomcat for this. You can use tomcat as well as apache, iis or any other web
server.

You do not need to place your source files anywhere on the server.

In fact, it is possible to decompile the class files, so you get very much
of the original source code. Howevery, you cannot prevent this. This is
always the case for any applet.

Regards,
  Steffen


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



coyote connector and unix sockets

2004-03-27 Thread SH Solutions
Hi

Right now, I have the folloing more or less working:

 

My problem is, how to tell the connector to use unix sockets instead of tcp
sockets?
I've read to set "port" to "0", but where to specify wich socket to use?

cu,
  Steffen


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



JK2 and SHM

2004-03-27 Thread SH Solutions
Hi

I get the following errors in apache2s log:

[error] shm.create(): error creating shm 70014 End of file found
[error] shm.create(): error creating shm /isp/apache2.shm

Can someone tell me what to do ?

The shm file mentioned in workers2.properties exists (created using touch)
and has 777 rights.

Regards,
  Steffen


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



JK2

2004-03-26 Thread SH Solutions
Hi

I really wanted to avoid asing the list for this again. Sorry, I couldn't
get it going. This was on the list soo often and I always read the posts and
I bookmarkes, every link I could find.
I am using apache2 and tomcat5 for some time now. Every works great.

Now I need to run multiple tomcats and I don't want to get more ips right
now. So I took a few days (yes, it took that long for me) and compiled
mod_jk2.

Now I am stuck with configuration.
The online documentation really isnt useful. Sorry. This differs from
tomcat. Anyway, I stored a lot of bookmarks in the last weeks about JK2 from
this list.

But there are a lot of questions open.
Some tutorials talk about default workers2.properties files. I dont know
where to find this. A lot of tutorials about jk2 give different syntax for
the configuration files. NO tutorial even states where the files must be
placed. Can anyone tell me, how tomcat should know where to find these
files? Or apache2?

So my questions are:
- Does someone have a [jk2-] beginners tutorial, that covers details?
- Can anyone with a working environment send me his configuraiton files for
apache, tomcat, workers, jk2? I will handle them secretly and you can remove
any real domainnames beforehand.

I would be very thankful.

Regards, 
  Steffen


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



RE: xcuse me...

2004-03-10 Thread SH Solutions
Hi

> Hi, I knowed this list from google when I did some google's dig for
setting tomcat in serving application from J2ME.

Are you sure about J2ME?
I've heard rumors, that on J2ME you have to use tomcat 3.x.

> If I have Tomcat installed, does it still necessary to install Apache (for
development purpose only).

Usually tomcat can run standalone.
But are you saying, you want to install apache [httpd] on a mobile phone?

J2ME [Mobile Edition] is for wireless/mobile systems.

I assume you need to switch to J2SE (which you should have used in the first
place) or J2EE and it will work.

cu
  Steffen


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



RE: Sessions

2004-03-10 Thread SH Solutions
Hi

> This means that the 2 browser windows are 2 separate sessions.

Right.

> My question is whether this is how tomcat implements sessions or whether
it is something I have done code-side to force a new session created. 

Neigther nor.
That's how browsers implement sessions (adhearing to the http standard).

cu
  Steffen


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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> I think I need to take baby steps.
> My goal right now is to be able to access my development machine from
another machine on the LAN.
> Right now I have to type the following to access my dev machine from
another LAN box:
> http://myMachineName:8080/myWebApp/logon.jsp

So far so good.

> I want to(baby steps) be able to access it by the following:
> Step 1: http://myMachineName/myWebApp/logon.jsp  (NO PORT)

This can only be done, if you change the connector of your tomcat.
Inside the LAN this should not be a problem - except for linux when you need
root rights to use port 80. See commons-daemon then.
You must see, that you cannot force browsers to use another port without
stating so.

> Step 2: http://myMachineName/logon.jsp(NO APP ROOT)

Thats the easy part. Use [in server.conf]

[or adjusted to your system]
If you have an otherwise default configuration, you *could* also move your
files to the default webapp ROOT, which is usually mapped to path "".

> Step 3: http://myMachineName/ (NO PAGE URL)

Thats also the easy part. If (and only if) Step 2 is complete, use [in
web.xml]

index.jsp


> Step 4: www.myNewDomain.com   

> I will have only one web site running on this machine and I(my company)
will be hosting it.
> How do I accomplish these steps? 

Thats again the complex part, see the other mail.

cu,
  Steffen


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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> OK what if I register the domain to point to our companies proxy server ip
address and then have the proxy server "URI forward" to
https://myMachine:8443/mySSLApp/logon.jsp ?

Not exactly, but similar.
Main precondition: Your proxy must be reachable from the outside world -
which is usually not the case.

Do you want to access the application from the web with http or https?

IF you need only http (from outside), your proxy should have no difficulcies
forwarding that traffic to your tomcat, which could then run http (no s
here) on port 8443.

IF you need https (from outside), it is NOT enough to forward a port, but
that proxy could then do the redirect to https://youraddress. Furthermore
that proxy would need to accept https connections [and will need your
certificate for this] and forward that query to your tomcat. For this
forwarding you could once again use http because that traffic would be
inside your company. You could also use https from your proxy to tomcat, but
that would make things more complicated since the proxy would need to act as
ssl client.

See, that you usually cannot forward https requests without decoding and
reencoding them first. [Some exceptions, if there are no other things
running on https in the same proxy]

cu
  Steffen


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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> Yes he can. If the hosting company for aa.com is kind enough to allow him
to "URI forward" his domain to http://myipaddress:8080 or 8443 (that is if
he has port 8443 visible from outside, which I think he said he does.),
he'll "almost" get what he wants.

Which would in fact be what I called to have an reverse proxy outside the
firewall.

cu
  Steffen


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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> So if I get port 80 opened up ...

Okay, we are going the right way...

> I can add the following entry to server.xml  name="www.myDomainName.com" debug="0" appBase="webapps/myWebApp"> ...

No.

[The following is taken from manual, not tested myself.]

"appBase" just gives the folder name for all webapps. You cannot specify a
very webapp here.
Just leave appBase at its default "webapps", additinally I define:
autoDeploy="false".

Then define


within your webapp define

/myWebApp/index.jsp


[I am not sure about the path inside the welcome-file clause, but I think it
should work] [I have not used such, because I am not using jsp, I am using
only servlets.]

Anyway, read the documentation. I agree, that it is hard to get into it, but
as you seem to have a tomcat for your own, simply try it, errors don't hurt.

cu
  Steffen


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



RE: Heap View vs Windows Task Manager

2004-03-09 Thread SH Solutions
Search the archive.

This topic has been discussed on the list at least twice this year in very
much detail.

cu
  Steffen


-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 09, 2004 5:46 PM
To: [EMAIL PROTECTED]
Subject: Heap View vs Windows Task Manager

I wonder if anyone on this list can once and for all make me understand the
difference between the Windows Task Manager process memory and the Heap View
in such a program like JProfiler.

My Windows Task Manager reports on first loading my application about 50MB.
As I wander around it grows until eventually at 158MB I get
OutOfMemoryException.

The intriguing thing to me is that in the Heap View of JProfiler which I
look at AT the same time as the WTM never reports anything over 15MB!! The
free heap size stays at 15MB and the used heap size always shows spikes
indicating garbage collection but it keeps under the 15MB. When it first
starts the free heap is 10MB and in this case the free heaps grows to
accomodate the required heap but 15MB seems to be the max it ever goes to. 

So why on earth does my WTM report onwards to 158MB and bail out?

Would so very much love a clear understanding of this and I see others
asking similar questions so I think it could be of use to the broader Tomcat
list

Thanks to he who undertake this question! ADC



---
QAS Ltd.
Developers of QuickAddress Software
http://www.qas.com";>www.qas.com
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---




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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> So if I add the following somewhere in my server.xml file the user that
types www.aa.com will be pointed to
http://myipaddress:8080/webapps/aa/index.jsp?

No.
As I have already said, there is NOTHING, you can to to archieve this.

The whole point is, that browsers assume any website running on port 80 as
long as not explicitly stated otherwise.
But you port 80 is blocked.

Your tomcat is BEHIND you firewall. As good as your configuration is and as
many settings you make, nothing of all this information will ever reach the
user's browser. Full stop. You can do NOTHING about that.

Furthermore,

>  ...
> 

appBase specifies, where to look for webapps for that specific host. It does
not set something like a default application.
See servlet mappings and welcome file settings for such things.

> If I point the appBase="webapps/bb" how do I then point it at a specific
jsp?

This is included in welcome file.

> I cant test yet because I am still developing on localhost(my server is
not live yet).

Research how you could
- put you server outside your firewall
- open port 80
- tell all clients to use  https://...:8433/
otherwise you will never go live.

Regards,
  Steffen


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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> Can I change the server.xml file to force http listening on 8443 instead
of 8080? Or will this cause a conflict with SSL listening on the same port?

No. 1 port 1 service.

> If a user types in www.myNewDomainName.com  is it port 80 that tomcat4
listens on or is it 8080?

No.
This has nothing to do with you tomcats configuration. This is the way the
web works.
How should a user's browser know that your tomcat is configured on port
8080?

There is definitly nothing you can do (apart of putting your tomcat or a
remote proxy outside of your filewall).
Sorry.

cu
  Steffen


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



RE: virtual host in tomcat 4?

2004-03-09 Thread SH Solutions
Hi

> when the user types in www.myNewDomainName.com ...

they try to reach you server on port 80 (!!) which is blocked.

If you mean: 
"when the user types in "https://www.myNewDomainName.com"; they are
redirected to https://myServerName:8443/mySSLApp/index.jsp  ?

This is possible. Simply have your jsp as welcome file. [and let you jsp do
the redirect]

cu,
  Steffen


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



RE: JSP whitespace removal

2004-03-03 Thread SH Solutions
Hi

> We want to achieve a 10-15% data reduction of the HTML being served by our
webserver (generated by JSP pages). This will have an impact on our
bandwidth charges from our ISP...

I cannot help you on this, but you should realise, that if you archive to
reduce you jsps output by  10%, this will affect you traffic only by about
2%.

We do have a server, which generated (according to access_log_*)
2.183.339.056 byte in 261.018 requests. But out provider counted about 9GB
of traffic. [Actually he is accounting on switch port level and therefor
including even ARP-requests, but anyway a lot of this traffic is based on
out tomcat server.]

cu
  Steffen


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



RE: Good practice for classloaders

2004-02-27 Thread SH Solutions
Hi

> What's "Utils" and "classpath"?

A utility class and a member String in my system. These work.

> Can't you just call super.findClass(className)?

No.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#findClass
(java.lang.String)
Finds the specified class. This method should be overridden by class loader
implementations that follow the delegation model for loading classes, and
will be invoked by the loadClass method after checking the parent class
loader for the requested class. The default implementation throws a
ClassNotFoundException. 

So which ClassLoader should I inherit from? java.lang.ClassLoader would
obviously not do it...


Thanks anyway,

Steffen




Just a guess:).

-Original Message-
From: SH Solutions [mailto:[EMAIL PROTECTED]
Sent: Friday, February 27, 2004 2:16 AM
To: [EMAIL PROTECTED]
Subject: Good practice for classloaders


Hi

I am writing an application in which I use classloaders to load different
groups of plugins.
Basically what I am doing is:

  protected Class findClass( String className )
throws ClassNotFoundException
  {
if ( className.startsWith( "com.companyname." ) )
  return getClass().getClassLoader().loadClass( className );
byte classData[] = getTypeFromBasePath( className );
if ( classData == null )
  throw new ClassNotFoundException();
return defineClass( className, classData, 0, classData.length );
  }

  private byte[] getTypeFromBasePath( String typeName )
  {
return Utils.readFile( classPath + typeName.replace( '.',
File.separatorChar ) + ".class" );
  }


Now, I have problems an obvious problem with jar-files. [I have already
posted this before.]
[Actually I do not understand this problem, since it worked well with
tomcat4.0.6, but thats another problem. Still any hints are wellcome...]

What I would like to do is get rid of the getTypeFromBasePath-method. I
would prefer to let the parent classloader do this part and only do the
defineClass myself.

What I am doing right now seems to be bad practice event to me. But what
would be good practice?
The once thing I want to archive is that I want to load these classes with
different classloaders to be able to reload them during the lifetime of my
application.

Can anyone give me any hint?

Thanks,
  Steffen


-
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]


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



RE: Help tomcat problem with memory

2004-02-27 Thread SH Solutions
So what's your problem?  

-Original Message-
From: software [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 27, 2004 5:36 PM
To: [EMAIL PROTECTED]
Subject: Help tomcat problem with memory
Importance: High

Hi i have installed apache 13.24 with 2 tomcats 4.0.3 with loadbalancer is
woring fine but the problem when  i'm using the ps -ef | grep java command
i've saw many java process  justa like these:
21430 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21431 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21443 root  15   0  139M 139M 49444 S 0.0 13.8   0:07 java
21444 root  20   0  139M 139M 49444 S 0.0 13.8   0:00 java
21445 root  20   0  139M 139M 49444 S 0.0 13.8   0:00 java
21446 root  15   0  139M 139M 49444 S 0.0 13.8   0:06 java
21454 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21457 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21458 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21460 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21462 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21464 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21466 root  15   0  139M 139M 49444 S 0.0 13.8   0:00 java
21468 root  16   0  139M 139M 49444 S 0.0 13.8   0:04 java
21469 root  15   0  139M 139M 49444 S 0.0 13.8   0:03 java

looking the internet, the solution is use the -Xmx , -Xms and use the 
className="org.apache.tomcat.service.PoolTcpConnector"   and i'm working 
with Ajp13

 


   

Thanks
Fabian



-
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]



Good practice for classloaders

2004-02-27 Thread SH Solutions
Hi

I am writing an application in which I use classloaders to load different
groups of plugins.
Basically what I am doing is:

  protected Class findClass( String className )
throws ClassNotFoundException
  {
if ( className.startsWith( "com.companyname." ) )
  return getClass().getClassLoader().loadClass( className );
byte classData[] = getTypeFromBasePath( className );
if ( classData == null )
  throw new ClassNotFoundException();
return defineClass( className, classData, 0, classData.length );
  }

  private byte[] getTypeFromBasePath( String typeName )
  {
return Utils.readFile( classPath + typeName.replace( '.',
File.separatorChar ) + ".class" );
  }


Now, I have problems an obvious problem with jar-files. [I have already
posted this before.]
[Actually I do not understand this problem, since it worked well with
tomcat4.0.6, but thats another problem. Still any hints are wellcome...]

What I would like to do is get rid of the getTypeFromBasePath-method. I
would prefer to let the parent classloader do this part and only do the
defineClass myself.

What I am doing right now seems to be bad practice event to me. But what
would be good practice?
The once thing I want to archive is that I want to load these classes with
different classloaders to be able to reload them during the lifetime of my
application.

Can anyone give me any hint?

Thanks,
  Steffen


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



RE: Classloader issues

2004-02-25 Thread SH Solutions
Hi

> Have you added the mail's jar file to your WEB-INF/lib or common/lib? If
not, then that's the problem. Tomcat 5 doesn't ship with the mail api.

I have tried adding mailapi.jar, activation.jar, smtp.jar, pop3.jar,
imap.jar to common/lib, WEB-INF/lib and shared/lib. None worked.

Any other hints?

cu
  Steffen


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



Classloader issues

2004-02-24 Thread SH Solutions
Hi

I experience problems using 5.0.18 that did not occur running 4.0.6, but I
do NOT want to revert to it.
Maybe you could help me:

Actually I have a system that uses classloaders for loading add-in groups.
The two most important functions are:

  protected Class findClass( String className )
throws ClassNotFoundException
  {
if ( className.startsWith( "com.companyname." ) )
  return getClass().getClassLoader().loadClass( className );
byte classData[] = getTypeFromBasePath( className );
if ( classData == null )
  throw new ClassNotFoundException();
return defineClass( className, classData, 0, classData.length );
  }

  
  private byte[] getTypeFromBasePath( String typeName )
  {
return Utils.readFile( classPath + typeName.replace( '.',
File.separatorChar ) + ".class" );
  }


This works that far. It worked completely in tomcat4.0.6.

Now, having switched to 5.0.18 something wired occued:
java.lang.ClassNotFound javax.mail.Address

we used to have mailapi.jar in common (including its dependencies) which
worked well.
Now with 5.0.18 these classes are not found anymore, but nothing was changed
inside the code.

Could you give me any hints?

Thanks,
  Steffen


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



AW: RTFM

2004-01-14 Thread SH Solutions
Hi

> Now I have your attention, will someone tell me 

??

> if it is possible to forward control (either by JSP or Servlet) from one
context to another, in the same browser window?

What about response.redirect( '/app2/' ) ??

> It is either so glaringly obvious that no one deems an answer worthwhile
(RTFM)

Yes

> or so really really difficult, and no one knows how do this. Surely not.

No.

> have found no doco on this

The problem is that you didn't search the right thing.


cu
  Steffen


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



AW: ServletInputStream comes up closed.

2004-01-11 Thread SH Solutions
Hi

> Never Mind. Solved the problem.

Please, always also show the solution, since the intention of this list is
to share solutions.
Someone else might trap into the same problem, others might simlpy learn
from mistakes.

Thanks,
  Steffen


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



AW: Static ints being cached

2004-01-08 Thread SH Solutions
Hi

> I cannot recompile the whole app everytime I change constant values.

This is the problem.

public final static ints are not referenced by the compiler but placed
inside the class files as constants as far as I know.
Therefor, the value is in every class file which uses those.

After all, this is NO issue of tomcat, this is an issue of the java
compiler.

cu
  Steffen


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



AW: what *really* happens when you reload or stop/start a webapp?

2004-01-02 Thread SH Solutions
Hi

> No, this is just an example.  What I'd like to know is if stop/start or
reload has the same effect on a webapp as actually shutting down tomcat and
starting it back up.

When you stop an webapp, its classloader is discarded. Therefor every
information held by you classes is discarded.
Whey you restart an webapp, a new classloader is instantiated for that
webapp and every class is loaded from scratch. Static vars and such are
all-new.

Problems occur, if you pass references of you classes to elements outside
you classloader (in example by using shared libraries).
In that case, the classes referenced from outside your webapp cannot be
discarded due to javas typesafe pointers.
This might result in the existence of the same static variable in two
classloaders. Remember that these are two distinct variables.
Even worse, if you manage to get the reference in the old classloader from
the shared library it won't be even the same type as it was before since
Classes loaded from different classloaders are type-different.

Hence avoid to even try to find a way to make information persistent to
webapp reloads without writing them somewhere outside the VM.

HTH

Steffen


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



AW: new JVM feature, just an idea

2003-12-12 Thread SH Solutions
Hi

If this is about Environment, you actually CAN extend it to 128K.
Classpaths greater than 128K are no good idea.
Classpaths containing the same jars twice aren't either.

If this is about Command line, you actually CAN get around this:
SET CLASSPATH=.
SET CLASSPATH=%CLASSPATH%;. 
SET CLASSPATH=%CLASSPATH%;.
SET CLASSPATH=%CLASSPATH%;.

Jut doing an duplicating test, I got up to >7500 chars on an windows 2003
server with NO tweaking.

cu
  Steffen


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



AW: How to logout

2003-12-10 Thread SH Solutions
Hi

> 

You are mixing Java and JavaScript here.
Since session.invalidate() might even exist in some browsers javascript,
response.sendError surely wont.
Send the logout request to your server and do the invalidate and sendError
there from your servlet. That should work.

cu
  Steffen


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



AW: [OFF-TOPIC] Tomcat web hosting

2003-12-09 Thread SH Solutions
Hi

If you are able to admin your own server, go here: www.ipx-server.de
They have servers starting at 19€ / month (700 MHz, 256 MB, 10 GB HDD, 50 GB
Traffic, NOT Virtual).
And higher end servers starting at 39€ / month (2 GHz, 512 MB, 40 GB HDD,
100 GB Traffic, NOT Virtual).

cu
  Steffen


-- 
SH Solutions, Steffen Heil
Web: http://www.sh-solutions.de
eMail: [EMAIL PROTECTED]
MSNMS: [EMAIL PROTECTED]
-Ursprüngliche Nachricht-
Von: Oscar Carrillo [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 9. Dezember 2003 01:14
An: Tomcat Users List
Betreff: Re: [OFF-TOPIC] Tomcat web hosting

http://www.servepath.com

On Mon, 8 Dec 2003, Pitre, Russell wrote:

> Hello All-
> 
>  
> 
> Sorry to bother you with another one of my questions..
> 
>  
> 
> Can anyone suggest a good and inexpensive web hosting service that 
> provides tomcat and mySQL support??
> 
>  
> 
>  
> 
> Russ
> 
> 


-
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]



AW: Giving access to an html file in tomcat

2003-12-08 Thread SH Solutions
AFAIK the page needs to be > 1024 byte. If they are smaller, IE replaces
them.

cu
  Steffen 


-- 
SH Solutions, Steffen Heil
Web: http://www.sh-solutions.de
eMail: [EMAIL PROTECTED]
MSNMS: [EMAIL PROTECTED]
-Ursprüngliche Nachricht-
Von: Bender, Christopher [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 8. Dezember 2003 21:40
An: Tomcat Users List
Betreff: Giving access to an html file in tomcat

Hey,

I have added the following to my web.xml of one of my web apps:


403
/error/error.htm



When I try and test this (go to a page I do not have access to that will
throw a 403 error),  i get the Internet Explorer error page that says "You
might not have permission to view this directory or page using the
credentials you supplied" and not my page (and not even a tomcat page).

Am I missing some configuration somewhere?

-
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]



AW: Ant install tasks

2003-12-08 Thread SH Solutions
Hi

First, I don't know anything about ant...

BUILD FAILED
file:C:/Documents%20and%20Settings/rich/My%20Documents/workbench/java/bu
ild.xml:368: java.net.UnknownHostException: C
 
> I'm nearly 100% the host is correct - it's simply localhost.

But it seams to read your c:/... as (host):, so it says: "I dont know
host 'C'!".
It isn't trying to connet to "localhost" but to "C".

Just my 5 cents,
  Steffen


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



AW: Database pool problem

2003-12-08 Thread SH Solutions
Seams a bit off-topic, but proposing databases, have a look at
firebirdsql.org.
Firebird ist very good, stable, wide-spread (in flavor of interbase), even
used in tanks.

Firebird has all features of a good database, including triggers, views,
stored procedures, referential integrity, and a lot more.
It is actually free even for commercial use!

Maybe PostgreSQL is as good as firebird (or even better), but MySQL doen't
even reach the power of firebird partly.

Just my 5 cent,
  Steffen


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



AW: Lock on database file not being released...

2003-12-07 Thread SH Solutions
Hi

> However, I have used this driver before in a standalone app and when you
close a connection, it certainly does release the lock on the database file.

This makes me think, you didn't use pooling in this standalone app. Therefor
check weather you close all your ResultSets and Statements. In standalone
apps where no pooling is involved, they are caught by the garbage collector,
but not in connection pooling.

Trapped into this myself.

cu
  Steffen


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



AW: newbie help please, localhost not found

2003-12-06 Thread SH Solutions
Hi

> have you installed Tomcat in a path containing spaces such as c:\Program
Files\Tomcat. If so, reinstall to a path without spaces.

I'm not sure for older versions, but at least Tomcat 5.0.16 installs to a
path with a lot of spaces by default so this shouldn't be an issue. (As it
isn't on my mashine.)

> I'm not behind a proxy as I am using my own PC at home.

Anyway, check you Internet Explorer Options for proxy settings. Depending
upon you internet access there could be a setup for your providers proxy -
which in turn will surely not be aware of your tomcat.

Cu
  Steffen


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



AW: Illegal Access Error [ URLConnection ]

2003-12-05 Thread SH Solutions
Yet Throwable is more generic as Exception. Try it. 


-- 
SH Solutions, Steffen Heil
Web: http://www.sh-solutions.de
eMail: [EMAIL PROTECTED]
MSNMS: [EMAIL PROTECTED]
-Ursprüngliche Nachricht-
Von: Stuart Stephen [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 5. Dezember 2003 12:39
An: Tomcat Users List
Betreff: RE: Illegal Access Error [ URLConnection ] 

I tried putting a try and catch block around it to catch a the generic
Exception. Yet that didn't work.

Something is still a-miss?

-Original Message-
From: SH Solutions [mailto:[EMAIL PROTECTED]
Sent: 05 December 2003 11:37
To: 'Tomcat Users List'
Subject: AW: Illegal Access Error [ URLConnection ]


Hi

> When I do URLConnection.guessContentTypeFromName(filename) I get an
IllegalAccessError thrown. Yet, I cannot catch this as the method only
throws an IOException.

I dont know where this comes from since I dont have any idea what this
method is all about.
But I can tell you how to catch the Exception.

try {
  ..
} catch ( IllegalAccessError iae ) {
}

As of you post I guess you thought that you couldn't catch a Exception that
is not declared to be thrown by the method in question. But this is only
half the truth. You can throw everything that inherits from Throwable.
Descendents of Exception are such classes, but there are more.

You can catch about everything if you use this;

} catch ( Throwable t ) {
  t.printStackTrace(); // not required but a good start.
...

Cu
  Steffen


-
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]


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



AW: Illegal Access Error [ URLConnection ]

2003-12-05 Thread SH Solutions
Hi

> When I do URLConnection.guessContentTypeFromName(filename) I get an
IllegalAccessError thrown. Yet, I cannot catch this as the method only
throws an IOException.

I dont know where this comes from since I dont have any idea what this
method is all about.
But I can tell you how to catch the Exception.

try {
  ..
} catch ( IllegalAccessError iae ) {
}

As of you post I guess you thought that you couldn't catch a Exception that
is not declared to be thrown by the method in question. But this is only
half the truth. You can throw everything that inherits from Throwable.
Descendents of Exception are such classes, but there are more.

You can catch about everything if you use this;

} catch ( Throwable t ) {
  t.printStackTrace(); // not required but a good start.
...

Cu
  Steffen


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



AW: Optimizeit remote profiler

2003-12-03 Thread SH Solutions
Hi

> Are you sure that it connects? How are you starting Tomcat?

I'm starting it just as told in the tutorial.
But I found the problem. I activated the Profiler API.
(It is not in the documentation that if the API is enabled then everything
else is invisible by default.)

Got it. Works very well now.

Thanks anyway,

Steffen


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



Optimizeit remote profiler

2003-12-03 Thread SH Solutions
Hi

Since I saw a lot of references on this list to Borlands Optimizeit, I just
got the trial and started testing. Everything fine, except that I cannot use
it.

I have Windows XP as client running the UI and I want to profile my tomcat
4.1.29 server on debian 3.1 sarge running on sun jvm 1.4.2.

The profiler attaches to the server and I do get very few information, but
the list of instances stays completely empty.

Anyone, any clue ?

Thanks
  Steffen


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



Memory Debugging

2003-12-03 Thread SH Solutions
Hi

Since I saw a lot of references on this list to Borlands Optimizeit, I just
got the trial and started testing. Everything fine, except that I cannot use
it.

I have Windows XP as client running the UI and I want to profile my tomcat
4.1.29 server on debian 3.1 sarge running on sun jvm 1.4.2.

The profiler attaches to the server and I do get very few information, but
the list of instances stays completely empty.

Anyone, any glue ?

Thanks,
  Steffen


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



load-on-startup and multiple coyotes

2003-12-02 Thread SH Solutions
Hi, once again,

after having just solved the welcome-servlet problem (posted separately) I
just run into another problem.
I have 5 distinct servlets while all inherit from a common base class whose
simple purpose is to initialize the applications database pool, read
different configuration files and preload some very important information
from the databse. The servlets base class also takes care of synchronization
and single database pool initialization.

This all works very well as long as I have no  set. It also
works well with no  but instead having only one coyote
connector assigned to the application.
This is were the problem comes in. I need to have 2 coyotes. One for http
and one for https.

As soon as I start using 2 coyote connectors together with 
tomcat initializes the database pools twice.
Interestingly it keeps initializing things twice even if I add a third
coyote.

Anyone any glue so far?
I even don't know where to look for this. Any hint would be welcome.

Thanks,

Steffen


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



AW: Servlet as Welcome File doesn't work

2003-12-02 Thread SH Solutions
Hi

I found an solution to force tomcat 4.1.29 to use servlets as welcome files.
My applications web.xml:


Root
com.osiris4.servlets.Root



Root
/root



root



The problem on this was that tomcat checks for the very existence of the
file "root", before actually invoking the servlet. The trick is to simply
have an empty file "root" in the applications docRoot directory.
If this is a problem for you, simply use another name for that file - e.g.
use the servlets name.

Thanks your answers anyway.

Steffen


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



Servlet as Welcome File doesn't work

2003-12-01 Thread SH Solutions
Hello.

I'm using tomcat 4.1.29 on debian and I have the following problem:
I need to get "/" handled by my Servlet "myPackage.Root", but I do not want
to change the mapping of ordinary files.
Just as a welcome file would, but welcome-file does not apply to servlets,
right?

My solutions so far is to map "/" to my servlet an map any other folder with
distinct context's, what surely is'nt what it was meant to be.

I did search the web and the usenet for a long time, since I assumed not to
be the first to run into this problem. But I didn't find anything.
Be aware that I did not enable the jsp-servlet, since I am not using jsps at
all.

If anyone can help me, I would appreciate it very much.

Thanks,

Steffen


PS: No native English speaker here - sorry.


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