`
yunnick
  • 浏览: 392018 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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>

 

分享到:
评论
2 楼 yunnick 2015-04-28  
maomide_fannao 写道
这个问题的根本原因不是找不到AxisAdminServlet class,因为如你所说,axis2里是有这个类的。根本原因是<load-on-startup>1</load-on-startup>

把load-on-startup配置在AxisServlet中,让它加载这个问题就能解决了,不需要打jar包

多谢回复,好久的问题了,一直没再用过。不过<load-on-startup>1</load-on-startup>配置是有的,ClassNotFoundException是因为在装载路径上没有发现class文件,配置是解决不了问题的吧。
1 楼 maomide_fannao 2015-04-27  
这个问题的根本原因不是找不到AxisAdminServlet class,因为如你所说,axis2里是有这个类的。根本原因是<load-on-startup>1</load-on-startup>

把load-on-startup配置在AxisServlet中,让它加载这个问题就能解决了,不需要打jar包

相关推荐

Global site tag (gtag.js) - Google Analytics