eclipse+runjet 运行wicket+spring报找不到指定的bean

freecode 2008-10-29
开发环境:eclipse3.3,采用runjet插件,项目文件结构采用eclipse web project。配置文件如下:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="wicket_app" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>wicket_app</display-name>

    <context-param>
        <param-name>hsql.dbPath</param-name>
        <param-value>D:/workspace/workspace3/wicket_app/db/hsqldb</param-value>
    </context-param>
    <context-param>
        <param-name>hsql.dbName</param-name>
        <param-value>appdata</param-value>
    </context-param>
    <context-param>
        <param-name>hsql.port</param-name>
        <param-value>9002</param-value>
    </context-param>

    <listener>
        <listener-class>
            com.dev.servlet.HSQLDBStartListener
        </listener-class>
    </listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>

<filter>
<filter-name>Spring</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
            <param-name>applicationFactoryClassName</param-name>
            <param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>Spring</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
</filter-mapping>

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!--
<servlet>
<servlet-name>wicket</servlet-name>
<servlet-class>
org.apache.wicket.protocol.http.WicketServlet
</servlet-class>
<init-param>
<param-name>applicationFactoryClassName</param-name>
<param-value>
org.apache.wicket.spring.SpringWebApplicationFactory
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>wicket</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
-->

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <!--  <value>WEB-INF/mail.properties</value>-->
                <value>classpath:jdbc.properties</value>
                <!--  <value>WEB-INF/oscache.properties</value>-->
            </list>
        </property>
    </bean>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${datasource.driverClassName}"/>
        <property name="url" value="${datasource.url}"/>
        <property name="username" value="${datasource.username}"/>
        <property name="password" value="${datasource.password}"/>

    </bean>

    <!-- ibatis -->
    <bean id="sqlMapClient"
        class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation"
            value="classpath:SqlMapConfig.xml" />
    </bean>

    <!--能过aop 管理事务-->
    <bean id="txManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource">
            <ref bean="dataSource"/>
        </property>
    </bean>

    <tx:advice id="txAdvice" transaction-manager="txManager">
        <!-- the transactional semantics... -->
        <tx:attributes>
            <!-- all methods starting with 'get' are read-only -->
            <tx:method name="get*" read-only="true" />
            <!-- other methods use the default transaction settings (see below) -->
            <tx:method name="*" rollback-for="Exception" />
        </tx:attributes>
    </tx:advice>

    <aop:config>
        <aop:pointcut id="serviceOperation"
            expression="execution(* com.app.*.*(..))" />
        <aop:advisor advice-ref="txAdvice"
            pointcut-ref="serviceOperation" />
    </aop:config>

    <!--dao-->
    <bean id="sequenceDao" class="com.app.doaImpl.SequenceSqlMapDao">
    <property name="sqlMapClient" ref="sqlMapClient"/>
<property name="dataSource">
        <ref bean="dataSource" />
        </property>
</bean>
<!--
    <bean id="petStoreDao" class="org.petsoar.ibatis.doaImpl.PetStoreSqlMapDao">
        <property name="sqlMapClient" ref="sqlMapClient"/>
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="sequenceDao">
            <ref bean="sequenceDao" />
        </property>

    </bean>

    <bean id="userDao" class="cn.edu.lib.ibatis.daoImpl.UserSqlMapDao">
        <property name="sqlMapClient" ref="sqlMapClient"/>
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
    </bean>
-->
</beans>

在eclipse下运行runjet来启动项目,报错误:
ERROR - log                        - Failed startup of context org.mortbay.jetty.webapp.WebAppContext@19fe451{/,WebContent}
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.app.doaImpl.SequenceSqlMapDao] for bean with name 'sequenceDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.app.doaImpl.SequenceSqlMapDao
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
找不到com.app.doaImpl.SequenceSqlMapDao,但该类确实存在,以前采用struts+spring,也是采用同样的配置文件,没报错。
freecode 2008-10-29
还有个问题,自己编译运行wicket-example,报
ERROR - log                        - failed WicketExamplesMenuApplication
org.apache.wicket.WicketRuntimeException: Application class org.apache.wicket.examples.portlet.menu.WicketExamplesMenuApplication must be a subclass of WebApplication
at org.apache.wicket.protocol.http.ContextParamWebApplicationFactory.createApplication(ContextParamWebApplicationFactory.java:76)
at org.apache.wicket.protocol.http.ContextParamWebApplicationFactory.createApplication(ContextParamWebApplicationFactory.java:49)
。。
freecode 2008-10-29
第一个问题找到原因了,拼写错误。
第二个问题不知怎么解决了。
freecode 2008-10-29
居然用runjetty插件就是报第二个错误,采用eclipse server方式,用tomcat作为server,正常运行。
Global site tag (gtag.js) - Google Analytics