• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

WLST- error when added log4j.jar in the classpath

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!");
}
 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you provide the exception stack trace? It is difficult to find the solution without knowing the exception.
 
ashwini chakor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
What's wrong? Where are you going? Stop! Read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic