2 u011484075 u011484075 于 2013.10.31 11:57 提问

spring注入activiti的接口问题???

spring注入
@Autowired
protected RepositoryService repositoryService;

代码把注入的接口转换为子类
RepositoryServiceImpl repositoryServiceImpl=(RepositoryServiceImpl) repositoryService;

抛出的:
严重: Servlet.service() for servlet spring3 threw exception
java.lang.ClassCastException: $Proxy26 cannot be cast to org.activiti.engine.impl.RepositoryServiceImpl
at com.zx.appsupport.web.activiti.LeaveController.traceProcess(LeaveController.java:869)
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.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)。。。。。

看别人这样都可以 我照他的写就有问题

1个回答

zuohao821221
zuohao821221   2013.11.08 10:22

在spring配置文件中写这个了吗?
context:annotation-config/

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!