Re: Webapp Getting redirected to an external IP Address

2024-06-03 Thread Mark Thomas

On 04/06/2024 05:07, Tom Robinson wrote:

Hi,

We are running a tomcat7 application


You do realise that support for Tomcat 7 ended on 31 March 2021 don't you?


on our LAN which gets redirected from
a private, internal IP Address to an external ip address at which point it
fails. I can't find where this is happening.


Is it an actual redirect - i.e. a 30x response? Or do you mean something 
else?


If a redirect, does it redirect on the first request?


Where and what can I check for this redirect and how to control it or
switch it off all together.


Tomcat doesn't do this by default.

Tomcat 7 doesn't have the redirect valve so it won't be that.

Are you sure that the redirect is being issued by Tomcat? Might there be 
a reverse proxy in mix somewhere?


Other than that, it would have to be in the application code somewhere.



I browse to here on our LAN:

https://myinternalhost.mydomain.com.au:8443


Check what myinternalhost.mydomain.com.au resolves to in terms of an IP 
address.


Try requesting a page that won't trigger a directory redirect. Something 
like:


https://myinternalhost.mydomain.com.au:8443/index.html

You may need to adjust that for your application.

Mark



I end up here:

https://a.b.c.d:8443/kb

Where a.b.c.d is our external, ISP provided IP Address.

Why is this happening and how can I fix it?

*Kind regards,*

*Tom Robinson*
*IT Manager/System Administrator*



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



Webapp Getting redirected to an external IP Address

2024-06-03 Thread Tom Robinson
Hi,

We are running a tomcat7 application on our LAN which gets redirected from
a private, internal IP Address to an external ip address at which point it
fails. I can't find where this is happening.

Where and what can I check for this redirect and how to control it or
switch it off all together.

I browse to here on our LAN:

https://myinternalhost.mydomain.com.au:8443

I end up here:

https://a.b.c.d:8443/kb

Where a.b.c.d is our external, ISP provided IP Address.

Why is this happening and how can I fix it?

*Kind regards,*

*Tom Robinson*
*IT Manager/System Administrator*

-- 
*MoTeC Pty Ltd*

121 Merrindale Drive
Croydon South 3136
Victoria Australia
*T: *61 3 9761 5050
*W: *www.motec.com.au 


-- 
  
 
 



-- 
 

-- 


Disclaimer Notice: This message, including any attachments, contains 
confidential information intended for a specific individual and purpose and 
is protected by law. If you are not the intended recipient you should 
delete this message. Any disclosure, copying, or distribution of this 
message or the taking of any action based on it is strictly prohibited.


Re: Tomcat 9 memory leak message

2024-06-03 Thread Ying Jin
Terence, thanks for your reply! best, Jenny
On Sun, Jun 2, 2024 at 3:11 AM Terence M. Bandoian 
wrote:

> A long time ago (Tomcat 7), I would see a Tomcat memory leak detection
> error on shutdown if the JDBC driver was located in WEB-INF/lib but not
> if it was in the Tomcat lib directory. Explicitly de-registering the
> driver with a ServletContextListener on shutdown eliminated the error.
> I'm not sure if that's still necessary or if it applies in your case.
>
> -Terence Bandoian
>
> On 6/2/2024 1:56 AM, Christopher Schultz wrote:
> > Jenny,
> >
> > (Apologies for top-posting)
> >
> > “Safely ignored” can mean many things. You are only in danger of running
> out of heap space. So if you aren’t worried about that, feel free to ignore
> the error message.
> >
> > If it were my system, I would want to ensure a clean unload of the
> driver when the application shuts down.
> >
> > But I don’t think it will harm anything besides your memory usage.
> >
> > -chris
> >
> >> On Jun 1, 2024, at 00:18, Ying Jin  wrote:
> >>
> >> Chris,
> >>
> >> Thanks for your reply!
> >>
> >> We already removed the ojdbc8.jar file from the application's
> Web-inf/lib
> >> folder as suggested in the following post, however, we still got the
> >> warning messages below after the application is deployed to the Tomcat 9
> >> server.
> >>
> >>
> https://stackoverflow.com/questions/6981564/why-must-the-jdbc-driver-be-put-in-tomcat-home-lib-folder
> >>
> >> WARNING: The web application [Our Web Application Name] appears to have
> >> started a thread named [InterruptTimer] but has failed to stop it. This
> is
> >> very likely to create a memory leak. Stack trace of thread:
> >>
> >> WARNING: The web application [Our Web Application Name] appears to have
> >> started a thread named [oracle.jdbc.diagnostics.Diagnostic.CLOCK] but
> has
> >> failed to stop it. This is very likely to create a memory leak. Stack
> trace
> >> of thread:
> >>
> >> I also read some posts saying these warning messages can be safely
> ignored
> >> if the Tomcat version is greater than 7.0. I'm not sure if this is
> correct
> >> or not.
> >>
> >> Please advise,
> >>
> >> Many thanks!
> >> Jenny
> >>
> >>> On Fri, May 31, 2024 at 3:50 PM Christopher Schultz <
> >>> ch...@christopherschultz.net> wrote:
> >>>
> >>> Jenny,
> >>>
>  On 5/31/24 14:52, Ying Jin wrote:
>  We removed the ojdbc8 driver jar from web-inf/lib from the web
>  application and kept the ojdbc8 jar file in the Tomcat/lib folder, but
>  we still can see the following memory link warning message whenever we
>  redeploy the web application. We use the Tomcat 9 server in the Linux
>  environment.
> >>> This list strips attachments. Can you re-post with text-only?
> >>>
>  The other warning message is about the "validateFile Problem with jar
>  file /tomcat/lib/jolokia.jar. My question is if we can safely ignore
>  these warning messages or not.
> 
>  It would be great if you can shed some light on this issue.
> >>> If the message is something like "driver cannot be unloaded" then check
> >>> Tomcat with a debugger or even something like JVisualVM to see how many
> >>> WebappClassLoaders you have in memory.
> >>>
> >>> If the driver causes the web application ClassLoader to be "pinned" in
> >>> memory, then it will never be removed and all those classes will
> >>> continue to use-up heap space until you restart the JVM. This gets
> worse
> >>> every time you reload your application without restarting the JVM. The
> >>> Manager application web UI can help you diagnose these a little.
> >>>
> >>> The validation problem with the Jolokia JAR file will depend upon
> >>> exactly what it says. I would first get a replacement copy of the
> >>> Jolokia JAR file before bothering to try to diagnose it any further.
> >>>
> >>> -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: Tomcat 9 memory leak message

2024-06-03 Thread Ying Jin
Chris,

Thanks for your suggestion!

Another question I would like to confirm with you is if we have to remove
the ojdbc jar file from our web application’s web-inf/lib folder or not.

The reason of our concern is that we need to use the same code base to
create a jar file and deploy it to stone branch which needs to have the
ojdbc jar file included in the application.

Therefore, we prefer to include the ojdbc jar file in the application to
avoid confusion, however, we’re not sure if this will cause any issues for
the web application’s deployment or not on tomcat server.

Thanks again for your help!
Jenny

On Sun, Jun 2, 2024 at 1:57 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Jenny,
>
> (Apologies for top-posting)
>
> “Safely ignored” can mean many things. You are only in danger of running
> out of heap space. So if you aren’t worried about that, feel free to ignore
> the error message.
>
> If it were my system, I would want to ensure a clean unload of the driver
> when the application shuts down.
>
> But I don’t think it will harm anything besides your memory usage.
>
> -chris
>
> > On Jun 1, 2024, at 00:18, Ying Jin  wrote:
> >
> > Chris,
> >
> > Thanks for your reply!
> >
> > We already removed the ojdbc8.jar file from the application's Web-inf/lib
> > folder as suggested in the following post, however, we still got the
> > warning messages below after the application is deployed to the Tomcat 9
> > server.
> >
> >
> https://stackoverflow.com/questions/6981564/why-must-the-jdbc-driver-be-put-in-tomcat-home-lib-folder
> >
> > WARNING: The web application [Our Web Application Name] appears to have
> > started a thread named [InterruptTimer] but has failed to stop it. This
> is
> > very likely to create a memory leak. Stack trace of thread:
> >
> > WARNING: The web application [Our Web Application Name] appears to have
> > started a thread named [oracle.jdbc.diagnostics.Diagnostic.CLOCK] but has
> > failed to stop it. This is very likely to create a memory leak. Stack
> trace
> > of thread:
> >
> > I also read some posts saying these warning messages can be safely
> ignored
> > if the Tomcat version is greater than 7.0. I'm not sure if this is
> correct
> > or not.
> >
> > Please advise,
> >
> > Many thanks!
> > Jenny
> >
> >> On Fri, May 31, 2024 at 3:50 PM Christopher Schultz <
> >> ch...@christopherschultz.net> wrote:
> >>
> >> Jenny,
> >>
> >>> On 5/31/24 14:52, Ying Jin wrote:
> >>> We removed the ojdbc8 driver jar from web-inf/lib from the web
> >>> application and kept the ojdbc8 jar file in the Tomcat/lib folder, but
> >>> we still can see the following memory link warning message whenever we
> >>> redeploy the web application. We use the Tomcat 9 server in the Linux
> >>> environment.
> >>
> >> This list strips attachments. Can you re-post with text-only?
> >>
> >>> The other warning message is about the "validateFile Problem with jar
> >>> file /tomcat/lib/jolokia.jar. My question is if we can safely ignore
> >>> these warning messages or not.
> >>>
> >>> It would be great if you can shed some light on this issue.
> >>
> >> If the message is something like "driver cannot be unloaded" then check
> >> Tomcat with a debugger or even something like JVisualVM to see how many
> >> WebappClassLoaders you have in memory.
> >>
> >> If the driver causes the web application ClassLoader to be "pinned" in
> >> memory, then it will never be removed and all those classes will
> >> continue to use-up heap space until you restart the JVM. This gets worse
> >> every time you reload your application without restarting the JVM. The
> >> Manager application web UI can help you diagnose these a little.
> >>
> >> The validation problem with the Jolokia JAR file will depend upon
> >> exactly what it says. I would first get a replacement copy of the
> >> Jolokia JAR file before bothering to try to diagnose it any further.
> >>
> >> -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: Cannot invoke "org.apache.tomcat.util.net.SSLHostConfig.getProtocols()" because "this.sslHostConfig" is null

2024-06-03 Thread Adam Danischewski
Thanks for the quick response, I had hostname matching been banging my head
on this for a while.

I just fixed it - something is up with using a default constructor for
SSLHostConfigCertificate  (orig was new  SSLHostConfigCertificate ())  and
possibly with setting the keystore directly from the bundle (complained
about padding) .

I changed the above to:

SSLHostConfigCertificate sslHostCert = new SSLHostConfigCertificate(shc,
SSLHostConfigCertificate.Type.RSA);

// KeyStore ks = ssb.getKeyStore();

// sslHostCert.setCertificateKeystore(ssb.getKeyStore());

sslHostCert.setCertificateKeystoreFile("file:src/main/resources/RBup.p12");

sslHostCert.setCertificateKeystorePassword("Whatever321");

sslHostCert.setCertificateKeyAlias("RBup");


and voila! Thanks anyway


On Mon, Jun 3, 2024 at 5:29 AM Mark Thomas  wrote:

> On 03/06/2024 09:16, Adam Danischewski wrote:
>
> > Not sure why I'm getting:
> >
> > Caused by: java.lang.NullPointerException: Cannot invoke
> > "org.apache.tomcat.util.net.SSLHostConfig.getProtocols()" because
> > "this.sslHostConfig" is null
>
> You haven't configured a default SSLHostConfig.
>
> Either use "_default_" for the host name of the SSLHostConfig you have
> defined or call setDefaultSSLHostConfigName("localhost") on the endpoint.
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

-- 

Adam Michael Danischewski

Software Engineer

Phone: (929) 308-9674

Email: adam.danischew...@gmail.com

Github: http://github.com/AdamDanischewski


Re: Cannot invoke "org.apache.tomcat.util.net.SSLHostConfig.getProtocols()" because "this.sslHostConfig" is null

2024-06-03 Thread Mark Thomas

On 03/06/2024 09:16, Adam Danischewski wrote:


Not sure why I'm getting:

Caused by: java.lang.NullPointerException: Cannot invoke
"org.apache.tomcat.util.net.SSLHostConfig.getProtocols()" because
"this.sslHostConfig" is null


You haven't configured a default SSLHostConfig.

Either use "_default_" for the host name of the SSLHostConfig you have 
defined or call setDefaultSSLHostConfigName("localhost") on the endpoint.


Mark

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



Cannot invoke "org.apache.tomcat.util.net.SSLHostConfig.getProtocols()" because "this.sslHostConfig" is null

2024-06-03 Thread Adam Danischewski
Using Embedded Tomcat 10 in SpringBoot, trying to manually configure a new
HTTPS/SSL port. I've got the following SSL bundle set in my application
properties (fairly sure this part is working fine):

spring.ssl.bundle.jks.rbupbundle.key.alias=RBup

spring.ssl.bundle.jks.rbupbundle.keystore.location=classpath:RBup.p12

spring.ssl.bundle.jks.rbupbundle.keystore.password=Whatever321

spring.ssl.bundle.jks.rbupbundle.keystore.type=PKCS12


Inside the Tomcat bean, I configure the webserver:

public TomcatServletWebServerFactory tomcatFactory(SslBundles sslBundles) {

return new TomcatServletWebServerFactory() {


@Override

protected TomcatWebServer
getTomcatWebServer(org.apache.catalina.startup.Tomcat tomcat) {

int port = Integer.parseInt(userPrefs.getWebServerPort());

tomcat.enableNaming();

Connector connector = new Connector(
"org.apache.coyote.http11.Http11NioProtocol");

Http11NioProtocol prot = (Http11NioProtocol) connector.getProtocolHandler();

connector.setPort(9000);

connector.setSecure(true);

connector.setScheme("https");

connector.setProperty("SSLEnabled", "true");

SslBundle sslBundle = sslBundles.getBundle("rbupbundle");

SslBundleKey sbk = sslBundle.getKey();

SslStoreBundle ssb = sslBundle.getStores();

SSLHostConfig shc = new SSLHostConfig();

SSLHostConfigCertificate sslHostCert = new SSLHostConfigCertificate();

sslHostCert.setCertificateKeystore(ssb.getKeyStore());

shc.addCertificate(sslHostCert);

shc.setHostName("localhost");

prot.addSslHostConfig(shc);

tomcat.getService().addConnector(connector);

return super.getTomcatWebServer(tomcat);

}

Not sure why I'm getting:

Caused by: java.lang.NullPointerException: Cannot invoke
"org.apache.tomcat.util.net.SSLHostConfig.getProtocols()" because
"this.sslHostConfig" is null

at org.apache.tomcat.util.net.SSLUtilBase.(SSLUtilBase.java:92)

at org.apache.tomcat.util.net.jsse.JSSEUtil.(JSSEUtil.java:61)

at org.apache.tomcat.util.net.jsse.JSSEUtil.(JSSEUtil.java:56)

at
org.apache.tomcat.util.net.jsse.JSSEImplementation.getSSLUtil(JSSEImplementation.java:52)

at
org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:95)

at
org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:70)

at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:207)

at
org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1271)

at
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1284)

at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:622)

at
org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:77)

at org.apache.catalina.connector.Connector.initInternal(Connector.java:1013)

... 21 more


Note: I am new to Tomcat and most of these concepts, also side note if
anyone could chime in to why setCertificateFile

disappeared from SSLHostConfig in the Tomcat API from 9 to 10, it didn't
look like it was deprecated and many

examples use it.

-- 

Adam Michael Danischewski

Software Engineer

Phone: (929) 308-9674

Email: adam.danischew...@gmail.com

Github: http://github.com/AdamDanischewski