|
|
Posted Sep 15, 2008 at 7:25:58 AM
Subject: how to restart the process using java
[b]Hi all,
i m shashi kant,
i am developing an application to create new sobdomain using j2ee technologies.
my server is linux server with bind installed over there.in my application when i request to create a new sobdoamin then i need to update few process to resolve the newely created subdomainm. like i need to update bind server to resolve the subdomain. but when i execute the command to update("pgrep -x named" and kill -HUP PID) or restart(/etc/init.d/named restart) the bind server i got the following pesmission priblem..............can u plz help me to find out the problem Thanks[/b]
at java.lang.Thread.run(Thread.java:595)
java.io.IOException: java.io.IOException: /etc/init.d/named: cannot execute
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at java.lang.Runtime.exec(Runtime.java:326)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:56)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:538)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:803)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:643)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod(Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:69)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
at script1000003.run(script1000003.groovy:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:56)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:538)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:803)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:643)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:569)
at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44)
at groovy.lang.Script.invokeMethod(Script.java:78)
at com.webratio.units.utility.rtx.ScriptUnitService.createUnitBean(ScriptUnitService.java:240)
at com.webratio.units.utility.rtx.ScriptUnitService.getUnitBean(ScriptUnitService.java:195)
at com.webratio.units.utility.rtx.ScriptUnitService.execute(ScriptUnitService.java:169)
at com.webratio.struts.actions.OperationAction.executeOperation(OperationAction.java:214)
at com.webratio.struts.actions.OperationAction.doExecute(OperationAction.java:153)
at com.webratio.struts.actions.OperationAction.execute(OperationAction.java:50)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
at com.webratio.struts.servlets.WRActionServlet.doPost(WRActionServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
at com.webratio.struts.servlets.WRActionServlet.doPost(WRActionServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
|
Khabi
Joined Apr 21, 2008 Posts: 121
Other Topics
|
Posted:
Sep 15, 2008 6:55:28 PM
Subject: how to restart the process using java
The problem is that the user that tomcat (looks like tomcat logs) is running under doesn't have permission to restart the service. Tomcat does not and should *NOT* run as root.
May I point out that restarting the service over and over is a bad idea as well. I'm guessing you're writing directly to the bind zone file? (Another bad idea).
Try using nsupdate (I think there is a java implimentation somewhere).
http://linux.yyz.us/nsupdate
|