ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet

昨天,学习Axis2使用,机器环境是eclipse Helios + JDK1.6 + tomcat6.0 + Axis2_1.6.2。

在Windows --> preferences --> Web Services --> Axis 2 Preferences 配置好了Axis2 runtime location。创建WebService,然后启动服务器时报错:

 

java.lang.ClassNotFoundException:org.apache.axis2.transport.http.AxisAdminServlet

 

网上找的解决方案行不通,如下:


 Go to the web.xml of your web project replace the below line

replace

<servlet>
    <display-name>Apache-Axis Admin Servlet Web Admin</display-name>
    <servlet-name>AxisAdminServlet</servlet-name>
    <servlet-class>org.apache.axis2.transport.http.AxisAdminServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>

    with

<servlet>
    <display-name>Apache-Axis Admin Servlet Web Admin</display-name>
    <servlet-name>AxisAdminServlet</servlet-name>
    <servlet-class>org.apache.axis2.webapp.AxisAdminServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>

   

解决方法:

后来在Axis2的解压包里发现了几个.class文件,路径为:WEB-INF\classes\org\apache\axis2\transport\http

竟然有AxisAdminServlet.class,于是将这几个文件打成.jar包,放到工程里面,再重新启动,可以正常启动成功了!

 

 

web.xml最终配置:

<web-app>
    <display-name>Apache-Axis2Test</display-name>
    <servlet>
        <servlet-name>AxisServlet</servlet-name>
         <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>AxisAdminServlet</servlet-name>
        <servlet-class> org.apache.axis2.webapp.AxisAdminServlet</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/servlet/AxisServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>*.jws</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisAdminServlet</servlet-name>
        <url-pattern>/axis2-admin/*</url-pattern>
    </servlet-mapping>
    
    <mime-mapping>
        <extension>inc</extension>
        <mime-type>text/plain</mime-type>
    </mime-mapping>

   <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>index.html</welcome-file>
      <welcome-file>/axis2-web/index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
      <error-code>404</error-code>
      <location>/axis2-web/Error/error404.jsp</location>
    </error-page>

    <error-page>
        <error-code>500</error-code>
        <location>/axis2-web/Error/error500.jsp</location>
    </error-page>
</web-app>

 

你可能感兴趣的:(axis2)