문제

I am using Tomcat 7. JDK1.6.

I was trying to get the list of runtime JVM.

Code:

for (int i=0; i<VirtualMachine.list().size(); i++) {
    VirtualMachineDescriptor vi = VirtualMachine.list().get(i);
        System.out.println("**PID :"+vi.id()+" **DISPLAYNAME:"+vi.displayName());
}

It works fine when I compile it in Eclipse. But when I exported it in to a war package, and put the war file into webapps folders of Tomcat, it returns empty list. And eclipse use the same tomcat too. I found that configuration files in eclipse are same with those files in tomcat. But there are bootstrap entries and user entries in eclipse. User entries are pointed to Tomcat 7. I want to try to set same configuration to Tomcat, but I don' t know how to set bootstrap entries to Tomcat. enter image description here

도움이 되었습니까?

해결책

When I debugged the tools.jar code and found the root cause, In short, what you need to do is just remove the all the following setting in catalina.bat or catalina.sh, before you start tomcat on windows or unix. Enjoy it! :-)

-Djava.io.tmpdir="%CATALINA_TMPDIR%"

Welcome discussion, maybe there are much earier way then mine.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top