I was fixing my Log4j.xml on my web project developed with Spring and running on JBoss.
Deploying my application, It catches my eyes an error message although my application was deployed.
it was this error:
4:27:14,323 ERROR [stderr] (MSC service thread 1-2) log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.SpringBeanAutowiringSupport).
14:27:14,323 ERROR [stderr] (MSC service thread 1-2) log4j:WARN Please initialize the log4j system properly.
It was really strange as I declare a logger for org.springframework.
But it seems that the porblem is coming from SpringBeanAutowiringSupport. Although I have declared also a logger fro this method. It didn't work and I get the same error.
What is special for this class is that I am using it to extend my web service class an that it will be initialized and managed by Spring.
So my code was like this :
@WebService(serviceName = "UserService")
public class UserService extends SpringBeanAutowiringSupport {
// Here the service implementation
...
}
It was a normal code. And it works fine. But my log4j seems not very happy.
After some search, I have seen by chance in one blog how to use the SpringBeanAutowiringSupport differently.
Based on that, I have modified my code and now it looks like this :
@WebService(serviceName = "UserService")
public class UserService extends SpringBeanAutowiringSupport {
@PostConstruct
public void init() {
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
...
}
Surprise, now every think is working nice and I have no more error messages while deploying. This is nice :D
Surprise, When testing the Web service. I have a NullPointerException. So now I know that the Error comes from the extends. But to make my web service work, I need to use it.
Deploying my application, It catches my eyes an error message although my application was deployed.
it was this error:
4:27:14,323 ERROR [stderr] (MSC service thread 1-2) log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.SpringBeanAutowiringSupport).
14:27:14,323 ERROR [stderr] (MSC service thread 1-2) log4j:WARN Please initialize the log4j system properly.
It was really strange as I declare a logger for org.springframework.
But it seems that the porblem is coming from SpringBeanAutowiringSupport. Although I have declared also a logger fro this method. It didn't work and I get the same error.
What is special for this class is that I am using it to extend my web service class an that it will be initialized and managed by Spring.
So my code was like this :
@WebService(serviceName = "UserService")
public class UserService extends SpringBeanAutowiringSupport {
// Here the service implementation
...
}
It was a normal code. And it works fine. But my log4j seems not very happy.
After some search, I have seen by chance in one blog how to use the SpringBeanAutowiringSupport differently.
Based on that, I have modified my code and now it looks like this :
@WebService(serviceName = "UserService")
public class UserService extends SpringBeanAutowiringSupport {
@PostConstruct
public void init() {
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
...
}
Surprise, now every think is working nice and I have no more error messages while deploying. This is nice :D
Surprise, When testing the Web service. I have a NullPointerException. So now I know that the Error comes from the extends. But to make my web service work, I need to use it.
No comments :
Post a Comment