Re: Installation on Win 10 failure.

2024-04-23 Thread DdC
Thanks for the advice!Did two runs: regular cmd and one with admin 
privileges::The cmd window looks good:
C:\tomcat8\bin>startupUsing CATALINA_BASE:   "C:\tomcat8"Using CATALINA_HOME:   
"C:\tomcat8"Using CATALINA_TMPDIR: "C:\tomcat8\temp"Using JRE_HOME:        
"C:\Program Files\Java\jdk-18.0.2.1"Using CLASSPATH:       
"C:\tomcat8\bin\bootstrap.jar;C:\tomcat8\bin\tomcat-juli.jar"Using 
CATALINA_OPTS:   ""
The catalina log has good stuff and then:
23-Apr-2024 11:29:24.152 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache 
Tomcat Native library [1.3.0] using APR version [1.7.4].23-Apr-2024 
11:29:24.153 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: 
IPv6 [true], sendfile [true], accept filters [false], random [true], UDS 
[true].23-Apr-2024 11:29:24.153 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL 
configuration: useAprConnector [false], useOpenSSL [true]23-Apr-2024 
11:29:24.194 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL 
successfully initialized [OpenSSL 3.0.13 30 Jan 2024]23-Apr-2024 11:29:24.967 
INFO [main] org.apache.coyote.AbstractProtocol.init Initializing 
ProtocolHandler ["http-nio-8080"]23-Apr-2024 11:29:25.000 SEVERE [main] 
org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to 
initialize component [Connector["http-nio-8080"]] 
org.apache.catalina.LifecycleException: Protocol handler initialization failed 
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1012) at 
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127) at 
org.apache.catalina.core.StandardService.initInternal(StandardService.java:578) 
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127) at 
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1068) 
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127) at 
org.apache.catalina.startup.Catalina.load(Catalina.java:686) at 
org.apache.catalina.startup.Catalina.load(Catalina.java:709) at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
 at java.base/java.lang.reflect.Method.invoke(Method.java:577) at 
org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302) at 
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472) Caused by: 
java.net.BindException: Address already in use: bind at 
java.base/sun.nio.ch.Net.bind0(Native Method) at 
java.base/sun.nio.ch.Net.bind(Net.java:555) at 
java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
 at 
java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
 at 
org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:268) 
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:223) at 
org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1359)
 at 
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1372) at 
org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:654) at 
org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:75)
 at org.apache.catalina.connector.Connector.initInternal(Connector.java:1010) 
... 11 more
So now what?At 2am I wondered whether I should use a cmd with admin 
privileges.Hence subsequently No difference, as far as I can tell:
23-Apr-2024 11:46:07.657 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Command line argument: 
-Dcatalina.home=C:\tomcat823-Apr-2024 11:46:07.658 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Command line argument: 
-Djava.io.tmpdir=C:\tomcat8\temp23-Apr-2024 11:46:07.941 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache 
Tomcat Native library [1.3.0] using APR version [1.7.4].23-Apr-2024 
11:46:07.942 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: 
IPv6 [true], sendfile [true], accept filters [false], random [true], UDS 
[true].23-Apr-2024 11:46:07.943 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL 
configuration: useAprConnector [false], useOpenSSL [true]23-Apr-2024 
11:46:07.955 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL 
successfully initialized [OpenSSL 3.0.13 30 Jan 2024]23-Apr-2024 11:46:08.505 
INFO [main] org.apache.coyote.AbstractProtocol.init Initializing 
ProtocolHandler ["http-nio-8080"]23-Apr-2024 11:46:08.534 SEVERE [main] 
org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to 
initialize component [Connector["http-nio-8080"]] 
org.apache.catalina.LifecycleException: Protocol handler initialization failed 
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1012)---
I still suspect that win10 is messing things up; but what?
dennis de champeaux


Re: AW: FileUpload class not working with Tomcat 10.1

2024-04-23 Thread Mark Foley
I'm back with a related issue.

I was able to get the java class jakarta.servlet.annotation.MultipartConfig
working back last November by adding the  definition shown in the
included message below to my WEB-INF/web.xml file. 

Now I need to add another program to the system that does file uploads. I
created another  definition in WEB-INF/web.xml following the original:


   uploadfile
 /1099R-Etrans.jsp
 
   /tmp
   20848820
   418018841
   1048576
 


   uploadfile
   /1099R-Etrans.jsp


That didn't work so well.  Now, any and all programs using the fileupload
function launches this 2nd program 1099R-Etrans.jsp.  It appears that this
second  definition replaces the first. Of course, I need to have the
ability for more than one program in the system able to do file uploads.

How can I configure multiple JSP programs to all have file uploading enabled and
launched by the correspoding requesting program?

Thanks --Mark

On Thu Nov 16 14:36:21 2023 Christopher Schultz  
wrote:
> Mark,
>
> Apologies for not replying earlier; looks like you have made good 
> progress. See below.
>
> On 11/14/23 12:19, Mark Foley wrote:
> > Anyway, enough griping! I have gotten it partially working thanks to your
> > suggested link, and particulary you suggestion to put the servlet info in
> > web.xml.  I've put the following in WEB-INF/web.xml:
> > 
> > 
> >uploadfile
> >  /schDistImportResults.jsp
> >  
> >/tmp
> >20848820
> >418018841
> >1048576
> >  
> > 
> > 
> >uploadfile
> >/schDistImportResults.jsp
> > 
> > 
> > I've only changed the  and  tags above. The others 
> > are
> > as monkey-typed from your link example. I'll research the other parameters
> > later.
> > 
> > My jsp code is now:
> > 
> > <%@ page import="javax.servlet.annotation.MultipartConfig.*" %>
>
> Nope, not for Tomcat 10. You need to use the jakarta package names. 
> Besides, you don't need the MultipartConfig in your code, anyway.
>
> You need /either/ an annotation (dicey in JSP code) /or/ an XML config, 
> so the XML should be sufficient. (But you should switch to a proper 
> servlet. DO IT! :)
>
> > if((contentType != null) && contentType.startsWith("multipart/form-data;"))
> > {
> >  InputStream inp = null;
> >  DataInputStream ins = null;
> > 
> >  Part fileUpload = request.getPart("taxResults");
> > 
> >  if(fileUpload != null)
> >  {
> >  inp = fileUpload.getInputStream();
> >  ins = new DataInputStream(inp);
> >  }
> >   
> > while ((inp != null) && (ins.available() != 0))
> > {
> >  String  transaction = ins.readLine();
> >  out.println("" + transaction);
> > }
> > 
> > ins.close();
> > inp.close();
>
> I would use try-with-resources like this:
>
> try (InputStream in = , DataInputStream ins = ...) {
> }
>
> Since you have no try/catch, your code can leak file handles and stuff 
> like that. Yuck. With try-with-resources, you don't even need the calls 
> to InputStream.close.
>
> > This actually worked I will experiment with it more and may be back with
> > more questions (e.g. do I really need the web.xml? Could I not do:
> > "inp = fileUpload.getInputStream(mypath);"). But ... maybe later.
> > 
> > Vielen Dank!!! --Mark
>
> Na klar
>
> -chris
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Installation on Win 10 failure.

2024-04-23 Thread Christopher Schultz

Hello,

A few things.

1. Are you really coming from Tomcat 4.04?

2. Are you really using Java 18? It's basically dead. Use Java 17 or 21, 
which are both Long Term Support (LTS) versions, especially if you are 
only going to upgrade once every 20 years.


3. You should not have CLASSPATH set.

4. What is j2ee.jar and why have you included it anywhere?

See below...

On 4/23/24 15:04, DdC wrote:

Thanks for the advice!Did two runs: regular cmd and one with admin 
privileges::The cmd window looks good:
C:\tomcat8\bin>startupUsing CATALINA_BASE:   "C:\tomcat8"Using CATALINA_HOME:   "C:\tomcat8"Using CATALINA_TMPDIR: 
"C:\tomcat8\temp"Using JRE_HOME:        "C:\Program Files\Java\jdk-18.0.2.1"Using CLASSPATH:       
"C:\tomcat8\bin\bootstrap.jar;C:\tomcat8\bin\tomcat-juli.jar"Using CATALINA_OPTS:   ""
The catalina log has good stuff and then:
23-Apr-2024 11:29:24.152 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 
Loaded Apache Tomcat Native library [1.3.0] using APR version [1.7.4].23-Apr-2024 11:29:24.153 INFO 
[main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], 
sendfile [true], accept filters [false], random [true], UDS [true].23-Apr-2024 11:29:24.153 INFO 
[main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: 
useAprConnector [false], useOpenSSL [true]23-Apr-2024 11:29:24.194 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized 
[OpenSSL 3.0.13 30 Jan 2024]23-Apr-2024 11:29:24.967 INFO [main] 
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler 
["http-nio-8080"]23-Apr-2024 11:29:25.000 SEVERE [main] 
org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component 
[Connector["http-nio-8080"]] org.apache.catalina.LifecycleException: Protocol handler 
initialization failed at org.apache.catalina.connector.Connector.initInternal(Connector.java:1012) 
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127) at 
org.apache.catalina.core.StandardService.initInternal(StandardService.java:578) at 
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127) at 
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1068) at 
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127) at 
org.apache.catalina.startup.Catalina.load(Catalina.java:686) at 
org.apache.catalina.startup.Catalina.load(Catalina.java:709) at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
 at java.base/java.lang.reflect.Method.invoke(Method.java:577) at 
org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302) at 
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472) Caused by: java.net.BindException: 
Address already in use: bind



What a mess. Here's the error, just above: "address already in use" 
which means "this port is already owned by another process".


Is Tomcat already running?

-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: AW: FileUpload class not working with Tomcat 10.1

2024-04-23 Thread Christopher Schultz

Mark,

On 4/23/24 13:42, Mark Foley wrote:

I'm back with a related issue.

I was able to get the java class jakarta.servlet.annotation.MultipartConfig
working back last November by adding the  definition shown in the
included message below to my WEB-INF/web.xml file.

Now I need to add another program to the system that does file uploads. I
created another  definition in WEB-INF/web.xml following the original:


uploadfile
  /1099R-Etrans.jsp
  
/tmp
20848820
418018841
1048576
  


uploadfile
/1099R-Etrans.jsp


That didn't work so well.  Now, any and all programs using the fileupload
function launches this 2nd program 1099R-Etrans.jsp.  It appears that this
second  definition replaces the first. Of course, I need to have the
ability for more than one program in the system able to do file uploads.

How can I configure multiple JSP programs to all have file uploading enabled and
launched by the correspoding requesting program?


Can you post both  definitions and the s for 
each of them?


It's still yucky to use a JSP to do this IMHO.

-chris


On Thu Nov 16 14:36:21 2023 Christopher Schultz  
wrote:

Mark,

Apologies for not replying earlier; looks like you have made good
progress. See below.

On 11/14/23 12:19, Mark Foley wrote:

Anyway, enough griping! I have gotten it partially working thanks to your
suggested link, and particulary you suggestion to put the servlet info in
web.xml.  I've put the following in WEB-INF/web.xml:


uploadfile
  /schDistImportResults.jsp
  
/tmp
20848820
418018841
1048576
  


uploadfile
/schDistImportResults.jsp


I've only changed the  and  tags above. The others are
as monkey-typed from your link example. I'll research the other parameters
later.

My jsp code is now:

<%@ page import="javax.servlet.annotation.MultipartConfig.*" %>


Nope, not for Tomcat 10. You need to use the jakarta package names.
Besides, you don't need the MultipartConfig in your code, anyway.

You need /either/ an annotation (dicey in JSP code) /or/ an XML config,
so the XML should be sufficient. (But you should switch to a proper
servlet. DO IT! :)


if((contentType != null) && contentType.startsWith("multipart/form-data;"))
{
  InputStream inp = null;
  DataInputStream ins = null;

  Part fileUpload = request.getPart("taxResults");

  if(fileUpload != null)
  {
  inp = fileUpload.getInputStream();
  ins = new DataInputStream(inp);
  }
   
while ((inp != null) && (ins.available() != 0))

{
  String  transaction = ins.readLine();
  out.println("" + transaction);
}

ins.close();
inp.close();


I would use try-with-resources like this:

try (InputStream in = , DataInputStream ins = ...) {
}

Since you have no try/catch, your code can leak file handles and stuff
like that. Yuck. With try-with-resources, you don't even need the calls
to InputStream.close.


This actually worked I will experiment with it more and may be back with
more questions (e.g. do I really need the web.xml? Could I not do:
"inp = fileUpload.getInputStream(mypath);"). But ... maybe later.

Vielen Dank!!! --Mark


Na klar

-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat closes connections on unexpected status codes

2024-04-23 Thread Adwait Kumar Singh
Any chance someone took a look at the PR? Do you guys think this is a
viable solution?

On Sun, Apr 21, 2024 at 12:54 PM Adwait Kumar Singh 
wrote:

> https://github.com/apache/tomcat/pull/723 is a draft PR of the idea I was
> talking about earlier, i.e close the connection on a bad request but
> otherwise allow it to be configurable by the user.
>
> Currently you need to subclass Http11Processor and override
> statusDropsConnections, but this is just to get early feedback. If people
> are aligned with this approach, I can polish the PR (add tests, make the
> status code list actually configurable etc etc)
>
> On Fri, Apr 19, 2024 at 5:51 AM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> Harri,
>>
>> On 4/19/24 08:10, Harri Pesonen wrote:
>> > I have developed a restful web service, which uses HTTP response codes
>> 200 OK, 201 Created, 204 No Content and 404 Not Found.
>> > It does not use 400 Bad Request or 500 Internal Server Error normally.
>> > 400 Bad Request is more common than 500 Internal Server Error, which
>> should basically never happen.
>>
>> I disagree. There aren't many good 5xx errors, so sometimes "500 Oops"
>> is the best you can do. HTTP 5xx doesn't even really allow you to
>> differentiate between "server error" and "application error".
>>
>> > 400 Bad Request is the best response in many cases, if client gives
>> some query parameter which is not supported by the application logic.
>>
>> -1
>>
>> 400 means that the HTTP request is bad. In your situation, the HTTP
>> request is 100% valid. It's your application that is saying "sorry,
>> client, you did something we don't allow". This is an application-level
>> error, not a protocol-level error. To me, 400 means "HTTP protocol
>> error" and should never be substituted for "application protocol error".
>>
>> > I think that it would be better not to close connection in this case,
>> if the error comes from application.
>> > I wonder if there is option for application to define that connection
>> should be closed or not after the response has been sent?
>> > Or is the option only from the client.
>> >
>> > For me this 404 Not Found is also a small problem, as it is error, but
>> it can happen quite often.
>> > HTTP errors are not nice in logs.
>> > Normally if you try to fetch some restful resource, which does not
>> exist, then it returns 404 Not Found.
>> > GET /service/resource/id => 404 Not Found
>> > If I now had an option to rewrite the service, I would probably use 204
>> No Content in this case as well, to avoid errors.
>>
>> 404 and 204 are fundamentally different responses. 404 means "this
>> resource does not exist" and 204 means "this resource DOES EXIST but it
>> doesn't contain anything". Your application may not differentiate
>> between those two cases, but as a client I would be confused if "Not
>> Found" was replaced by "Found to be empty" in all cases.
>>
>> > 204 No Content is normally used with PUT and DELETE requests.
>>
>> Yes, you can use those. 200 would also make sense and, of course 201 for
>> new resources.
>>
>> -chris
>>
>> > -Original Message-
>> > From: Christopher Schultz 
>> > Sent: perjantai 19. huhtikuuta 2024 14.27
>> > To: users@tomcat.apache.org
>> > Subject: Re: Tomcat closes connections on unexpected status codes
>> >
>> > Mark,
>> >
>> > On 4/18/24 11:38, Mark Thomas wrote:
>> >> On 18/04/2024 15:16, Adwait Kumar Singh wrote:
>> >>> I think we should *always* close connections in cases where it can
>> >>> lead to request smuggling vulnerabilities like when there is an error
>> >>> during header or request line parsing, but allowing the user to
>> >>> control connection close when the status is being set by the user,
>> >>> should be safe?
>> >>
>> >> I'm not (yet) convinced distinguishing between those scenarios is
>> >> always going to be possible.
>> >>
>> >>> It allows users to send back responses like InvalidInputException
>> >>> with a
>> >>> 400 status without being forced to close the connection.
>> >>
>> >> I appreciate why a 400 is used here but 400 has always struck me as
>> >> more for protocol level issues rather than application level issues.
>> >
>> > Didn't someone tell me recently that, technically, ANY client-error is
>> allowed to trigger a 400 response without being more specific?
>> >
>> >> That is the fundamental problem here. The status codes are being used
>> >> for two completely different purposes.
>> >
>> > +1
>> >
>> > I've always found it distasteful when REST services do this. To me, 400
>> means "the request was actually malformed". If you need authentication,
>> that's a 401. If you aren't allowed, that's 403. If you didn't provide a
>> required header, that's a 412, etc. I've usually found the "correct"
>> > response code to use for every situation and I've never written an
>> application that returns a 400 response directly.
>> >
>> > -chris
>> >
>> >>> On Thu, Apr 18, 2024 at 6:41 AM Rémy Maucherat 
>> wrote:
>> >>>
>>  On Thu, Apr 

Re: Regarding Tomcat url redirection

2024-04-23 Thread Christopher Schultz

Lavanya,

On 4/22/24 05:21, lavanya tech wrote:

Could you please explain, what you exactly mean ? So here redirect is not a
solution right ?


Redirecting is fine.

Perhaps you should take a step back and decide: what do you actually 
want, here? You might be trying to solve problem X by applying solution 
Y, and you've already decided that solution Y is correct so you are 
trying to get help with that.


Perhaps ask for help with Problem X?

For example, "I don't want users to have to type the name of my 
application to reach it so I want example.com/ to go to my application 
instead of example.com/myapp/".


Or, "I have multiple domains and I want all of them to redirect to the 
canonical domain example.com and to go to me web application /myapp so 
everything goes to example.com/myapp/".



"You'd have to use a glob/regex if
you wanted to check for [anything and maybe nothing.]example.com."


There is nothing in your configuration or question that suggests that 
the hostname in the request is relevant, but you are making it a 
*requirement* that the request contains a specific Host header. IF you 
don't actually need that, why do you have it?


-chris


On Fri, Apr 19, 2024 at 3:03 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Ammu,

On 4/19/24 08:32, lavanya tech wrote:

Thank you very much. I removed  for example.com as well as adding

an

 in server.xml
I copied context.xml file
/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
Removed < in rewrite.config files.

But still I dont redirect the URL.


If you have  in server.xml and also your application in the
webapps/ directory, then you will be double-deploying your application.

Re-name /git/app/apache-tomcat-10.1.11/webapps/towl/ to be
/git/app/apache-tomcat-10.1.11/webapps/ROOT (the capitals are important)
and remove the  element from your server.xml.

Then start your server and read the logs.


*nslookup alias.example.com 
gives-->Non-authoritative answer:Name: www.example.com
Address:  192.168.200.10Aliases:

alias.example.com

*


Just to give some information here, *www.example.com
* has alias* "alias.example.com
"*
But https://www.example.com:/example --> works fine with out issues

but

the alias doesnot works (https://alias.example.com)
So i am not sure if the redirect url helps or if its correct


Your rewrite configuration says that you have to be using host
"example.com" but your request goes to www.example.com. Your
configuration should only redirect a request such as:

$ curl -v http://example.com:/something

HTTP/1.1 301 Moved Permanently
...
Location: https://www.example.com:/example

If you make a request like:

$ curl -v http://www.example.com:/something

I wouldn't expect a redirect because of your "host" condition. The
"%{HTTP_HOST} example.com" looks at the entire Host header and not just
anything that ends in "example.com". You'd have to use a glob/regex if
you wanted to check for [anything and maybe nothing.]example.com.

You'd also have to make sure that your application is serving responses
to requests to / which is why I'm recommending you use the ROOT web
application name instead of "towl".

-chris


On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Ammu,

On 4/18/24 09:34, lavanya tech wrote:

I am attaching server.xml and context.xml and rewrite.config files.
The paths are

/git/app/apache-tomcat-10.1.11/webapps/towl/context.xml

   
className="org.apache.catalina.valves.rewrite.RewriteValve"

/>

   



This file ^^^ is in the wrong place. It should be in
/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml


/git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config

https://www.example.com:/example [R=301,L]


Why do you have < symbols at the beginning of these lines?


server.xml


   > [...]


 
 


It's best not to define any  in server.xml. I would remove this
 entirely and allow Tomcat to auto-reploy from your
webapps/towl directory. If you need this application to be deployed as
the ROOT context (on / and not /towl) then you should re-name
/git/app/apache-tomcat-10.1.11/webapps/towl to
/git/app/apache-tomcat-10.1.11/webapps/ROOT

You also don't need a  for example.com as well as adding an
 for the same domain (though this is probably to anonymize the
configuration). You can feel free to simply use the "localhost" 
as the default  and deploy everything into it. This makes your
configuration changes relative to a stock Tomcat less significant and
easier to apply to new versions if/when necessary.

-chris


On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Ammu,

On 4/18/24 07:45, lavanya tech wrote:

I added classname rewrite valeus in contex.xml file .




Re: FileUpload class not working with Tomcat 10.1

2024-04-23 Thread Chuck Caldarale
>>> 
>>>   uploadfile



>>> 
>>> 
>>>   uploadfile
>>>   /schDistImportResults.jsp
>>> 



The first servlet is named “uploadfile”.


> On Apr 23, 2024, at 12:42, Mark Foley  wrote:
> 
> Now I need to add another program to the system that does file uploads. I
> created another  definition in WEB-INF/web.xml following the original:
> 
> 
>   uploadfile



> 
> 
>   uploadfile
>   /1099R-Etrans.jsp
> 



This second servlet is also named “uploadfile”.


> That didn't work so well.  Now, any and all programs using the fileupload
> function launches this 2nd program 1099R-Etrans.jsp.  It appears that this
> second  definition replaces the first.



You gave them the same names, so the second one wins...

What magic were you expecting to differentiate between the two?

  - Chuck


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: [EXT]Re: [EXT]Re: [EXT]Re: Tomcat 10 skipping state transfer. No members active in cluster group

2024-04-23 Thread Rick Noel
Your suggestion worked Chuck, Thank you!

I now see this in cat log..
23-Apr-2024 08:30:10.969 INFO [Catalina-utility-1] 
org.apache.catalina.ha.tcp.SimpleTcpCluster.memberAdded Replication member 
added:[org.apache.catalina.tribes.membership.MemberImpl[tcp://{192, 168, 47, 
157}:4001,{192, 168, 47, 157},4001, alive=304632, securePort=-1, UDP Port=-1, 
id={-32 -57 -12 119 64 42 67 56 -69 51 -113 -64 -68 -78 -99 74 }, payload={}, 
command={}, domain={}]]


INFO: Starting clustering manager at [##0001]
Apr 23, 2024 8:30:46 AM org.apache.catalina.ha.session.DeltaManager 
getAllClusterSessions
INFO: Manager [##0001], requesting session state from 
[org.apache.catalina.tribes.membership.MemberImpl[tcp://{192, 168, 47, 
157}:4001,{192, 168, 47, 157},4001, alive=340143, securePort=-1, UDP Port=-1, 
id={-32 -57 -12 119 64 42 67 56 -69 51 -113 -64 -68 -78 -99 74 }, payload={}, 
command={}, domain={}]]. This operation will timeout if no session state has 
been received within [60] seconds.
23-Apr-2024 08:30:46.492 INFO 
[MessageDispatchInterceptor.MessageDispatchThread[station-Channel]1] 
org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report 
ThroughputInterceptor Report[
Tx Msg:1 messages
Sent:0.00 MiB (total)
Sent:0.00 MiB (application)
Time:0.00 seconds
Tx Speed:0.15 MiB/s (total)
Tx Speed:0.15 MiB/s (application)
Error Msg:0
Rx Msg:10 messages
Rx Speed:0.00 MiB/s (since 1st msg)
Received:0.01 MiB]

Apr 23, 2024 8:30:46 AM org.apache.catalina.ha.session.DeltaManager 
waitForSendAllSessions
INFO: Manager [##0001]; session state sent at [4/23/24, 8:30 AM] received in 
[104] ms.


But  could you now explain why I get these new warnings

3-Apr-2024 08:30:22.970 WARNING [Tribes-Task-Receiver[station-Channel]-1] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]
23-Apr-2024 08:30:22.972 WARNING [Tribes-Task-Receiver[station-Channel]-2] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]
23-Apr-2024 08:30:32.978 WARNING [Tribes-Task-Receiver[station-Channel]-4] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]
23-Apr-2024 08:30:32.980 WARNING [Tribes-Task-Receiver[station-Channel]-3] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]
23-Apr-2024 08:30:42.988 WARNING [Tribes-Task-Receiver[station-Channel]-5] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]
23-Apr-2024 08:30:42.990 WARNING [Tribes-Task-Receiver[station-Channel]-6] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]
Apr 23, 2024 8:30:46 AM org.apache.catalina.util.SessionIdGeneratorBase 
createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using 
[SHA1PRNG] took [32,646] milliseconds.






Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Chuck Caldarale 
Sent: Monday, April 22, 2024 10:08 PM
To: Tomcat Users List 
Subject: [EXT]Re: [EXT]Re: [EXT]Re: Tomcat 10 skipping state transfer. No 
members active in cluster group


> On Apr 22, 2024, at 18:48, Rick Noel  wrote:
>
> So you mean we use the VM's  IP as the address value below
> Instead or using the value of   auto  ?
>
> address="auto"
>port="4001"
>   autoBind="100"
>   selectorTimeout="5000"
>   maxThreads="6"/>


Correct. To quote from the Tomcat doc:

The IP broadcasted is java.net.InetAddress.getLocalHost().getHostAddress() 
(make sure you don't broadcast 127.0.0.1, this is a common error)

Unless the two JVMs are deployed on the same VM, you cannot use 127.0.0.1 and 
expect them to be able to communicate with each other.

Here's an old e-mail describing the issue and one way of addressing it:

https://marc.info/?l=tomcat-user=118764351104059=2

The gist of it is this:

1. check what name the command `hostname` spits out 2. make sure that 
/etc/hosts contains that hostname and IP address

This must be done on each VM, of course.

Returning localhost is typical for systems that use DHCP to obtain their IP 
addresses, such as my MacBook:

jshell> java.net.InetAddress.getLocalHost().getHostAddress();
$1 ==> "127.0.0.1"

  - Chuck

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you know the sender and you are sure the 
content is safe. Please report the message using the Report Message feature in 
your email client if you believe the email is suspicious.


-
To unsubscribe, e-mail: 

Re: Installation on Win 10 failure.

2024-04-23 Thread Mark Thomas




On 23/04/2024 03:31, DdC wrote:


I have installed tomcat originally with version 4.04 on winxp andlater on win7, 
ubuntu, and another linux box - many times by now.Trouble now with win10 and 
version 9.0.88.Yes, there is a jdk, CLASSPATH is set, j2ee.jar is in 
lib.Running in a cmd window with bin startup triggers another cmd windowto 
popup, shows errors flashing by and the 2nd window disappers.


Rather than running "startup.bat" use "catalina.bat run" which will keep 
the process in the same window and you'll be able to read any error message.


Alternatively, you could look in the logs directory. It is usually 
easiest if you empty the logs directory, attempt to start Tomcat and 
then check the log files for errors.


Mark




 Running subsequently shutdown gives: Tomcat may not be running.Thanks a lot ...
Each next window version made installation more difficult - or i gotolder :-)
Is win10 creating trouble? Or ?
Thanks for help ...

--
Home page:      rs6.risingnet.net/~ddccMarketing site:  www . OntoOO.comKindle 
books:   Side Effects: Impacts on the 21st 
Century::https://www.amazon.com/-/es/Dennis-Champeaux-ebook/dp/B09MHJ5W48   
Even if not 
true::https://www.amazon.com/-/es/Dennis-Champeaux-ebook/dp/B09Y4WR9J7   9/11:: 
They had the Sun in their 
Eyeshttps://www.amazon.com/11-They-had-their-Eyes-ebook/dp/B0CMQ2WSK9https://www.amazon.nl/dp/B0CMQ2WSK9





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: [EXT]Re: [EXT]Re: [EXT]Re: Tomcat 10 skipping state transfer. No members active in cluster group

2024-04-23 Thread Rick Noel
Chuck, to get rid of the warnings...

3-Apr-2024 08:30:22.970 WARNING [Tribes-Task-Receiver[station-Channel]-1] 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived Context 
manager doesn't exist:[##0001]

I moved my  Manager element form the server.xml to the context.xml

 

That got rid of those warnings
But Now cat log shows these new warnings

23-Apr-2024 09:19:16.288 WARNING [Tribes-Task-Receiver[station-Channel]-5] 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions overload 
existing session [729421EC1DD658816E953C9A0DE4267A]

Do I need to configure something different?  Some how allow more 
deserializeSessions?




23-Apr-2024 09:19:16.243 INFO [main] 
org.apache.catalina.ha.session.DeltaManager.startInternal Starting clustering 
manager at [##0001]
23-Apr-2024 09:19:16.246 INFO [main] 
org.apache.catalina.ha.session.DeltaManager.getAllClusterSessions Manager 
[##0001], requesting session state from 
[org.apache.catalina.tribes.membership.MemberImpl[tcp://{192, 168, 47, 
157}:4001,{192, 168, 47, 157},4001, alive=3249463, securePort=-1, UDP Port=-1, 
id={-32 -57 -12 119 64 42 67 56 -69 51 -113 -64 -68 -78 -99 74 }, payload={}, 
command={}, domain={}]]. This operation will timeout if no session state has 
been received within [60] seconds.
23-Apr-2024 09:19:16.250 INFO 
[MessageDispatchInterceptor.MessageDispatchThread[station-Channel]1] 
org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report 
ThroughputInterceptor Report[
Tx Msg:1 messages
Sent:0.00 MiB (total)
Sent:0.00 MiB (application)
Time:0.00 seconds
Tx Speed:0.15 MiB/s (total)
Tx Speed:0.15 MiB/s (application)
Error Msg:0
Rx Msg:10 messages
Rx Speed:0.00 MiB/s (since 1st msg)
Received:0.01 MiB]

23-Apr-2024 09:19:16.288 WARNING [Tribes-Task-Receiver[station-Channel]-5] 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions overload 
existing session [729421EC1DD658816E953C9A0DE4267A]
23-Apr-2024 09:19:16.289 WARNING [Tribes-Task-Receiver[station-Channel]-5] 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions overload 
existing session [A2196B2A82F1D0873769053130EA3E7A]
23-Apr-2024 09:19:16.290 WARNING [Tribes-Task-Receiver[station-Channel]-5] 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions overload 
existing session [EDC2F576615781AD8CC138E8D8029EB9]
23-Apr-2024 09:19:16.296 WARNING [Tribes-Task-Receiver[station-Channel]-5] 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions overload 
existing session [12A38E4D987184560911DC3C43A50410]
23-Apr-2024 09:19:16.354 INFO [main] 
org.apache.catalina.ha.session.DeltaManager.waitForSendAllSessions Manager 
[##0001]; session state sent at [4/23/24, 9:19 AM] received in [104] ms.

Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Rick Noel
Sent: Tuesday, April 23, 2024 8:56 AM
To: Tomcat Users List 
Cc: Voodoo nmulcahy gmail ; Rob Kowald 

Subject: RE: [EXT]Re: [EXT]Re: [EXT]Re: Tomcat 10 skipping state transfer. No 
members active in cluster group

Your suggestion worked Chuck, Thank you!

I now see this in cat log..
23-Apr-2024 08:30:10.969 INFO [Catalina-utility-1] 
org.apache.catalina.ha.tcp.SimpleTcpCluster.memberAdded Replication member 
added:[org.apache.catalina.tribes.membership.MemberImpl[tcp://{192, 168, 47, 
157}:4001,{192, 168, 47, 157},4001, alive=304632, securePort=-1, UDP Port=-1, 
id={-32 -57 -12 119 64 42 67 56 -69 51 -113 -64 -68 -78 -99 74 }, payload={}, 
command={}, domain={}]]


INFO: Starting clustering manager at [##0001] Apr 23, 2024 8:30:46 AM 
org.apache.catalina.ha.session.DeltaManager getAllClusterSessions
INFO: Manager [##0001], requesting session state from 
[org.apache.catalina.tribes.membership.MemberImpl[tcp://{192, 168, 47, 
157}:4001,{192, 168, 47, 157},4001, alive=340143, securePort=-1, UDP Port=-1, 
id={-32 -57 -12 119 64 42 67 56 -69 51 -113 -64 -68 -78 -99 74 }, payload={}, 
command={}, domain={}]]. This operation will timeout if no session state has 
been received within [60] seconds.
23-Apr-2024 08:30:46.492 INFO 
[MessageDispatchInterceptor.MessageDispatchThread[station-Channel]1] 
org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report 
ThroughputInterceptor Report[
Tx Msg:1 messages
Sent:0.00 MiB (total)
Sent:0.00 MiB (application)
Time:0.00 seconds
Tx Speed:0.15 MiB/s (total)
Tx Speed:0.15 MiB/s (application)
Error Msg:0
Rx Msg:10 messages
Rx Speed:0.00 MiB/s (since 1st msg)
Received:0.01 MiB]

Apr 23, 2024 8:30:46 AM org.apache.catalina.ha.session.DeltaManager 
waitForSendAllSessions
INFO: Manager [##0001]; session state sent at [4/23/24, 8:30 AM] received in 
[104] ms.


But  could you now explain why I get these new warnings

3-Apr-2024 08:30:22.970 WARNING [Tribes-Task-Receiver[station-Channel]-1]