This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes BEA/Weblogic and the fly likes WLST- error when added log4j.jar in the  classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "WLST- error when added log4j.jar in the  classpath" Watch "WLST- error when added log4j.jar in the  classpath" New topic
Author

WLST- error when added log4j.jar in the classpath

ashwini chakor
Greenhorn

Joined: Dec 23, 2008
Posts: 2
Hi All,
I am a novice to WLST. I have a problem with the WLST embedded in a java application. I want to programatically read a domain from a java application.
Following code doesn't work if I add log4j.jar in the classpath, otherwise it works fine. Does anybody have any workaround for logging for the following.

Thanks in advance!!!

InteractiveInterpreter interpreter = new WLSTInterpreter();
StringBuffer buffer = new StringBuffer();

try{
buffer.append("readDomain('c:/domains/base_domain')\n");
buffer.append("cd ('/') \n");
buffer.append("cd('AppDeployment')\n");
buffer.append("redirect('/tmp/appname1.log')\n");
buffer.append("appList = ls(returnMap='true')\n");
buffer.append("sz = appList.size()\n");
buffer.append("f=open('/tmp/appname2.log','w')\n");
String str = "f.writelines(appList[i]+"+"\t\r"+")";

buffer.append("for i in range (sz) : f.writelines(appList[i]+"+"\"\\n\""+")\n");
buffer.append("f.close()\n");
buffer.append("stopRedirect()\n");

logger.info(buffer.toString());
interpreter.exec(buffer.toString());

}catch(Exception e){
logger.error(e.getMessage());

throw new Exception("Error while reading domain!");
}
Rohit Bhagwat
Ranch Hand

Joined: Dec 19, 2004
Posts: 205
Can you provide the exception stack trace? It is difficult to find the solution without knowing the exception.
ashwini chakor
Greenhorn

Joined: Dec 23, 2008
Posts: 2
Here is the stacktrace.

Traceback (innermost last):
File "<string>", line 1, in ?
File "C:\Documents and Settings\axc24\Local Settings\Temp\WLSTOfflineIni31052.py", line 83, in readDomain
java.lang.NullPointerException

at com.bea.plateng.domain.script.jython.WLScriptContext.handleException(WLScriptContext.java:1464)

at com.bea.plateng.domain.script.jython.WLScriptContext.readDomain(WLScriptContext.java:409)

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:597)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:160)

at org.python.core.PyMethod.__call__(PyMethod.java:96)

at org.python.core.PyObject.__call__(PyObject.java:270)

at org.python.core.PyInstance.invoke(PyInstance.java:261)

at org.python.pycode._pyx3.readDomain$17(C:\Documents and Settings\axc24\Local Settings\Temp\WLSTOfflineIni31052.py:83)

at org.python.pycode._pyx3.call_function(C:\Documents and Settings\axc24\Local Settings\Temp\WLSTOfflineIni31052.py)

at org.python.core.PyTableCode.call(PyTableCode.java:208)

at org.python.core.PyTableCode.call(PyTableCode.java:267)

at org.python.core.PyFunction.__call__(PyFunction.java:172)

at org.python.pycode._pyx12.f$0(<string>:1)

at org.python.pycode._pyx12.call_function(<string>

at org.python.core.PyTableCode.call(PyTableCode.java:208)

at org.python.core.PyCode.call(PyCode.java:14)

at org.python.core.Py.runCode(Py.java:1135)

at org.python.core.Py.exec(Py.java:1157)

at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:137)

at weblogic.management.scripting.utils.WLSTInterpreter.exec(WLSTInterpreter.java:399)

at us.ny.state.health.hin.wls.domain.WLSTDomain.ifAppExists(WLSTDomain.java:130)

at us.ny.state.health.hin.wls.web.FilePromotionClientController.processRequest(FilePromotionClientController.java:160)

at us.ny.state.health.hin.wls.web.FilePromotionClientController.doPost(FilePromotionClientController.java:85)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)

at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)

at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)

at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)

at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

at weblogic.security.service.SecurityManager.runAs(Unknown Source)

at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)

at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)

at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)

at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)

at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


java.lang.NullPointerException: java.lang.NullPointerException
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WLST- error when added log4j.jar in the classpath
 
Similar Threads
How to replace a line in a file
How to display plain text in jsp without using pre, xmp, or code
introducing line breaks using bean:write or c:out
Java.lang.veryifyerror in JDK6
How to take thread Dump using WLST for Weblogic81