Category - IT技术

java eclipse exception    2017-07-19 21:18:39    968
错误信息(我的错误类似,网络copy):

java.lang.Error: Unresolved compilation problems: 
The import javax.servlet.ServletContext cannot be resolved
The import javax.servlet.http.HttpSession cannot be resolved
The import javax.servlet.http.HttpSessionEvent cannot be resolved
The import javax.servlet.http.HttpSessionListener cannot be resolved
HttpSessionListener cannot be resolved to a type
ServletContext cannot be resolved to a type
HttpSessionEvent cannot be resolved to a type
HttpSession cannot be resolved to a type
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
HttpSessionEvent cannot be resolved to a type
HttpSession cannot be resolved to a type




解决办法:
    原因有很多,解决办法也很多,参考地址:
        http://www.360doc.com/content/12/1015/17/4152160_241639166.shtml
        http://blog.csdn.net/chl
eclipse tomcat    2017-07-19 21:17:19    817
提示,此代码所在的都是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

docker    2017-07-19 21:06:10    818

Docker原错误:

ERROR: rpc error: code = 2 desc = "oci runtime error: could not synchronise with container process: not a directory"


分析原因:
应该是本地映射的目录在container中不存在导致的
看到github上有相同的错误:https://github.com/docker/docker/issues/23474

解决办法:
   检查本地映射的目录与container中的目录一致性(或者是否存在)
 
 

 

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

docker consul registrator    2017-07-19 21:01:41    1162

参考文章:http://gliderlabs.com/registrator/latest/user/quickstart/

 

Consul是强一致性的数据存储,使用gossip形成动态集群。它提供分级键/值存储方式,不仅可以存储数据,而且可以用于注册器件事各种任务,从发送数据改变通知到运行健康检查和自定义命令,具体如何取决于它们的输出

Registrator通过检查容器在线或者停止运行状态自动注册和去注册服务,它目前支持etcd、Consul和SkyDNS 2

 

单机运行 consul服务


# docker run -d -p 8400:8400 -p 8500:8500 -p 8600:53/udp --name node4  gliderlabs/consul-server:0.6 -bootstrap -advertise 192.168.10.138

通过http API 查看consul服务

 

# curl 192.168.10.138:8500/v1/catalog/services 

{"consul":[]}

运行 Registrator

# docker run -d  --name=registrator  --net=host  --volume=/var/run/docker.sock:/tmp/docker.sock   gliderlabs/registrator:latest  consul://192.168.10.138:8500

 

Running Redis


# docker run -d -P --name=redis redis

测试Registrator配置是否有效


 
# curl 192.168.10.138:8500/v1/catalog/services 
 
{"consul":[],"redis":[]}


# curl 192.168.10.138:8500/v1/catalog/service/redis

[{"Node":"23dcba46458b","Address":"192.168.10.138","ServiceID":"localhost.localdomain:redis:6379","ServiceName":"redis","ServiceTags":[],"ServiceAddress":"","Servi
OpenVPN 网络 VPN    2017-07-19 20:59:48    5962

经过尝试,使用server的push命令,windows常常报错,比较无奈,配置如下
push "route 192.168.100.0 255.255.255.0 10.8.10.254"


Thu Jan 28 11:52:39 2016 NOTE: --user option is not implemented on Windows
Thu Jan 28 11:52:39 2016 NOTE: --group option is not implemented on Windows
Thu Jan 28 11:52:39 2016 OpenVPN 2.3.4 i686-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Jun  5 2014
Thu Jan 28 11:52:39 2016 library versions: OpenSSL 1.0.1h 5 Jun 2014, LZO 2.05
Thu Jan 28 11:52:39 2016 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Thu Jan 28 11:52:39 2016 Need hold release from management interface, waiting...
Thu Jan 28 11:52:39 2016 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Thu Jan 28 11:52:39 2016 MANAGEMENT: CMD 'state on'
Thu Jan 28 11:52:39 2016 MANAGEMENT: CMD 'log all on'
Thu Jan 28 11:52:39 2016 MANAGEMENT: CMD 'hold off'
Thu Jan 28 11:52:39 2016 MANAGEMENT: CMD 'hold release'
Thu Jan 28 11:52:40 2016 Control Channel 
17/26