Get process-ID of particular java process?

I have created a startup script for air-video-server which happens to be a java application.
The problem I'm facing now is that I can't identify the process ID of the particular java process using pidof.
ps aux | grep AirVideo shows:
user 4180 7.0 0.3 2309364 31288 pts/0 Sl 12:51 0:00 java -jar AirVideoServerLinux.jar
Here's the line I'm using right now:
PID=`pidof -o %PPID java`
but this obviously lists the process IDs of all running java processes, not just air-video-server.
PID=`pidof -o %PPID ava -jar AirVideoServerLinux.jar`
doesn't match anything at all.

pgrep(1) might help you

Similar Messages

  • Starting New process (continous) from another java process

    Hi,
    I am running into a trouble in starting a new java process (continous process it is like daemon process ) from another java process.
    Eg;
    Caller.java runs on one JVM instance, from this Caller.java i need to start a daemon java process ConnectionManager.java (My caller.java should have to know whether ConnectionManager was successfully started as a seperate java process or not)
    Also Caller.java has to stop ConnectionManager.java(which is running as seperate process)
    Any help would be appeciated.
    Thank you very much.

    First of all the design is unusual. Your issue is basically intercommunication between two processes written in java. There are various ways to do that:
    1. Use Persistent system(File/Database) : Easiest but have external dependency.
    2. Use RPC calls both JVM,s little bit complex.
    3. Run new JVM in debug mode and connect on bootstrap port.
    4. Communicate using Sockets.
    Whatever suits you...

  • Orchestrating Java processes ?

    I have a bunch of items arriving from outside to a queue or a database. Based on the "status" (either the "status" column in a database, or the status defined in some way in the queue) of the item, a particular Java process (or more than one of the similar process) will be invoked. When that process completes, it updates this "status". And another Java process kicks in and so on.
    My question is, what is the best way to achieve this with the latest Java technologies ? Are there ready-made frameworks to achieve this ?
    Thanks.

    kg2 wrote:
    So I looked at ServiceMix and it does look good. But it might be a little too heavy for my needs.So you asked for the latest open source Java technologies for process orchestration, simply to avoid having to describe your actual problem? Good luck with your next doctor's visit!
    "Doc, I need the latest experimental, untested, dubious wonder-drug".
    "I'm prescribing you some Amyproctylactomincillin"
    "Actually, maybe I just need some Lemsip"
    I am wondering if some job scheduling utility is all that I really need, unless I am missing something ? In which case, are there any Job scheduling APIs available with Eclipse ?What do you mean by "with Eclipse"? Eclipse has a scheduling API, but that's not to say you should use it. It's really for if you're writing Eclipse plugins, not if you just happen to be using Eclipse as your IDE. A word of advice: try being clearer about what it is you actually want, rather than just bandy around technologies and vague ideas like this. You'll end up getting the wrong advice over and over again, otherwise

  • JDK 1.6 on Solaris. Multiple java processes and thread freezes

    Hi, we've come across a really weird behavior on the Solaris JVM, reported by a customer of ours.
    Our server application consists of multiple threads. Normally we see them all running within a single Java process, and all is fine.
    At some point in time, and only on Solaris 10, it seems that the main Java process starts a second Java process. This is not our code trying to execute some other application/command. It's the JVM itself forking a new copy of itself. I assumed this was because of some JVM behaviour on Solaris that uses multiple processes if the number of threads is > 128. However at the time of spawn there are less than 90 threads running.
    In any case, once this second process starts, some of the threads of the application (incidentally, they're the first threads created by the application at startup, in the first threadgroup) stop working. Our application dumps a list of all threads in the system every ten minutes, and even when they're not working, the threads are still there. Our logs also show that when the second process starts, these threads were not in the running state. They had just completed their operations and were sleeping in their thread pool, in a wait() call. Once the second process starts, jobs for these threads just queue up, and the wait() does not return, even after another thread has done a notify() to inform them of the new jobs.
    Even more interesting, when the customer manually kills -9 the second process, without doing anything in our application, all threads that were 'frozen' start working again, immediately. This (and the fact that this never happens on other OSes) makes us think that this is some sort of problem (or misconfiguration) specific to the Solaris JVM, and not our application.
    The customer initially reported this with JDK 1.5.0_12 , we told them to upgrade to the latest JDK 1.6 update 6, but the problem remains. There are no special JVM switches (apart from -Xms32m -Xmx256m) used. We're really at a dead end here in diagnosing this problem, as it clearly seems to be outside our app. Any suggestion?

    Actually, we've discovered that that's not really what was going on. I still believe there's a bug in the JVM, but the fork was happening because our Java code tries to exec a command line tool once a minute. After hours of this, we get a rogue child process with this stack (which is where we are forking this command line tool once a minute):
    JVM version is 1.5.0_08-b03
    Thread t@38: (state = IN_NATIVE)
    - java.lang.UNIXProcess.forkAndExec(byte[], byte[], int, byte[], int, byte[], boolean, java.io.FileDescriptor, java.io.FileDescriptor, java.io.FileDescriptor) @bci=168980456 (Interpreted frame)
    - java.lang.UNIXProcess.forkAndExec(byte[], byte[], int, byte[], int, byte[], boolean, java.io.FileDescriptor, java.io.FileDescriptor, java.io.FileDescriptor) @bci=0 (Interpreted frame)
    - java.lang.UNIXProcess.<init>(byte[], byte[], int, byte[], int, byte[], boolean) @bci=62, line=53 (Interpreted frame)
    - java.lang.ProcessImpl.start(java.lang.String[], java.util.Map, java.lang.String, boolean) @bci=182, line=65 (Interpreted frame)
    - java.lang.ProcessBuilder.start() @bci=112, line=451 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String[], java.lang.String[], java.io.File) @bci=16, line=591 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String, java.lang.String[], java.io.File) @bci=69, line=429 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String) @bci=4, line=326 (Interpreted frame)
    - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)There are also several dozen other threads all with the same stack:
    Thread t@32: (state = BLOCKED)
    Error occurred during stack walking:
    sun.jvm.hotspot.debugger.DebuggerException: can't map thread id to thread handle!
         at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
         at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.getThreadIntegerRegisterSet(ProcDebuggerLocal.java:364)
         at sun.jvm.hotspot.debugger.proc.sparc.ProcSPARCThread.getContext(ProcSPARCThread.java:35)
         at sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess.getCurrentFrameGuess(SolarisSPARCJavaThreadPDAccess.java:108)
         at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
         at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
         at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:50)
         at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
         at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
         at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)I'm pretty sure this is because the fork part of the UnixProcess.forkAndExec is using the Solaris fork1 system call, and thus all the Java context thinks all those threads exist, whereas the actual threads don't exist in that process.
    It seems to me that something is broken in UnixProcess.forkAndExec in native code; it did the fork, but not the exec, and this exec thread just sits there forever. And of course, it's still holding all the file descriptors of the original process, which means that if we decide to restart our process, we can't reopen our sockets for listening or whatever else we want to do.
    There is another possibility, which I can't completely rule out: this child process just happened to be the one that was fork'd when the parent process called Runtime.halt(), which is how the Java process exits. We decided to exit halfway through a Runtime.exec(), and got this child process stuck. But I don't think that's what happens... from what I understand that we collected, we see this same child process created at some point in time, and it doesn't go away.
    Yes, I realize that my JVM is very old, but I cannot find any bug fixes in the release notes that claim to fix something like this. And since this only happens once every day or two, I'm reluctant to just throw a new JVM at this--although I'm sure I will shortly.
    Has anyone else seen anything like this?

  • SC3.1/2xV40z: java process eating memory

    I've got a 2-node Cluster (SC 3.1) on Solaris 10x86 606 running. Uptime is about 171 days. noticed a java process allocating about 1.3 GB of RAM. This happens only on one node. The other one shows max. 256 MB allocated by a particular java processes.
    Is there a memory leak in the SC3.1 software?

    Which java process is it? If it is cacao, then you've hit CR 6359362. It doesn't look like there is a fix just now, but the workaround is to disable cacao from starting up. See the CR for details.
    Tim
    ---

  • CJS-30151 Java process ERROR

    Hi Everyone,
    I was trying to install NW 2004's(ABAP+JAVA,BI,EP,EP Core),getting following error,eventhough VM settings changed  to 1024(total 4GB).
    Error is :
    CJS-30150  Java processes of instance ECC/DVEBMGS04 [ABAP: ACTIVE, Java: UNKNOWN] did not reach state PARTRUNNING after 20:00 minutes. Giving up.
    FCO-00011  The step startJava with step key |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_CI_Instance|ind|ind|ind|ind|11|0|NW_CI_Instance_StartJava|ind|ind|ind|ind|5|0|startJava was executed with status ERROR .
    Please do needful.
    Thanks,
    Naren

    My Solution:
    OS: Win2003 Std Edition
    DB: Oracle 10g
    SAP: SolMgr 4 SR3
    1. Set VM to 4096.
    2. In Services, make sure Oracle listener starts automatically
    3. Stop the installation and SAP instances.
    4. Restart the server
    5. Check that oracle listener is running
    6. Start SAP from the SAPmmc Console and wait till all processes are green. Java process will take a while to complete. I waited about 4-5 mins for it to turn from yellow to green
    7. Rerun the installation
    From the above steps, I managed to resolve this problem.

  • How do I get the PID of a child process in java using JNI?

    I am writing an app in Java (for **nix) that will spawn multiple processes (using Process objects). I want to be able to get the PID for a particular child process (not the parent). How can I do this?

    You could try an extreme hack of using JNI to read whatever field of the java.lang.Process-derived class may hold a native process id. This would be unsupportable beyond the exact JVM(s) you can test it on, and should only be a last resort, but within these constraints it may work well. The source code for package java.lang gives clues of where to start hacking.
    -slj-

  • How to get response from an asynchronous BPEL process in Java

    I'm experimenting with BPEL and doesn't seem to be able to get response from an asynchronous BPEL process. Here's the deal:
    I have a BPEL process that takes a string as input, and gives another string as output. This is a asyncronous process.
    I want to initiate this BPEL process as a web service so I generate a Webservice Proxy in JDeveloper 10g (10.1.3.0.4). The function to call the process is now called "initiate" and takes three arguments: the input string, a "org.xmlsoap.schemas.ws._2003._03.addressing.EndpointReferenceType replyTo" and a
    "org.xmlsoap.schemas.ws._2003._03.addressing.AttributedURI messageID".
    HTTP-Analyzer shows that invoking the BPEL process with initiate("somestring", null, null) results in sending a SOAP message to the BPEL process, which returns a "202 Accepted". How do I get the response from the process? My intuition tells me that I have to use that second argument, that EnpointReferenceType thing. How do I use that?
    Another question: If a asynchronous BPEL process does not exists (so the endpoint does not exist) the Java proxy does not throw an error when runned. It does not even sends a message. It exits with status 0! (This happens for example when deploying a new version of a process and when the "old" version is undeployed). Calling a non-existing synchronous BPEL process, the Java proxy DOES throw an error.

    Clemens,
    That all sounds logical. But somehow it is still a mystery for me ... Somehow I don't see what should be done.
    To call the async BPEL process I have the following procedure:
    initiate(String input, org.xmlsoap.schemas.ws._2003._03.addressing.EndpointReferenceType replyTo, org.xmlsoap.schemas.ws._2003._03.addressing.AttributedURI messageID)
    The first argument is the input for my BPEL process. The second is the address to a webservice that should handle the callback, right? The third is a messageID (makes sense, but why of the type AttributedURI?).
    Here lies my problem. It is not clear to me how these EndpointReferenceType & AttributedURI work. I can't find anything on the net about it. The AXIS examples as where mentioned earlier use other types (namely the "org.xmlsoap.schemas.ws.addressing.MessageID" and "org.xmlsoap.schemas.ws.addressing.ReplyTo") which are completely different.
    What I did so far:
    - I created an webservice proxy that listens on the onResult endpoint of the BPEL process.
    - I created an webservice proxy that calls the BPEL process through the initiate procedure, but it is not completely clear to me how to construct the EndPointreferenceType replyTo, and the MessageID. I did something like this:
    EndpointReferenceType replyTo = new EndpointReferenceType();
    // callback service running on local machine
    // This URI class is the java.net's version
    URI replyToURI = new URI("http://vaccinatie:8988/syncro-callback-context-root/stringconcatCallbackBindingPort");
    // This AttributedURI is the org.xmlsoap.schemas.ws._2003._03.addressing's version
    AttributedURI address = new AttributedURI();
    // the only public methos that made sense to me:
    address.set_value(replyToURI);
    replyTo.setAddress(address);
    // call the BPEL process
    myPort.initiate("test123", replyTo, address);
    But the above doesn't work (largely because I don't know what I'm doing here prob.:-) ) It does send the "test123" message, and the BPEL process does process it, but I don't seem to get the callback right.
    I hope this makes my problems somewhat clearer. I hope someone can help me, because I'm just a beginner in this whole "web service area" and seems to do something terribly wrong here, because it should be very simple. Thx.

  • How to get the list of all running process in java

    hi all,
    i want to get the list of all running processes on my system. please let me know if it is possible to do with JAVA. which class i should use?
    waiting for reply
    bye

    Wrong forum. Just a hint.

  • Get process preference from Mediator Java CallOut

    Hi,
    I have used Java Call Out in my mediator. Mediator further forwards the request to BPEL having some preferences. I want to
    get BPEL Process preference value in Java Call Out class method preRouting(). Is it possible?
    I found 1 way to achieve the same using Oracle Fusion Middleware Infrastructure Management Java API. But problem with this is that- I need to hard code parameters like composite endpoint, username & password which I do not want.
    Is there some other way to to get process preference from preRouting()?
    Thanks,
    Sujata

    I don't think you can get the process ID from within java or send signals to other processes.
    You might look at the sun.misc.Signal class. However, it is not recommended to use sun.* classes and I don't think it will do what you need either.
    You will probably have to use JNI, or if it is your program you could just have it send its process ID to standard out.

  • Handling .class files insite java process

    Hello folks
    I have a question regarding JVMPI and JVM: I have created a small proff-of-concept program that handles JVMPI_EVENT_CLASS_LOAD_HOOK and JVMPI_EVENT_CLASS_LOAD events. After my class (simple Test.java with System.out.println) has beed loaded (*CLASSLOAD_HOOK event) I remembered pointer and size of .class file in memory of java process. Then, after CLASSLOAD event I filled this memory with zeroes (memset) to see if Test.class will execute normally. And it did worked fine. My question is: does java process need this memory after JVMPI_EVENT_CLASS_LOAD event? Can I safely override .class file data?
    Best Regards
    Boloek

    At some point, the JVM writes the contents of the
    class file into memory that's accessible via coredump.
    Otherwise it couldn't execute the bytecodes. If you
    zero out the memory where the physical .class file was
    loaded, it won't affect the memory where the actual
    class is stored.you are wrong :-) I did some testing and I caught three events:
    - LOADHOOK where I remembered pointer to .class file and size of it
    - _LOAD where I zeroed this memory
    - JVMSHUT_DOWN where I caused SIGSEGV to force coredump.
    I tested two cases: with and without clearing memory and then searched two different core-files for content of *.class file. I only found it in core dumped in a situation when I did not use memset to clear memory. It is because (as I assume) java process after loading .class file makes some optimisations to efficiently execute bytecode so representation of my code exists in memory of proces but in unreadable, undocummented and undecompilable (at least for non jvm developers) format which is characteristic to particular JVM implementation
    Someone who wants your code badly enough is going to
    get it.sure but I try to make him this task as difficult as I can ;)
    Best Regards
    Boloek

  • How do I stop Java processes from appearing on the dock?

    I have a Java application that has a fairly extensive build process using ant. It builds fine on OSX, but constantly annoys me. There are a large number of unit tests that run using JUnit, and each test starts in a new Java process. The problem is that when each process starts (and there are about 100 during the course of the build), a new Java icon appears on the dock and stays until the process finishes. First of all, that slows down the build (since it has to do all that graphics work to keep changing the appearance of the dock). Secondly, every time a new process starts, it takes away the keyboard focus from whatever I'm currently working on. I either have to click in the window I want again, or else wait for the process to finish.
    On Windows, this is handled with an alternative version of the JVM called "javaw.exe" that does not get a foreground window. However, I see no "javaw" in the Java directory on OSX. Is there some option to start Java with that will stop this dock updating? Note that there are times when I want the dock to be updated (when I'm running a "normal" Java app).

    Even when the Guest Account / Access is disabled, the login option / and lock screen, still have a guest login.
    This is because in Preferences/ Security & Privacy/General the bottom item is turned on.
    Turn on: Disable restarting to Safari when screen is locked

  • Getting the payload from a faulted process

    I'm using the fault framework and I need to know how to get the payload from the faulted process. I have a custom java logger that uses the locator API, but I'm finding out that this will only work if the process has been persisted to the dehydration store. Is there another way to get the payload? I know I can use checkpoint/wait within the bpel process to force dehydration but I'm looking for another alternative

    The problem is the cube instance table has not been populated yet for the instance. So from a faulted instance that has NOT been dehydrated to cube instance, how will I get to the invoke_message table, or how will I get the payload from the faulted instance.
    I'm able to get the document fine when the cube_instance table is populated, my problem is sometimes the instance has not been dehydrated and cube_instance is not available. So from a faulted instance how will I get to the invoke_message table without using the cube_instance table

  • Java process - high CPU usage

    Hi,
    I'm describing a high CPU scenario which gets triggered randomly ( I'm not able to replicate it on my lab setup).
    There are around 120 threads which are running in my java process. The jvm is running on a high traffic (through put) site, where there are a lot of async events coming to the java process.( around 220 events per 60 seconds ). The java process works fine in this scenario, the normal CPU consumption hovers around 1.5 % to 2.0 %.
    But, at times, I've seen CPU to be as high as 43 %, and it stays at that value for hours altogther. In those situations, I usually do a failover to standby java process. I tried debugging the issue to see which java thread could be causing the issue, but, I could not come to a conclusion or replicate the situation in lab environment.
    Here are the details of the execution environment
    java -version
    java version "1.4.2_11"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    Java HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)
    prstat during high CPU
    PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
    10485 root 120 10 0 570M 381M cpu1 268:10 43.64% java
    prstat -Lm -p output
    PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
    10485 root 53 0.5 0.2 0.0 0.0 30 0.2 16 69 1K 118 0 java/2
    10485 root 31 0.0 0.1 0.0 0.0 53 0.2 16 23 778 93 0 java/26
    10485 root 0.4 0.0 0.0 0.0 0.0 99 0.0 0.1 10 16 106 0 java/12
    10485 root 0.1 0.0 0.0 0.0 0.0 100 0.0 0.0 3 2 7 0 java/15
    10485 root 0.1 0.0 0.0 0.0 0.0 97 0.0 2.4 120 3 128 0 java/41
    10485 root 0.1 0.0 0.0 0.0 0.0 97 0.0 2.5 120 4 131 0 java/410
    Some more points about the last prstat -Lm output.
    java/2 is "VM Thread" ( responsible for GC). "VM Thread" is having a NORMAL priority ( 5 )
    java/26 is a "Worker" thread, with priority MINIMUM ( 1 ).
    Could you suggest what could be issue, and what other information I could collect to find out the issue. Its difficult to profile the process because the problem scenario is difficult to ascertain and the process is running on a production setup.
    Any help is appreciated.
    Thanks
    Sanjay

    Hi,
    Thanks for your response. Both, the production setup and lab setup have have 2 physical CPUs.
    Actually, there are two java threads ( machine is solaris 10) one is "VM Thread" and other is my applications worker thread. (there are 10 of them with priority 1). If you look at the top two lwps in the prstat -Lm , both are showing high value of ICX.
    I'm still not able to drill down to my code level. (Worker thread is waiting on a queue to de-queue server request). Could you give some hint to move foward?
    rgds
    Sanjay

  • Java Process with High CPU

    I have a java process running on HP-UX with a 1.4.2 JVM. This program is using some third-party code (quartz) to act as a batch scheduler similar to cron. When running in production, the process runs fine for several days and then starts maxing out the CPU. The server has 8 cpu's and the last time the problem occured, 4 of the cpu's were 100% in use with this process.
    I've tried sending a "kill -3 pid" but I can't seem to get a thread dump. I've eventually gotten some 700Meg core files. Is there anyway to use these core files to tell me what is going on?
    Any ideas on how to trouble shoot this problem? We've used some profilers but we can't duplicate the problem on test servers so we aren't learning anything new.
    Thanks,
    Brian

    Try pstack to read the stacks of the threads in the process.
    Try pldd to determine the shared libraries in the process then
    use truss to trace calls in any of these libraries to determine where
    the cycles are being spent.

Maybe you are looking for

  • Help required for Linux installation

    Could someone please help me on installing the Java sdk on Suse linux 8? Ive got the rpm but i have no idea how to install it, installing things on linux just boggle me!

  • Problème avec une mise à jour récente de photoshop CS6

    J'ai photoshop CS6 et une mise à jour récente m'a proposé photoshop CS6 extended. Je n'ai pas voulu de photoshop extended mais depuis je n'ai plus accès à ma version de photoshop CS6. Que dois-je faire pour me sortir de cette galère créée par ADOBE?

  • Number of channels

    I have this Dial Peer: dial-peer voice 12 pots destination-pattern 12T inward-dialing port 2/0:D My question is: Is there a way to make the calls using this DP use a certain number of channels? For example 14 to 23? Thanks in advance.

  • Problems removing quicktime

    i recently uninstalled the latest quicktime version and then did a system restore to get it back, but now my itunes program is telling me im missing files, i tried reinstalling itunes and quicktime but it gives me and error 3 message at the end of th

  • My atv 2 quit sharing or became extremely slow (spinning circle)

    Recently (since software upgrades to itunes 11 and apple tv) I am now unable to get past the spinning wheel when tryig to watch shared movies or listen to shared music(though music now seems to be working) from the iMac.  I upgraded my cisco e2500 fi