[OT] Linux EC2 Java Gremlin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[OT] Linux EC2 Java Gremlin

Jerry Malcolm
Not directly a tomcat question... but since TC runs on java, maybe
someone here has some suggestions.  I am running a development/sandbox
server on AWS EC2, Linux 2.  Only I and one other person have access to
it.  Yesterday I was browsing through some pages on my site when all of
a sudden I started getting errors that all of my java classes were
compiled with a later version than the JVM.  I recognized the error from
past experiences.  My apps are built with Java 11, and TC is apparently
now running on Java 8.  I logged into the console, and yes, my EC2 had
somehow changed to default to Java8.  I changed it back, and everything
is fine.  Except for the 'what happened?' part of it. We were doing an
AMI snapshot around that time which may have rebooted the EC2.  But
neither of us were doing anything in the area of changing the default
jvm.  We are launching live in a couple of days.  So obviously
unexplained magic like this is a bit unnerving.

I know it's just speculation.  But I'm just curious if anybody has
experienced anything similar to this.  Any ideas why linux might decide
to automatically fall back to an older version of java?

Thx


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Linux EC2 Java Gremlin

Christopher Schultz-2
Jerry,

On 3/11/21 12:39, Jerry Malcolm wrote:

> Not directly a tomcat question... but since TC runs on java, maybe
> someone here has some suggestions.  I am running a development/sandbox
> server on AWS EC2, Linux 2.  Only I and one other person have access to
> it.  Yesterday I was browsing through some pages on my site when all of
> a sudden I started getting errors that all of my java classes were
> compiled with a later version than the JVM.  I recognized the error from
> past experiences.  My apps are built with Java 11, and TC is apparently
> now running on Java 8.  I logged into the console, and yes, my EC2 had
> somehow changed to default to Java8.  I changed it back, and everything
> is fine.  Except for the 'what happened?' part of it. We were doing an
> AMI snapshot around that time which may have rebooted the EC2.  But
> neither of us were doing anything in the area of changing the default
> jvm.  We are launching live in a couple of days.  So obviously
> unexplained magic like this is a bit unnerving.
>
> I know it's just speculation.  But I'm just curious if anybody has
> experienced anything similar to this.  Any ideas why linux might decide
> to automatically fall back to an older version of java?

I think AWS's CLI tools require Java 8, so it's possible you'll end up
with side-by-side installations of JVMs. The difference between success
and failure ends up being the value of $JAVA_HOME.

How are you launching Tomcat? If you ensure that the launch scripts for
Tomcat are always properly setting JAVA_HOME or are using a static path
for the JVM you shouldn't run into this problem.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]