docker    2017-07-19 21:23:55    525
修改文件

# vi /usr/lib/systemd/system/docker.service

修改为如下方式
[Unit]
Description=Docker Application Container Engine
After=network.target docker.socket
Requires=docker.socket

[Service]
Type=notify
ExecStart=/usr/bin/docker daemon --tls=false -H unix:///var/run/docker.sock  -H tcp://0.0.0.0:2375
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

重载配置文件:
    # systemctl daemon-reload

重启Docker
    # systemctl restart docker


 


 

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

java xwiki restful    2017-07-19 21:22:41    536

xwiki测试流程

  1. 测试页面
  1. public void normalTest()throws Exception, IOException{
  2. CloseableHttpClient httpclient = HttpClients.createDefault();
  3. JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
  4. Unmarshaller unmarshaller = context.createUnmarshaller();
  5. HttpUriRequest httpPost = RequestBuilder.get()
  6. .setUri(new URI("http://172.16.200.220:8082/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome"))
  7. .setHeader("Accept", "application/xml").build();
  8. CloseableHttpResponse response = httpclient.execute(httpPost);
  9. System.out.println(response.getEntity());
  10. HttpEntity responseEntity=response.getEntity();
  11. Page page = (Page) unmarshaller.unmarshal(responseEntity.getContent());
  12. System.out.println(new Gson().toJson(page));
  13. }
  1. 登录并获取session
  1. public void testLogin() throws Exception{
  2. CloseableHttpClient httpclient =
HttpClient java xml    2017-07-19 21:20:57    502


介绍:我现在有一个对象page,需要将page对象转换为xml格式并以binary方式传输到服务端
其中涉及到的技术点有:
1、对象转xml流
2、输出流转输入流
3、httpClient发送二进制流数据

POM文件依赖配置
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.5.2</version>
		</dependency>
		
		<dependency>
		  <groupId>org.apache.httpcomponents</groupId>
		  <artifactId>httpmime</artifactId>
		  <version>4.5.2</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.4</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.2.4</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.xwiki.platform</groupId>
			<artifactId>xwiki-platform-rest-model</artifactId>
			<version>7
java eclipse exception    2017-07-19 21:18:39    572
错误信息(我的错误类似,网络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    506
提示,此代码所在的都是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

30/47