你确信authService!=null?看一下日志输出吧,看看哪里出错了!
解决方案 »
- jsp中,td单元格如何斜着一分为二?
- resin + apache 配置虚拟主机不生效 急急急急急
- 道相同,相为谋!!
- java ee 与java2ee有何区别?
- xfire 调用.net webservice?
- 怎么将.WAR文件部署到tomcat中
- 关于struts+hibernate的查询问题。
- drame waver启动的时候出现 xerces panic error
- 在jb8中建cmp时要一个一个字段地添加吗?并且“是不是主键”这些确定的信息都要自己来添加吗?能不能自动建立?
- 特急!!!关于EJB_QL的一个小问题,大侠帮忙,小弟高分送上
- 我在上香港亨达网站时总是提示一个java错误,说什么小程序加载失败.具体错误如下.
- 关于实现webservice
你在得到authService后
看看是否为null在做结论
我估计是spring 的管理可能被其他的什么东西影响进而出错,但是没见过类似的问题
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;import com.telestone.web.util.ContextUtil;
/**
* 扩展的ContextLoaderListener
*
*/
public class MyContextLoaderListener extends
org.springframework.web.context.ContextLoaderListener { @Override
public void contextInitialized(ServletContextEvent event) {
// TODO Auto-generated method stub
super.contextInitialized(event);
ServletContext context = event.getServletContext();
ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
ContextUtil contextUtil = (ContextUtil) ctx.getBean("contextUtil");
contextUtil.setContext(ctx);
}}之后在web.xml中配置自己的ContextLoaderListener <listener>
<listener-class>
com.XXXXXXXX.util.MyContextLoaderListener
</listener-class>
</listener>可以将MyContextLoaderListener配入容器。通过注入service层bean使用。也可以直接写成静态类。在service层使用。
而不是spring
对于spring我不是很熟,因为这个项目也是别人架的,web.xml中配了监听,直接用的ContextLoaderListener,方法应该没问题。zqpsswh :
我在要执行的方法开始就设了断点或者写了打印,都没有走到,而且如果是方法的错,不会有时候错,有时候又不错啊!
我只是写了他里面描述的一种方法。