运行我的程序后,我在运行大约 2 小时后发生了奇怪的崩溃,说明它无法解析日期。
Text '2016-10-26T12:31:39.084726218Z' could not be parsed: Unable to obtain Instant from TemporalAccessor: {InstantSeconds=1477485099, NanoOfSecond=84726218},ISO of type java.time.format.Parsed
at java.time.format.DateTimeFormatter.createError(DateTimeFormatter.java:1919)
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会这样?因为在网上查找时,我发现这可能是由于格式不正确造成的,但由于我没有指定格式,所以对我来说情况并非如此。
解析我的时间戳的代码如下:
Instant instant = Instant.parse(cAdvisor.getTimestamp());
Long epoch = instant.getEpochSecond();
Run Code Online (Sandbox Code Playgroud)
注意:该cAdvisor.getTimestamp()方法返回一个字符串,例如:'2016-10-26T12:31:39.084726218Z'
注 2:我的 java 版本报告了这一点
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b115)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b57, mixed mode)
Run Code Online (Sandbox Code Playgroud)
更新 #1:以下代码复制了此问题:
import java.time.Instant;
import java.util.Random;
// one class needs to have a main() method
public class Test
{
// arguments are …Run Code Online (Sandbox Code Playgroud) 我经常看到结构是否像这样编码:
if (true == a)
if (false == a)
Run Code Online (Sandbox Code Playgroud)
为什么他们首先将常数值放在而不是变量?如在这个例子中:
if (a == true)
if (b == true)
Run Code Online (Sandbox Code Playgroud) 出于某种原因,当使用systemd单元文件时,我的docker容器会启动,但会立即关闭.我试过找到日志,但看不出有关为什么会发生这种情况的任何迹象.是否有人知道如何解决这个/找到显示正在发生的事情的日志?
注意:在使用docker start containername启动后手动启动它们然后它可以工作(当使用systemctl start nginx时)
经过一番挖掘后,我发现了这个错误:could not find udev device: No such device它可能与此有关吗?
单位服务档案:
[Unit]
Description=nginx-container
Requires=docker.service
After=docker.service
[Service]
Restart=always
RestartSec=2
StartLimitInterval=3600
StartLimitBurst=5
TimeoutStartSec=5
ExecStartPre=-/usr/bin/docker kill nginx
ExecStartPre=-/usr/bin/docker rm nginx
ExecStart=/usr/bin/docker run -i -d -t --restart=no --name nginx -p 80:80 -v /projects/frontend/data/nginx/:/var/www -v /projects/frontend: nginx
ExecStop=/usr/bin/docker stop -t 2 nginx
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
Journalctl输出:
May 28 11:18:15 frontend dockerd[462]: time="2015-05-28T11:18:15Z" level=info msg="-job start(d757f83d4a13f876140ae008da943e8c5c3a0765c1fe5bc4a4e2599b70c30626) = OK (0)"
May 28 11:18:15 frontend dockerd[462]: time="2015-05-28T11:18:15Z" level=info msg="POST /v1.18/containers/nginx/stop?t=2"
May 28 11:18:15 …Run Code Online (Sandbox Code Playgroud) 当我尝试在Chrome中控制一个对象的console.log时,它在console.log的第一行(你在那里看到我的posts数组长度为0的对象{small summary})(posts:Array [0]).
但是,当我展开帖子时,它显示它有27个项目(这是我需要的).
这种情况随机发生在我身上,我不知道为什么会发生这种情况,以前有人经历过这种情况吗?
截图:

更新:这种情况发生在所有浏览器中,因此可能与Chrome无关
当我尝试创建固定装置时,我100%确保它们是正确的,但是在尝试将它们加载到表名称时会给我错误。
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'DELETE FROM group':
Run Code Online (Sandbox Code Playgroud)
当然不能加载哪个,因为它缺少撇号(`)
有人知道为什么会这样吗?