[转帖]WebLogic9环境下用Ant编译WebService出现异常及其解决_Tomcat, WebLogic及J2EE讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Tomcat, WebLogic及J2EE讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3355 | 回复: 0   主题: [转帖]WebLogic9环境下用Ant编译WebService出现异常及其解决        下一篇 
ganxinge
注册用户
等级:少校
经验:893
发帖:66
精华:0
注册:2013-2-22
状态:离线
发送短消息息给ganxinge 加好友    发送短消息息给ganxinge 发消息
发表于: IP:您无权察看 2013-2-22 15:22:03 | [全部帖] [楼主帖] 楼主

一个JAVA类,用WebLogic9支持的标志语法写的WebService类,代码大概如下:

......
// Import the standard JWS annotation interfaces
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
// Import the WebLogic-specific JWS annotation interface
import weblogic.jws.WLHttpTransport;
// Standard JWS annotation that specifies that the portType nameof the Web
// Service is "BOLServicePortType", its public service name is"BOLService",
// and the targetNamespace used in the generated WSDL is "http://127.0.0.1"
@WebService(serviceName = "WebServiceDispatch", name ="WebServiceDispatchPortType", targetNamespace = "http://127.0.0.1")
// Standard JWS annotation that specifies this is adocument-literal-wrapped
// Web Service
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =SOAPBinding.Use.LITERAL, parameterStyle =SOAPBinding.ParameterStyle.WRAPPED)
// WebLogic-specific JWS annotation that specifies the context pathand service
// URI used to build the URI of the Web Service is"MOTOWebService/BOLService"
@WLHttpTransport(contextPath = "SinoairWS", serviceUri ="WebServiceDispatch", portName = "WebServiceDispatchPort")
public class WebServiceImpl {
      private Logger logger =Logger.getLogger(WebServiceImpl.class.getName());
      public WebServiceImpl() {
            PropertyConfigurator
            .configure("/bea/user_projects/domains/sinoair/properties/log4j.properties");
      }
      @WebMethod()
      public String getCustomerName(String c_code){
            String result =ControllerManager
            .ServiceDispatch("<EMISService><ServiceURL>ExpressCorporationQueryService</ServiceURL><ServiceData><C_CODE>"
            +c_code +"</C_CODE></ServiceData></EMISService>");
            logger.debug(result);
            return result;
      }
      ......
      @WebMethod()
      public int checkUserInfo(String username, Stringpassword) throws Exception {
            int result = 0;
            try {
                  UserSessionInfo userData = AuthenticationMgr.getUserInfo(username,password);
                  result = userData!=null?0:1;
                  catch(Exception ex) {
                        result =1;
                  }
                  return result;
            }
      }


然后用ant编译时,出现如下异常:

BUILD FAILED
D:\EMISApp\deploy\ws\build.xml:55:com.bea.util.jam.internal.javadoc.JavadocClassloadingException: Anerror ha
s occurred while invoking javadoc to inspect your source
files. This may be due to the fact that$JAVA_HOME/lib/tools.jar does
not seem to be in your system classloader. Onecommon case in which
this happens is when using the 'ant' tool, which uses aspecial
context classloader to load classes from tools.jar.
This situation elicits what is believed to a javadoc bug in theinitial
release of JDK 1.5. Javadoc attempts to use itsown context classloader
tools.jar but ignores one that may have already been set, whichleads
to some classes being loaded into two differentclassloaders. The
telltale sign of this problem is a javadoc error message sayingthat
'languageVersion() must return LanguageVersion - you might seethis
message in your process' output.
This will hopefully be fixed in a later release of JDK 1.5; if anew
version of 1.5 has become available, you might be able to solvethis
by simply upgrading to the latest JDK.
Alternatively, you can work around it by simply including
$JAVA_HOME/lib/tools.jar in the java -classpath
parameter. If you are running ant, you will needto modify the standard
ant script to include tools.jar in the -classpath.


处理过程:
上网搜索,无果。有一些人遇到相同的问题,在网上发了贴子,无人回复;有回复,就是按照上述错误的说明,把$JAVA_HOME/lib/tools.jar加到classpath中,结果在这儿仍然还是编译不过的。
后来只能用排除法,一行行代码的删除,终于找到:原来是代码写的不正确,“catch(Exception ex){”这一行少一个“}”号,正确格式应该是“}catch(Exception ex){”但编译时它根本不报编译错,却报环境错,所以让人绕了一大圈。
希望有碰到相同问题的同学们反省一下,认真检查一下自己的代码是否写的正确。




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论