Archive for the 'Tomcat' Category

January 24th, 2020
5:32 pm
Spring Boot no longer returns HTTP reason phrase in responses

Posted under Java & Spring & Spring Boot & Tomcat

I noticed this when a web service returned a blank reason phrase, which tripped up Angular due to an Angular issue which I have documented here.

It appears to be a Spring Boot Tomcat version change issue – a later Tomcat ignores the reason phrase and does not return it, as detailed here.

As reason phrases are being deprecated anyway, and I don’t use them, I have just ignored the issue, but it is worth being aware of it when debugging.

Comments Off on Spring Boot no longer returns HTTP reason phrase in responses

December 18th, 2009
8:10 pm
Tomcat as a service under Windows 7 64 Bit / 32 bit JVM

Posted under Tomcat
Tags , ,

See the Tomcat 6 Download Page

If you use the Windows service installer (self installing Exe) to install Tomcat 6.0.24 under Windows 7 64 bit, it insists on a 64 bit JVM. I am using a 32 bit JVM and if you try to use that, Tomcat will not start.

You can do this by using the 32 bit Windows zip version, which still allows you to run Tomcat as a service. It also allows you access to the Tomcat Configuration/Monitor utility which you can also run in the System Tray, but you have to set this up manually.

The following steps will do this install :-

1/ Download the 32 bit Zip installation above, and unzip to the desired target installation location.

2/ Edit <Tomcat Home>\conf\server.xml to change the default http port from 8080 if required

3/ Edit  <Tomcat Home>\conf\tomcat-users.xml to add an admin user if desired, by inserting the following in the <tomcat-users> section :-

<role rolename=”manager”/>
<role rolename=”admin”/>
<user name=”admin” password=”mypassword” roles=”manager,admin”/>

4/ Issue the command Service install from an administrator privileged command window pointing at the <Tomcat Home>\bin directory.

5/ Create the following shortcuts to run the Tomcat Configuration Utility and the System Tray Monitor Utility.
Substitute your device and directory for <Tomcat Home>.

Configuration Utility – Target “<Tomcat Home>\bin\tomcat6w.exe”  //ES//Tomcat6
System Tray Monitor – Target:  “<Tomcat Home>\bin\tomcat6w.exe”  //MS//Tomcat6
(Both Cases) – Start In: may be left blank
(Both cases) – Tick the Run as Administrator check box under either the Shortcut or compatibility tab.

6/ Note that you will have to OK running as administrator each time you run one of the shortcuts, assuming you have User Account Control turned on in Windows 7. This is also true if you try to run the tray monitor automatically in the startup group. Windows 7 insists that each time you log in, you have to OK the administrator usage(!) This is supposed to happen by adding such autostarted tray applications to a “blocked startup” group which have a tray icon to display and then selectively “OK” them to unblock them/OK the administrator usage. This never worked for me – anything I placed in the startup folder which needed administrator access just plain did not run at all, and I never saw this “blocked” icon. As it would mean OKing at each login anyway, it seemed to me that there is no point trying to autostart tray icons that need administrator access as it was more hassle to unblock them (even if it did work) rather than just run them as needed from the super bar or quick launch bar (and of course OK them).

No Comments »

December 18th, 2009
12:30 pm
Tomcat with JPA Persistence jar signing issue

Posted under Tomcat
Tags , , ,

I hit this when deploying  an Eclipselink 1.1 web application to Tomcat 6.0.24, when trying to place all the persistence jars in <Tomcat Home>\lib

The app worked fine when including its own copy of the jars under WEB-INF\lib, but moving them to <Tomcat Home>\lib gave the following error :-

java.lang.SecurityException: class “javax.persistence.Persistence”‘s signer information does not match signer information of other classes in the same package

I checked all the other (non eclipselink) libraries present and could not see a clash. This post appears to shed some light, indicating that it is perhaps a mismatch of jar signing in the Eclipsink libraries.
However, it is strange that it works fine with the libraries deployed with the application rather than under Tomcat.

As Tomcat does not provide its own JPA support, I decided I was quite happy to deploy the libraries with the web app as that works fine, and to leave the issue unresolved.

No Comments »