• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Servlet - Eclipse - Apache Tomcat and MacOS 11.4

 
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just tried to run a Servlet Project within Eclipse which I've not run for about a month and in that period I have probably updated by MacOS and Eclipse to the latest releases.

When I try and run my project now I see a dialog message appear on screen I've never seen before I would vert much like some help as I need to be able to debug my application soon. The mesage I get is

http://localhost:8082/b5web/

Page load failed with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.


I'm using Java 11 and Apache Tomcat 9 but these have not changed for some time.

What could be causing this to happen.

If I create a .war file via ANT and deploy that to Tomcat I can run the application.

Not sure where to look.

Dave
 
Saloon Keeper
Posts: 13981
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically your OS is blocking the connection because it is not secure.

Either perform all requests over HTTPS (recommended), or change the ATS policy for your app (recommended for debugging on localhost only).
 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So it must have been my last OS update to MacOS 11.4 then.

Pardon my ignorance but how do I tell Eclipse that when I want to run/debug my servlet to use HTTPS (443) instead of HTTP (80)

also - and this is just plain curiosity - why does it work if I start Tomcat from the command line and then open Safari on port 80 to view my servlet .

Finally and this is also odd - if I revert to Eclipse Version: 2021-03 (4.19.0) I can get my servlet to run from the IDE again ?
 
Stephan van Hulst
Saloon Keeper
Posts: 13981
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Garratt wrote:Pardon my ignorance but how do I tell Eclipse that when I want to run/debug my servlet to use HTTPS (443) instead of HTTP (80)


I don't know. I don't use Eclipse because I personally think it's a terrible IDE. It shouldn't be hard to google this though.

why does it work if I start Tomcat from the command line and then open Safari on port 80 to view my applet.


I believe that the ATS policy is set on the client, not on the server. I'm just spitballing here, but I'm thinking that Eclipse runs a different browser than Safari, and its browser doesn't allow insecure local networking. Do you know what browser it runs when you start the application?

if I revert to Eclipse Version: 2021-03 (4.19.0) I can get my servlet to run from the IDE again ?


I don't know. Unless your current Eclipse version uses a different browser than the previous one, I doubt it. It's likely that you just have a different browser than before configured in Eclipse.
 
Saloon Keeper
Posts: 25620
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse is a great IDE. But the WTP JEE plugin is an abomination. Which is why I use Mongrel to run and debug Tomcat.

Eclipse doesn't come with a web browser as part of its JEE plugin kit. Probably there's at least one plugin that can run as a browser, but I've always managed to limp by on e Firefox. Or even Internet Exlporer.

Nor does Eclipse "run" servlets. That's the job of whatever webapp server you have installed. Eclipse simply launches the indicated webapp server as a remote debugging client just like it does any other Java app.

Eclipse provides the code editor, build functions and run/debug control. Everything else is run by the application, whether it's a stand-alone Java app or an application container such as Tomcat, JBoss/Wildfly or WebSphere.
 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've logged it with the Eclipse support team - see what they suggest.

In the mean time I have reverted to 2021 03 Eclipse

Dave
 
Tim Holloway
Saloon Keeper
Posts: 25620
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Expect disappointment.

As I said, Eclipse is not a webapp server. The error is coming from some other program.
 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But surely if I replace Eclipse 2021 06 with Eclipse 2021 03 and the problem stops - that must imply something to do with the newer Eclipse ?

I can replicate the problem on a second Mac as well.
 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just found this :-

webpage

Not entirely sure how it helps as my Servlet project uses the same JRE when I use either version of Eclipse.

Dave
 
Tim Holloway
Saloon Keeper
Posts: 25620
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, as I said, Eclipse does not run servlets. And you never said what webapp server you actually are runing to run the servlets, but it's entirely possible that there are differences in what the plugin that runs that webapp server are setting for options.

In fact, one of the reasons that I so thoroughly loathe the WTP plugin for Eclipse is that when it runs Tomcat, it isn't running Tomcat in its pure form, but rather copies selected parts of the user's deployment information into its Tomcat run. And some of the parts that it doesn't select are critical. The Mongrl plugin, on the other hand, takes runs Tomcat without internal meddling, so whatever deployment information I set into Tomcat is exactly what Tomcat/Mongrel uses, no more and no less.

Don't forget that about a year back a major rollback was done on one the the "advanced" SSL/TLS protocols, removing it from a lot of web products. What you may be seeing is a conflict between a client that wants to use the deleted protocol and a server that doesn't/isn't configured to support it.
 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per my first post I'm using Java 11 and Apache Tomcat 9 but these have not changed for some time.

I'll have a look and see if I can use your plugin.

Thanks

Dave
 
Tim Holloway
Saloon Keeper
Posts: 25620
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry. I'm DEFINITELY going blind. It's just that so many people do define their program design problems in terms of their IDE that certain blinders tend to kick in for me.

The current incarnation of the sysdeo/Mongrel plugin is available from the Eclipse Market (on your Help menu) as "Tomcat Plugin 9.1.4".  Just do a search for "sysdeo".

It's a simple plugin. It adds toolbar buttons to start/stop/restart Tomcat with a corresponding Tomcat menu. It routes the Tomcat log (normally catalina.out) to the Eclipse message console pane.

Other than that, it stays out of the way aside from running Tomcat in debug mode so that you can set breakpoints and do general debugging.

BECAUSE it's non-intrusive, however, you have to deploy your Tomcat webapp(s) yourself. You can either copy the WAR you built to the TOMCAT_HOME/webapps directory or you can add an XML Context file to TOMCAT_HOME/conf/Catalina/localhost/ with a codeBase attribute that points to the place in your Eclipse project where the WAR is built. That works very nicely for Maven-based projects.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is the final solution for this problem?
 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://bugs.eclipse.org/bugs/show_bug.cgi?id=574611

 
David Garratt
Ranch Hand
Posts: 301
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had to revert to the 2021 03 version of Eclipse until the bug has been fixed in the 2021 06 verson. See link in previous post.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic