Reputation: 10525
I have been trying to deploy JAX-WS services on Weblogic server as demonstrated in this link, Creating a Simple HelloWorld Web Service. I have deployed this and found to be working perfectly fine.
Now I also want to write data to log files, whenever this service is invoked. For this I'm using log4j. This is how i tried modifying the code in the link.
package examples.webservices.hello_world;
import javax.jws.WebService;
import org.apache.log4j.Logger;
@WebService(name="HelloWorldPortType", serviceName="HelloWorldService")
public class HelloWorldImpl {
public static Logger log = Logger.getLogger(HelloWorldImpl.class);
public String sayHelloWorld(String message) {
try {
log.info("Start");
System.out.println("sayHelloWorld:" + message);
} catch (Exception ex) { ex.printStackTrace(); }
return "Here is the message: '" + message + "'";
}
}
I have set the path of log4j-1.2.8.jar
file in CLASSPATH
variable.
But when i try to build the web service, it errs out saying, java.lang.ClassNotFoundException: org.apache.log4j.Logger
.
I'm using the same build.xml
file as given in the link. Are any modifications required in build.xml
file? Where should i place the log4j.properties file? Any help is appreciated.
Upvotes: 3
Views: 2185
Reputation: 5654
Even if your classpath is set, this issue has to be because weblogic is not able to find log4j at runtime. To be more specific, the Classloader of the war is not able to find the log4j.
Here are the ways to troubleshoot:
log4j
in your WAR.WEB-INF/lib
and check if log4j indeed existsFinally, the preferred approach for deploying set of reusable jars in weblogic is by a shared library and reference it through weblogic.xml
.
It helps in:
Upvotes: 1