Tomcat启动报错
启动日志:2009-11-6 21:39:13 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2009-11-6 21:39:13 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 578 ms
2009-11-6 21:39:13 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-11-6 21:39:13 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.0.30
2009-11-6 21:39:13 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2009-11-6 21:39:13 org.apache.catalina.core.StandardHost getDeployer
信息: Create Host deployer for direct deployment ( non-jmx ) 
2009-11-6 21:39:13 org.apache.catalina.core.StandardHostDeployer install
信息: Processing Context configuration file URL file:D:\server\Tomcat 5.0\conf\Catalina\localhost\admin.xml
2009-11-6 21:39:14 org.apache.catalina.core.StandardHostDeployer install
信息: Processing Context configuration file URL file:D:\server\Tomcat 5.0\conf\Catalina\localhost\balancer.xml
2009-11-6 21:39:14 org.apache.catalina.core.StandardHostDeployer install
信息: Processing Context configuration file URL file:D:\server\Tomcat 5.0\conf\Catalina\localhost\manager.xml
2009-11-6 21:39:15 org.apache.catalina.core.StandardHostDeployer install
信息: Installing web application at context path /jsp-examples from URL file:D:\server\Tomcat 5.0\webapps\jsp-examples
2009-11-6 21:39:15 org.apache.catalina.core.StandardHostDeployer install
信息: Installing web application at context path /servlets-examples from URL file:D:\server\Tomcat 5.0\webapps\servlets-examples
2009-11-6 21:39:15 org.apache.catalina.core.StandardHostDeployer install
信息: Installing web application at context path /sshtest from URL file:D:\server\Tomcat 5.0\webapps\sshtest
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.
2009-11-6 21:39:17 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-11-6 21:39:17 org.apache.catalina.core.StandardContext start
严重: Context startup failed due to previous errors2009-11-6 21:39:17 org.apache.catalina.core.StandardHostDeployer install
信息: Installing web application at context path /tomcat-docs from URL file:D:\server\Tomcat 5.0\webapps\tomcat-docs
2009-11-6 21:39:17 org.apache.catalina.core.StandardHostDeployer install
信息: Installing web application at context path /webdav from URL file:D:\server\Tomcat 5.0\webapps\webdav
2009-11-6 21:39:17 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2009-11-6 21:39:17 org.apache.jk.common.ChannelSocket init
信息: JK2: ajp13 listening on /0.0.0.0:8009
2009-11-6 21:39:17 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/63  config=D:\server\Tomcat 5.0\conf\jk2.properties
2009-11-6 21:39:17 org.apache.catalina.startup.Catalina start
信息: Server startup in 3657 ms
logs下的详细日志 就是找不到customerService2009-11-06 21:41:26 StandardContext[/sshtest]Initializing Spring root WebApplicationContext
2009-11-06 21:41:27 StandardContext[/sshtest]Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService' defined in ServletContext resource [/WEB-INF/spring/applicationContext-spring.xml]: Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition
代码文件
applicationContext-spring.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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<!--  bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean-->

<bean id="customerService"  lazy-init="default" autowire="default" dependency-check="default">
<property name="target">
<bean class="com.sshtest.service.impl.CustomerServiceImpl" lazy-init="default" autowire="default" dependency-check="default">
<property name="customerDAO">
<ref bean="CustomerDAO" /> 
</property>
</bean>
</property>
</bean></beans>
applicationContext-hibernate.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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@localhost:1521:hp">
</property>
<property name="username" value="hp"></property>
<property name="password" value="hp"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/test/hibernate/entity/Customer.hbm.xml</value>
</list>
</property>
</bean>

<bean id="CustomerDAO" class="com.sshtest.dao.impl.CustomerDAOImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
CustomerDAOImplpublic class CustomerDAOImpl extends HibernateDaoSupport implements CustomerDAO { public void delete(Integer id) {
// TODO Auto-generated method stub
this.getHibernateTemplate().delete(this.getCustomerById(id));
} public void save(Customer cus) {
// TODO Auto-generated method stub
this.getHibernateTemplate().save(cus);
}
public void update(Integer id) {
// TODO Auto-generated method stub
this.getHibernateTemplate().update(this.getCustomerById(id));
} public Customer getCustomerById(Integer id) {
// TODO Auto-generated method stub
return (Customer) this.getHibernateTemplate().get(Customer.class, id);
} public Customer getCustomerByLoginId(String loginId) {
// TODO Auto-generated method stub
String hql="from Customer c where c.loginId = ?";
List <Customer> list=this.getHibernateTemplate().find(hql);
Customer cus = list.get(0);
return cus;
}
}
CustomerServiceImplpublic class CustomerServiceImpl implements CustomerService { private CustomerDAO dao;

public void addUser(Customer user) {
// TODO Auto-generated method stub
dao.save(user);
} public boolean checkLogin(String loginId, String pass) {
// TODO Auto-generated method stub
Customer cus=dao.getCustomerByLoginId(loginId);

if(cus!=null && cus.getPassword().equals(pass))
return true;

return false;
} public Customer getCustomer(Integer id) {
// TODO Auto-generated method stub
return dao.getCustomerById(id);
} public void setCustomerDao(CustomerDAO dao) {
// TODO Auto-generated method stub
this.dao=dao;
}
}

解决方案 »

  1.   

    logs下的详细日志 就是找不到customerService<bean id="customerService"  lazy-init="default" autowire="default" dependency-check="default">
            
        </bean>
    customerService只有ID  怎么没有class呢?
      

  2.   


    我那么写不行吗  我class在下面那航配置的  而且按照你说的拿到上面来也不好用  能加个好友帮我看看吗  谢谢了  Q949246452
      

  3.   

    application-spring.xml
    已改成
    <bean  id="customerService" class="com.sshtest.service.impl.CustomerServiceImpl" >
    <property name="CustomerDAO">
    <ref bean="CustomerDAO" /> 
    </property>
    </bean>