【问题标题】:Create web service using Eclipse使用 Eclipse 创建 Web 服务
【发布时间】:2010-12-20 17:39:04
【问题描述】:

我正在尝试使用 Axis2 下的 eclipse javaEE 创建我的第一个 web 服务, 我正在关注这个教程eclipse tutorial 学习如何制作它。我制作了 Web 服务,但是当我想通过 URL 查看它来确保已经部署了 ws 时,会出现 HTTP 状态 400。我怎么知道错误是什么? 这就是我所做的:

  • 我在首选项 [ant、axis2、tomcat 和 java] 中进行设置。
  • 新 -> 新动态网页
  • new ->java(我创建了我想转换为ws的类)
  • 新 -> 网络服务(我想创建自下而上的 ws)。
  • 在浏览器的url中输入http://localhost:8080/Axis2/services/listservices

这会返回 HTTP 状态 404 - /services/listservices

有人能告诉我怎么知道错误是什么吗?或者我该如何定义?

编辑: Eclipse 控制台中发生异常:

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

我应该怎么做,在配置中我指定axis2和eclipse显示在哪里

Axis2 runtime loaded successfully

创建新工作空间并再次创建 webservice 后,控制台中出现的输出是这样的

 Dec 20, 2010 8:32:04 PM org.apache.catalina.core.AprLifecycleListener init
 INFO: The APR based Apache Tomcat Native library which allows optimal performance in 
production environments was not found on the java.library.path: C:\Program      
 Files\Java\jdk1.6.0_18\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;F:/alaa college/year 4/1st   
 semester/Advance sw/Libraries/eclipse/jre/bin/client;F:/alaa college/year 4/1st    
semester/Advance sw/Libraries/eclipse/jre/bin;D:\app\AloOoSh\product\11.1.0\db_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_18\bin;%ANT_HOME%\bin;%AXIS2_HOME%\bin;%CATALINA_HOME%\bin;C:\Program Files\MATLAB\R2008a\bin;C:\Program Files\MATLAB\R2008a\bin\win32;
Dec 20, 2010 8:32:05 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source'     
to 'org.eclipse.jst.jee.server:testFirst' did not find a matching property.
 Dec 20, 2010 8:32:05 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 20, 2010 8:32:05 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 401 ms
Dec 20, 2010 8:32:05 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina

Dec 20, 2010 8:32:05 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
[INFO] Deploying module: addressing-1.4 -     file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testF
 irst/WEB-INF/modules/addressing-1.4.mar
[INFO] Deploying module: metadataExchange-1.4 -    
 file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/mex-1.4.mar
 [INFO] Deploying module: ping-1.4 -    
 file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/ping-1.4.mar
 [INFO] Deploying module: script-1.4 -  file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/scripting-1.4.mar
 [INFO] Deploying module: smtpfault - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/smtpfault.mar
[INFO] Deploying module: soapmonitor-1.4 - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/soapmonitor-1.4.mar
 [INFO] Deploying Web service: Converter - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/services/Converter/
[INFO] Deploying Web service: version.aar - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/services/version.aar
 Dec 20, 2010 8:32:06 PM org.apache.coyote.http11.Http11Protocol start
 INFO: Starting Coyote HTTP/1.1 on http-8080
 Dec 20, 2010 8:32:06 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 20, 2010 8:32:06 PM org.apache.jk.server.JkMain start
 INFO: Jk running ID=0 time=0/19  config=null
Dec 20, 2010 8:32:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1383 ms

【问题讨论】:

    标签: java web-services eclipse


    【解决方案1】:

    这是我自己创建 web 服务并在 android 中使用该服务的帖子。它的 正常工作。

    在下面的链接中尝试一次

    http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/#comment-179

    【讨论】:

      【解决方案2】:

      发生 404 错误是因为所需的 url 上没有任何内容。所以你的部署肯定有问题。

      您是否在 Eclipse 中设置了服务器并实际发布了 WS?请注意,这与从计算机上其他位置的目录运行 Tomcat 不同!您可以通过选择 New => Server 添加服务器实例。

      如果服务器配置正确,则服务器输出应该出现在 eclipse 的控制台中,如果您的 WS 设置有任何问题,应该有错误消息可以用来追踪问题。

      【讨论】:

      • @weltraumpirat - 是的,控制台中有一个异常,它是关于axis2的。你能检查一下编辑部分吗。
      • 这绝对是配置问题。据我了解,AdminServlet 不是核心 Axis2 运行时的一部分。您是在 Web 服务中将 Axis2 部署为库,还是单独安装在服务器上?您需要相应地设置类路径。如果您还没有做很多更改,只需返回您的教程并确保您已完成正确设置 Axis2 的所有必要步骤。这应该比尝试查找错误要快得多。
      • 我创建了新的工作空间并创建了新的 Web 服务,没有发生错误但它没有在 URK 上运行:(
      • 你能从控制台发布整个输出吗?否则问题很难追查。
      • 这似乎是唯一奇怪的消息:2010 年 12 月 20 日晚上 8:32:05 org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine /Host/Context} 将属性 'source' 设置为 'org.eclipse.jst.jee.server:testFirst' 没有找到匹配的属性。
      【解决方案3】:

      您可能将axis2.war(重命名为app.zip)的内容提取到了错误的文件夹中,或者将文件部署到了错误的文件夹中。直接在您部署的 app.war 文件夹下查找 WEB-INF 文件夹。如果您有另一个 WEB-INF 文件夹用于轴 2 提取的文件夹,则 JBoss 无法找到它们。 WEB-INF 文件夹必须是作为第一级后代的文件夹。以及以下文件夹:axis2-web、META-INF 和 org。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-26
        • 1970-01-01
        • 2012-07-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多