haifeng zhou

Greenhorn
+ Follow
since Oct 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by haifeng zhou

Jaikiran Pai wrote:If there are no exceptions, are you checking for something else which shows that the server did not stop? Have you tried debugging the code?



I make a mistake, it can stop, but the next time boot up the web application, there are some exception, it seem I should unregisterMBean and UnicastRemoteObject.unexportObject(registry, false);
is there any example about close JMX?

Paul Sturrock wrote:Is there an exception?



no, the log print success
why JMX can not stop
jmxServer.stop(); doesn't work

I have down java_ee_sdk-6-unix.sh from sun, but it does not work
What shall I do?
14 years ago
is there any example about Java call Tuxedo
I want to send XML file by tuxedo client, is there any example?

this thread is run success and no block, but next code will block, why??
Must I get the InputStream?

thanks a lot
14 years ago
a client invoke server mbean,
at the same time the another client invoke the same mbean
is there any problem??
14 years ago
the two java program run on the same machine which OS is unix
I just know socket can communicate,
does java has some ways like unix communicate on the same machine???
14 years ago
/*******************************************************************************
* $Header$
* $Revision$
* $Date$
* TestResource.java
*
*
* Copyright (c) 2001-2006 Primeton Technologies, Ltd.
* All rights reserved.
*
* Created on 2009-11-27
*******************************************************************************/


package com.eshore.itsm.agent.test;

import java.io.File;
import java.io.IOException;

import com.ibatis.common.resources.Resources;

/**
*
* @author Butcher
*/
public class TestResource {

/**
*@param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
final String resource = "com/eshore/itsm/agent/config/sql-map-ibatis.xml";
try {
System.out.println("TestResource process current path:"+ new File("").getAbsolutePath());
System.out.println("TestResource process begin to read source");
Resources.getResourceAsReader(resource);
System.out.println("TestResource process read source success");
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("TestResource process read source fail");
System.out.println(e.getMessage());
}
}

}

=============================================================================================================

/*******************************************************************************
* $Header$
* $Revision$
* $Date$
*
*
* Copyright (c) 2001-2006 Primeton Technologies, Ltd.
* All rights reserved.
*
* Created on 2009-11-27
*******************************************************************************/


package com.eshore.itsm.agent.test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

/**
*
* @author 周海锋
*/
public class TestCallResource {

/**
*@param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
System.out.println("TestCallResource process current path:"+ new File("").getAbsolutePath());
Process child = Runtime.getRuntime().exec("java -cp D:\\MyEclipseWork\\agent\\bin com.eshore.itsm.agent.test.TestResource");
int nRead = 0;
byte[] line = new byte[2048];
InputStream out = child.getInputStream();
System.out.println("TestCallResource begin to read child process");
while((nRead = out.read(line))>0){
String lineMsg = new String(line, 0, nRead);
System.out.println(lineMsg);
}

System.out.println("TestCallResource begin to read child process error stream");
out = child.getErrorStream();
while((nRead = out.read(line))>0){
String lineMsg = new String(line, 0, nRead);
System.out.println(lineMsg);
}
System.out.println("TestCallResource read child process end");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

=============================================================================================================
if I just run com.eshore.itsm.agent.test.TestResource
Resources.getResourceAsReader(resource) can read the source "com/eshore/itsm/agent/config/sql-map-ibatis.xml"
but run com.eshore.itsm.agent.test.TestCallResource
Resources.getResourceAsReader(resource) can not read the source "com/eshore/itsm/agent/config/sql-map-ibatis.xml"
this two java file in the same package
why??
how does Resources.getResourceAsReader(resource) work
thanks a lot
14 years ago
it run in Unix
Runtime.getRuntime().exec() will create child process to excute shell script
and if I kill parent process, the child process will aslo exit
so, does any way to prevent child process exit???
it run in Unix
Runtime.getRuntime().exec() will create child process to excute shell script
and if I kill parent process, the child process will aslo exit
so, does any way to prevent child process exit???

14 years ago