LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-19-2003, 03:53 PM   #1
complus
Member
 
Registered: Aug 2003
Distribution: Red Hat 9
Posts: 76

Rep: Reputation: 15
Problem with Native Java Virtual Machine


Hi everyone. I have a HUGE problem, that I can't seem to get passed, and someone suggested that my problem might be with my RH Linux. I really need some help on this - newbie at a complete loss.

My app was running Apache & Tomcat, on a RH 7.3 box. We had a brownout yesterday, and now I cannot start Tomcat as any other user except for root. I have tried reinstalling tomcat & reinstalling my JDK... but nothing seems to be working. The java errors I am getting are:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start(Native Method)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.<init>(ThreadP
ool.java:582)
at org.apache.tomcat.util.threads.ThreadPool.openThreads(ThreadPool.java:46
0)
at
org.apache.tomcat.util.threads.ThreadPool.start(ThreadPool.java:179)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint
.java:300)
at
org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:161)
at org.apache.coyote.tomcat4.CoyoteConnector.start(CoyoteConnector.java:118
0)
at
org.apache.catalina.core.StandardService.start(StandardService.java:506)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at
org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at
org.apache.catalina.startup.Catalina.process(Catalina.java:180)
... 5 more

Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start(Native Method)
at java.lang.Shutdown.runHooks(Shutdown.java:126)
at java.lang.Shutdown.sequence(Shutdown.java:165)
at java.lang.Shutdown.exit(Shutdown.java:210)
at java.lang.Runtime.exit(Runtime.java:90)
at java.lang.System.exit(System.java:715)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:208)

It was suggested that the problem is with the Java Virutal Machine and that I should change OS's. Obviously this is not an option - I need to get this working on my box.

So my question is - can I troubleshoot or reinstall the Java Virtual Machine? If so, does anyone have any clue about how to do this? I find it hard to believe that I am going to have to rebuild/restore my entire box (again) for this...
 
Old 09-20-2003, 12:48 PM   #2
complus
Member
 
Registered: Aug 2003
Distribution: Red Hat 9
Posts: 76

Original Poster
Rep: Reputation: 15
Does anyone have any suggestions for this? There has to be something I can do to fix this. As I mentioned I can only start Tomcat under root - and that is not secure...

Any help is really appreciated
 
Old 09-20-2003, 02:24 PM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,785
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
If you re-installed the JDK, that should have given you a fresh copy of the JVM......unless there were two copies of Java installed. Run which java or java -version. If those don't jibe with where (and what version) of the JDK you installed, then you'll have to point to the new JDK. Also, can you run any other Java dependant software?
 
Old 09-20-2003, 04:31 PM   #4
complus
Member
 
Registered: Aug 2003
Distribution: Red Hat 9
Posts: 76

Original Poster
Rep: Reputation: 15
everything looks fine when I run which java and java-version... There should only be that one java installation on my machine.

I can run java programs directly under any user. Its just starting Tomcat that I can only do as root. I thought it was a Tomcat problem, but I reinstalled that - and according to the Tomcat user groups the problem is not with Tomcat...

I am at a complete loss, and I am desperately trying to avoid having to reinstall Linux, and restore my entire machine... I find it hard to believe that there is no solution for this...
 
Old 09-20-2003, 05:39 PM   #5
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,785
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Dang. I was hoping that it would be something easy. To me this looks like a permissions issue. If Java works fine with everything except Tomcat, there can't be anything wrong with the JVM.

OK, here is a weird thought. When you re-installed the JDK, was it the same version as you had previously? My personal experience is that 1.4.2 is a little flaky and if you do a search on Java here, you'll see that loads of people have a problem finding a Java that is compatible with their machine. Usually, it seems to boil down to what version of gcc was used to compile Java.

If you did change Java versions, I'd go back to the old one. As an alternative, you could get Blackdown Java and try that. For many people, this works when an equivalent version of Sun Java doesn't. As far as I can tell, Blackdown isn't changing anything except how they compile Java, so compatibility doesn't seem to be an issue.
 
Old 09-22-2003, 07:58 AM   #6
complus
Member
 
Registered: Aug 2003
Distribution: Red Hat 9
Posts: 76

Original Poster
Rep: Reputation: 15
Yes, I reinstalled the same version of the JDK. Should I try changing to a difference version, perhaps an earlier one?

What makes this whole scenario strange is that everything was working absolutely fine - then all of a sudden this happens. When I try to start Tomcat as a non-root user I get the java errors, Tomcat starts - but the threads only stay alive for approximatey 30 seconds, then Tomcat shuts down.

 
Old 09-22-2003, 08:07 AM   #7
nephilim
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248

Rep: Reputation: 30
Hmmm, an OutOfMemoryError usually indicates that something is going seriously wrong, like instantiating a LOT of objects on the heap stack or something like that.

Maybe you should check what processes are launched when you start Tomcat with the ps command.

Or you could assign more memory to Tomcat by playing with the -xmx and -xms options of the java command. Type java -X to read more about these commands.
 
Old 09-22-2003, 09:03 AM   #8
complus
Member
 
Registered: Aug 2003
Distribution: Red Hat 9
Posts: 76

Original Poster
Rep: Reputation: 15
On starting Tomcat the only processes that are started are the java threads....

root 748 1 27 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 749 748 0 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 750 749 1 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 751 749 0 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 752 749 0 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 753 749 0 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 754 749 0 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 755 749 10 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e
root 756 749 0 10:01 pts/0 00:00:00 /usr/java/j2sdk1.4.2_01/bin/java -Xms64m -Xmx512m -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-4.1.27/common/e

I have also set JAVA_OPTS="-Xms64m -Xmx512m" in my Tomcat startup script (catalina.sh). But that didn't change anything.

Also, why would it be a memory problem for a normal user, but not a memory problem for root.

Thanks for your help.
 
Old 09-22-2003, 12:42 PM   #9
complus
Member
 
Registered: Aug 2003
Distribution: Red Hat 9
Posts: 76

Original Poster
Rep: Reputation: 15
Well the problem has been solved (at least I think, and hopefully its permanent). The problem turned out to be that when I was following the "Securing and Optimizing RH Linux" guide, I made some settings in my /etc/security/limits.conf. The settings I made allowed:

max memory size (kbytes, -m) 5000
max user processes (-u) 20

Apparently this was not even enough for Tomcat to run. As someone on the Tomcat list suggested I changed this to allow:

max memory size (kbytes, -m) unlimited
max user processes (-u) 256

And now I can start Tomcat as a non-root user no problem. I am not sure why the original settings worked fine until a few days ago, and that will require some research. But in the meantime this appears to have solved the problem.

Thanks everyone for their help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Virtual Machine nodnarb Linux - Software 1 07-19-2004 04:41 PM
Java Virtual Machine gilch Linux - Newbie 8 10-23-2003 01:38 AM
Java Virtual Machine!!!! Help!!!!! unwrittenlaw Linux - Newbie 1 10-01-2003 08:56 PM
Java Virtual Machine Odd_Bloke Linux - Software 4 08-24-2003 10:47 PM
Anyone Know where I can get a Java Virtual Machine? pmorkert Linux - Software 2 07-29-2003 11:17 PM


All times are GMT -5. The time now is 01:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration