栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

tomcat发布web service教程

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

tomcat发布web service教程

此命令会直接把需要的包导入到${tomcat}sharedlib目录下,其实也就是把jaxws RI lib下的包复制到了tomcat安装目录下sharedlib里面。

3、设置Eclipse中的tomcat


由于eclipse是自己定义的tomcat配置文件,所以需要加些东西,把sharedlib加入进来,打开ctalina.properties文件。

打开后为(节选):

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. List of comma-separated packages that start with or equal this string will cause a security exception to be thrown when passed to checkPackageAccess unless the corresponding RuntimePermission (“accessClassInPackage.”+package) has been granted.

package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.

List of comma-separated packages that start with or equal this string will cause a security exception to be thrown when passed to checkPackageDefinition unless the corresponding RuntimePermission (“defineClassInPackage.”+package) has been granted. by default, no packages are restricted for definition, and none of the class loaders supplied with the JDK call checkPackageDefinition.

package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.

List of comma-separated paths defining the contents of the “common” classloader. Prefixes should be used to define what is the repository type. Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. If left as blank,the JVM system loader will be used as Catalina’s “common” loader. Examples: “foo”: Add this folder as a class repository “foo/*.jar”: Add all the JARs of the specified folder as class repositories “foo/bar.jar”: Add bar.jar as a class repository

common.loader= c a t a l i n a . h o m e / s h a r e d / l i b / ∗ . j a r , {catalina.home}/shared/lib/*.jar, catalina.home/shared/lib/∗.jar,{catalina.home}/shared/lib, c a t a l i n a . b a s e / l i b , {catalina.base}/lib, catalina.base/lib,{catalina.base}/lib/.jar, c a t a l i n a . h o m e / l i b , {catalina.home}/lib, catalina.home/lib,{catalina.home}/lib/.jar

找到common.loader配置项增加KaTeX parse error: Undefined control sequence: * at position 28: …me}/shared/lib/̲*̲.jar,{catalina.home}/shared/lib 这两个路径即可

4、建立项目


新建一个web项目,webservice_web,目录结构如下 《大厂前端面试题解析+Web核心总结学习笔记+企业项目实战源码+最新高清讲解视频》无偿开源 徽信搜索公众号【编程进阶路】

HelloService.java是提供web service的一个接口,代码如下:

package com.zxuqian.webservice;

import javax.jws.WebMethod;

import javax.jws.WebService;

@WebService

public interface HelloService {

@WebMethod

String greetings (String name);

}

HelloServiceImpl.java是实现类,代码如下:

package com.zxuqian.webservice.impl;

import javax.jws.WebService;

import com.zxuqian.webservice.HelloService;

@WebService (endpointInterface = “com.zxuqian.webservice.HelloService” )

public class HelloServiceImpl implements HelloService {

@Override

public String greetings(String name) {

return "Hello: " + name;

}

}

5、添加sun-jaxws.xml
zxuqian.webservice.HelloService" )

public class HelloServiceImpl implements HelloService {

@Override

public String greetings(String name) {

return "Hello: " + name;

}

}

5、添加sun-jaxws.xml

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/863284.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号