DWR3 Springmvc3.05 注解错误,望高人解决,铁分奉上,感激不尽

duduppp 2013-03-01 09:56:48
spring.xml 部分
<context:annotation-config />

<context:component-scan base-package="com" />

<dwr:configuration />
<!-- <dwr:annotation-config id="dwr-annos" />-->
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true">
<dwr:config-param name="allowScriptTagRemoting" value="true" />
<dwr:config-param name="crossDomainSessionSecurity" value="false" />
</dwr:controller>
<dwr:annotation-scan scanRemoteProxy="true" scanDataTransferObject="true" base-package="com" />
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter">
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="1" />
</bean>
<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="order" value="2" />
</bean>



class部分

@Service(value="testService")
@RemoteProxy(name="testService",creator = SpringCreator.class)
public class TestSerivce {

@RemoteMethod
public String test(){
return "test";
}


}

报错部分
<script type='text/javascript' src='<c:url value="/dwr/interface/testService.js" />'></script>
消息: 'testService' 未定义
控制台
ERROR org.directwebremoting.impl.DefaultCreatorManager - Class not found: 'testService'





...全文
505 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
wheat__ 2013-04-13
  • 打赏
  • 举报
回复
@Service(value="testService") @RemoteProxy(name="testService",creator = SpringCreator.class) public class TestSerivce { 我遇到同样的问题,经过测试发现 @RemoteProxy 与 @Service冲突,把 @Service注释掉即可。
友林 2013-04-01
  • 打赏
  • 举报
回复
我遇到和你类似的问题,解决办法是,将dwr的配置信息顺序放在springmvc的配置之前(如果你还有hibernate等其他配置信息,也要比dwr晚加载)。 以下是我找到的两个别人类似的经历: http://dwr.2114559.n2.nabble.com/404-with-Spring-mapping-problem-td7003748.html http://forum.springsource.org/showthread.php?40841-Spring-mvc-DWR-map-it-to-a-subpath! 希望对你有所帮助。
wyx100 2013-03-01
  • 打赏
  • 举报
回复
#2 得分:0 回复于: 2013-03-01 10:08:56 没遇到过,等高人解决!
zuxianghuang 2013-03-01
  • 打赏
  • 举报
回复
哦, @Service(value="testService") @RemoteProxy(name="testService",creator = SpringCreator.class) public class TestSerivce { 这个加个参数试试 @RemoteProxy(creator = SpringCreator.class, creatorParams = @Param(name = "beanName" ,value ="testService"), name = "testService") public class TestSerivce {
  • 打赏
  • 举报
回复
dwr.xml内容看下
duduppp 2013-03-01
  • 打赏
  • 举报
回复
看了你的demo ,除了filter里的org.springframework.stereotype.Controller 不一样,我的配置是没有问题的呀,springmvc里必须有<context:include-filter org.springframework.stereotype.Controller 去掉不能请求 ,而dwr里则不需要 <context:exclude-filter ,谢谢
zuxianghuang 2013-03-01
  • 打赏
  • 举报
回复
duduppp 2013-03-01
  • 打赏
  • 举报
回复
引用都是正确的, tag 都是有的,系统并不报错,js的路径也是正确的, 只是生成的js不对,如果单独请求js的时候,出现错误HTTP Status 501 - Error. Details logged to the console
doudoubeer 2013-03-01
  • 打赏
  • 举报
回复
帮顶
  • 打赏
  • 举报
回复
<script type='text/javascript' src='<c:url value="/dwr/interface/testService.js" />'></script> 改为: <script type='text/javascript' src='/dwr/interface/testService.js'></script> 要用c:url 引入标签了吗? <%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
smilewmr 2013-03-01
  • 打赏
  • 举报
回复
没遇到过,等高人解决!
lghimly 2013-03-01
  • 打赏
  • 举报
回复
不懂的飘过,顶个贴,兄弟别沉!
duduppp 2013-03-01
  • 打赏
  • 举报
回复
我是直接在项目里做的,项目比较复杂,dwr论坛里好像也没有解决这样的问题。 以下也是这样的额问题:http://www.codercorp.com/blog/spring/configuring-dwr-30-with-spring-using-annotations.html
zuxianghuang 2013-03-01
  • 打赏
  • 举报
回复
你把例子上传,我试试
duduppp 2013-03-01
  • 打赏
  • 举报
回复
这个错误和实现接口有关系吗? 还是不行!
zuxianghuang 2013-03-01
  • 打赏
  • 举报
回复
你有没有接口呀 应该 public interface TestService{ String test(); } @RemoteProxy(creator = SpringCreator.class, creatorParams = @Param(name = "beanName" ,value ="testService"), name = "testService") public class TestSerivceImpl implements TestService {
duduppp 2013-03-01
  • 打赏
  • 举报
回复
都测试过 依旧 ERROR org.directwebremoting.impl.DefaultCreatorManager - Class not found: 'testService'
  • 打赏
  • 举报
回复
web.xml有没有


 <init-param>
            <param-name>classes</param-name>
            <param-value>
                XX.XX.TestService//就是有没有把他放进来
            </param-value>
        </init-param>

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧