liuhong2099
2009-06-21 00:52
浏览 277
已采纳

Spring整合dwr出现404找不到工程

只要一在Spring 配置文件里配置 就报错 我都检查了,没发现我语法错误,真无语了啊
[code="java"]

<bean id="testDao" class="org.test.dao.TestDao">
    <property name="sessionFactory" ref="sessFactory"></property>
</bean>


<bean id="testService" parent="txProxyTemplate">
    <property name="target">
        <bean class="org.test.service.Services">
            <property name="testdao" ref="testDao"></property>
        </bean>
    </property>
</bean>



<!--DWR的配置<bean id="dwr" class="org.test.dwr.TestDwr">
    <property name="services">
        <ref bean="testService" />
    </property>
</bean>-->

[/code]

DWR.xml配置
[code="java"]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN" "http://www.getahead.ltd.uk/dwr/dwr10.dtd">







[/code]

web.xml配置
[code="java"]
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

action

org.apache.struts.action.ActionServlet


config
/WEB-INF/struts-config.xml


debug
3


detail
3

0

<!-- DWR -->
<servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
    <init-param>
        <param-name>debug</param-name>
        <param-value>true</param-value>
    </init-param>
</servlet>

<!-- /DWR -->
<servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- DWR -->
<servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<!-- /DWR -->

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<!-- Spring监听 -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/classes/applicationContext.xml
    </param-value>
</context-param>
<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>
<!-- Spring监听 -->

[/code]

java代码
[code="java"]
public class TestDwr {

private Services services;

public Services getServices() {
    return services;
}

public void setServices(Services services) {
    this.services = services;
}

public String hehe(String ha){
    return ha+"嘿嘿";
}

}
[/code]

[b]问题补充:[/b]
工程就404错误啊,没异常哦
[b]问题补充:[/b]
现在的问题是,根本找不到工程 如果去掉Spring的那个配置 可以找到工程

/dwr 也是404 无法测试啊

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

7条回答 默认 最新

  • layer555 2009-06-24 16:28
    最佳回答

    呵呵 yourgame果然不愧是架构师,一下就看出问题了。他的配置都对了,但是部署的时候缺少了很多必须的jar包,都是MyEclipse误人啊。。。添加正确的Spring、hibernate以及相关的jar包,启动就可以成功了;

    评论
    解决 无用
    打赏 举报
查看更多回答(6条)

相关推荐 更多相似问题