现在想用eclipse搭建ssh框架,不知道是否需要用ant打包部署!求解惑!

解决方案 »

  1.   

    ant
    用熟了可能对你部署有好的帮助 不熟的话 可能会更麻烦
      

  2.   

    可是它启动的时候总是报这种错误2010-12-24 11:13:27 org.apache.catalina.core.AprLifecycleListener init
    信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.6.0_05\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Program Files/Java/jre6/bin/client;D:/Program Files/Java/jre6/bin;D:/Program Files/Java/jre6/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Yuguo;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;D:\Program Files\Microsoft SQL Server\90\DTS\Binn\;D:\Program Files\Microsoft SQL Server\90\Tools\binn\;D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;;D:\Program Files\Microsoft SQL Server\100\Tools\Binn\;D:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;D:\Program Files\MySQL\MySQL Server 5.1\bin;D:\Program Files\Java\jdk1.6.0_05\bin
    2010-12-24 11:13:27 org.apache.coyote.http11.Http11Protocol init
    信息: Initializing Coyote HTTP/1.1 on http-8080
    2010-12-24 11:13:27 org.apache.catalina.startup.Catalina load
    信息: Initialization processed in 514 ms
    2010-12-24 11:13:27 org.apache.catalina.core.StandardService start
    信息: Starting service Catalina
    2010-12-24 11:13:27 org.apache.catalina.core.StandardEngine start
    信息: Starting Servlet Engine: Apache Tomcat/6.0.10
    2010-12-24 11:13:28 org.apache.catalina.core.StandardContext listenerStart
    严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
    java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3770)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:448)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    2010-12-24 11:13:28 org.apache.catalina.core.StandardContext listenerStart
    严重: Skipped installing application listeners due to previous error(s)
    2010-12-24 11:13:28 org.apache.catalina.core.StandardContext start
    严重: Error listenerStart
    2010-12-24 11:13:28 org.apache.catalina.core.StandardContext start
    严重: Context [/struts_spring_hibernate] startup failed due to previous errors
    2010-12-24 11:13:28 org.apache.coyote.http11.Http11Protocol start
    信息: Starting Coyote HTTP/1.1 on http-8080
    2010-12-24 11:13:28 org.apache.jk.common.ChannelSocket init
    信息: JK: ajp13 listening on /0.0.0.0:8009
    2010-12-24 11:13:28 org.apache.jk.server.JkMain start
    信息: Jk running ID=0 time=0/27  config=null
    2010-12-24 11:13:28 org.apache.catalina.startup.Catalina start
    信息: Server startup in 492 ms
    这是我的web.xml配置
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
    </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: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="com.mysql.jdbc.Driver">
    </property>
    <property name="url" value="jdbc:mysql:///events"></property>
    <property name="username" value="root"></property>
    <property name="password" value="huying"></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.MySQLDialect
    </prop>
    </props>
    </property>
    </bean></beans>请问这是为什么呢?
      

  3.   

    java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener不是没有springframework这个包就是你的spring版本不对。这个经常会发生。
      

  4.   

    把 spring2.5 包打进去 
      

  5.   

    加载不到org.springframework.web.context.ContextLoaderListener,那说明是没有org.springframework.web包,你把这个包导进去,就能在包里找到ContextLoaderListener.class了.以后遇到这种问题,你应该根据所提示的不能加载到路径去找一下,看在你工程中能不能找到或者是有没有写错。这样你就能知道是怎么错了。
      

  6.   

    现在弄好了,不是包的问题,不过还是不知道为什么会这样。开始建了一个用户库,然后引用进来的,这样就报错了,后来上网找答案,有人说直接把ssh jar包拷贝到lib下不要自己建库就可以了。果然就是这个问题,照他的方法做就好了,太悲剧了!