LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-01-2013, 10:27 AM   #1
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Rep: Reputation: Disabled
How to call one jar file with other


Hi,

All,

Sorry for my poor English, but i tried to explain my problem as simple as possible

We have a application which runs on java 1.6 and above. This application consists of two jar files, one is main jar file and other we had named it as angel as it is run in background through main jar.

Both the jar files runs on different ports.

Now the scene is when we run the main jar file with cmd as

java -jar jarfilename in windows the second jar gets ran automatically as expected. Both the jar runs on different ports and the application runs without interruption.

But when we do the same thing in Linux system one of the jar gets nonfunctional after 15 min with port remaining open and the application does not runs as per our expectaions.

The strange thing is when we run both the jars separately on Linux, non of the jars gets stuck and application runs as per out expectations.

Kindly let me now what i would need to do on OS level so that our application runs as per our expectations.

Will be awaiting for the response.

Thanks and Regards,

redssr.
 
Old 10-01-2013, 03:16 PM   #2
ajo0909
LQ Newbie
 
Registered: Jun 2006
Distribution: Debian (Sarge,Sid,Etch)
Posts: 8

Rep: Reputation: 1
It depends on what your angel app does. If it for examples opens periodically some ports or writes something to files on the system, then it could be the file descriptor use limt problem. And perhaps setting the ulimt to something higher then the usual value of 1024 would help (for example :
Setting ulimit:

# ulimit -n 99999

or over Sysctl max files command:

#sysctl -w fs.file-max=100000

or in the /etc/sysctl.conf file. )

Alternatively you could perhaps think of the better way to solve the problem at hand for your second application then useing that much of the file access operations.
 
Old 10-07-2013, 04:10 AM   #3
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Original Poster
Rep: Reputation: Disabled
Hi,

Friends,

As per your suggestion i tried both the options seperately as well as combinedly but no difference. But when i run both the jars seprately, they runs without interuptions.

Code:
ulimit -n 99999
sysctl -w fs.file-max=100000
Thanks and Regards,

redssr
 
Old 10-07-2013, 04:37 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,622

Rep: Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369
do these jars have logs? Probably you can find some relevant info in the logs. Also try to increase the memory of the JVM, probably it helps. http://wiki.vuze.com/w/Java_VM_memory_usage
 
Old 10-07-2013, 05:51 AM   #5
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Original Poster
Rep: Reputation: Disabled
Hi,

Friends,

Tried your this option also, but no difference. I still need to start both the jars seprately.

Regards,

redssr
 
Old 10-07-2013, 06:37 AM   #6
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,263

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Can you show an excerpt of source of how you start this "angel" .jar file from "main" .jar? The best if you could give full source or link to jars of both files.
 
Old 10-07-2013, 06:55 AM   #7
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Original Poster
Rep: Reputation: Disabled
Hi,

Here how we startsit,

Code:
java -jar -Xms1024 -Xmx2560 Opensync-server-platform-1.3.0.jar com.qarea.opendoc.server.Application (this is the main jar which run as seerver application

java -jar -Xms1024 -Xmx2560 Opensync-angel-services-1.3.0.jar angel.plugin.Main (this is the angel process)
For more info, there are no any errors in the log file.

Regards,
redssr
 
Old 10-08-2013, 05:41 AM   #8
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,263

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Yes, but how you start "Opensync-angel-services-1.3.0.jar" FROM INSIDE "Opensync-server-platform-1.3.0.jar"? I mean the source code. I am afraid without full source code it will be impossible to guess what is wrong.
 
Old 10-08-2013, 06:49 AM   #9
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Original Poster
Rep: Reputation: Disabled
Hi,

Friend,,

here is my code.

Code:
String cmd = "java -jar Opensync-angel-services-1.3.0.jar ";
Runtime.getRuntime().exec(cmd);
Regards,

redssr
 
Old 10-08-2013, 07:25 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,622

Rep: Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369
that will explicitly start another JVM and run that angel jar in it. But the -Xms1024 -Xmx2560 flags are missing. Probably that causes the problem.
 
Old 10-08-2013, 08:55 AM   #11
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Original Poster
Rep: Reputation: Disabled
Hi,

Friend,

Now the angel service is not getting started after adding yr parameters in code.

Code:
String cmd = "java -jar -Xms1024m -Xmx2560m Opensync-angel-services-1.3.0.jar ";
Runtime.getRuntime().exec(cmd);
No logs.
Code:
We tried it upto -Xmx4096m
Regards,

redssr
 
Old 10-08-2013, 09:01 AM   #12
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,622

Rep: Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369Reputation: 4369
I assume you have not checked the possible error messages/cases, therefore it was suppressed. See an example on how to catch exception here: http://www.coderanch.com/t/419192/ja...String-command
 
Old 10-09-2013, 10:45 AM   #13
redssr
Member
 
Registered: Oct 2013
Location: Dist Nasik MH State Country India
Distribution: Linux
Posts: 108

Original Poster
Rep: Reputation: Disabled
Hi,

Friends,

Getting bellow error.

Code:
java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:167)
        at java.lang.UNIXProcess.waitFor(UNIXProcess.java:115)
        at com.qarea.opendoc.server.sm.socket.AngelSocket.startAngelPlugin(AngelSocket.java:59)
        at com.qarea.opendoc.server.sm.socket.AngelSocket.run(AngelSocket.java:28)
 - Dt : 2013-10-09 06:57:11.76 : EXCP
Regards,
redssr
 
  


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
Error message "Jar file 'mail.jar' was not found in the extended library directory" AussieAndrew Linux - Newbie 1 07-17-2013 02:40 PM
[SOLVED] Gotta weird file showing up on a .jar file while loading.... EODSteven Linux - Newbie 6 10-03-2012 11:49 AM
How to set mail.jar(JavaMail) and mysql-connector-java.jar in Linux class path Terry56 Linux - Software 3 01-19-2010 10:06 AM
I got error with this command 'java -jar NodeView-v1.1.jar' mohdismiaswaly Linux - Software 3 04-23-2009 07:24 AM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 06:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:00 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration