Tag - tomcat

java 虚拟主机 tomcat    2017-07-19 21:58:58    851
其实表象类似CNAME

1、修改文件conf/server.xml:
在engine中添加如下:
<Host appBase="F:\apache-tomcat-7.0.54\webapps2" autoDeploy="true" name="test1" unpackWARs="true"></Host>
其中,name为域名
appBase是访问此域名的时候,指向的web存放的根目录

2、通过页面管理添加,tomcat首页找到Host Manager,进行添加


如此即可


 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

jenkins docker tomcat java restful shell    2017-07-19 21:50:48    760

前提:jenkins是装在CentOS6.7中,同时,我的这台linux上面安装有docker


一、项目代码:

项目主要是jersey 1.x 版本的maven项目,重点在与我在项目中放置了tomcat,以及使用maven对tomcat进行解压,并将项目打包的文件放置到项目中,那么项目信息就不多写了,把maven配置信息重点写出来吧:

    <build>
        <finalName>testjersey</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>copy-package</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>

                                <unzip dest="target/apache/">
                                    <fileset dir="${basedir}">
                                        <include name="apache-tomcat-7.0.68.zip" />
                               
eclipse tomcat    2017-07-19 21:17:19    776
提示,此代码所在的都是rest接口(web项目)中,而不是在普通的Test类或者是main方法中

重现:

    @GET
    public Response sayHello(@Context HttpServletRequest request,
            @Context HttpServletResponse response){
        File file=new File("repository/configuration.xml");
        URI uri = file.toURI();
        System.out.println(uri);
        return Response.ok().status(200).build();
    }


返回结果为:
file:/E:/works/eclipse-jee-mars-2-win32-x86_64/eclipse/repository/configuration.xml

而我要获取的是tomcat下的目录,如我上端代码,直接启动tomcat运行获取到的是:
file:/N:/works/IDE/apache-tomcat-7.0.54-windows-x86/apache-tomcat-7.0.54/bin

那么就要修改配置,让在eclipse中也获取此目录

解决办法:
1、双击Servers下的tomcat

2、将会打开eclipse中的tomcat配置界面,然后点击“Open launch configuration”


3、打开标签页Arguments,选择“Working  directory“为Other,填入如下值:
    N:\works\IDE\apache-tomcat-7.0.54-windows-x86\apache-tomcat-7.0.54\bin
    然后保存即可
如图:


修改过后,再在eclipse中启动tomcat,运行此代码获取到的就是和tomcat运行时获取的目录相同了




 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
ma