给定一个本地Maven存储库,可以确定作为特定依赖关系源的远程存储库吗?怎么样?
为什么我的应用程序中的Log4j rootLogger没有根据级别过滤日志事件?在我log4j.properties,我有几个记录器:
log4j.rootLogger=info,stdout
log4j.logger.com.name.myapp=debug,myapp
log4j.logger.org.castor=debug,castor
log4j.logger.org.exolab.castor=debug,castor
log4j.logger.org.hibernate=debug,hibernate
log4j.logger.org.springframework=debug,spring
Run Code Online (Sandbox Code Playgroud)
每个记录器在级别DEBUG及以上接收和记录大量日志事件,这是我期望和期望的.的rootLogger,然而,尽管被设置为级别INFO,显示的是所有这些事件,也包括DEBUG事件,这不是我期待并没有什么,我的愿望.相反,我希望它来过滤DEBUG事件,但只显示在水平的事件INFO和较高的(WARN,ERROR,和FATAL),这也是我想要的.为什么rootLogger显示所有事件?
如何构建一个Springd引导jar文件,systemd可以直接将其作为服务执行?
遵循Installation作为systemd服务中的示例,我创建了以下systemd服务,该服务直接执行Spring Boot jarfile:
[Unit]
Description=CRS Self-certification Service
Documentation=
Requires=postgresql.service
After=postgresql.service
[Service]
Environment=LOADER_PATH='lib/,config/,/etc/opes/crs/selfcertification'
ExecStart=/opt/opes/crs/selfcertification/crs-selfcertification-1.0.0-SNAPSHOT.jar
Restart=always
RestartSec=10
User=crs
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
但是,启动此服务时,systemd抱怨jarfile不可执行:
Nov 29 10:57:59 ubuntu systemd[24109]: selfcertification.service: Failed at step EXEC spawning /opt/opes/crs/selfcertification/crs-selfcertification-1.0.0-SNAPSHOT.jar: Exec format error
Nov 29 10:57:59 ubuntu systemd[1]: selfcertification.service: Main process exited, code=exited, status=203/EXEC
Nov 29 10:57:59 ubuntu systemd[1]: selfcertification.service: Unit entered failed state.
Nov 29 10:57:59 ubuntu systemd[1]: selfcertification.service: Failed with result 'exit-code'.
Run Code Online (Sandbox Code Playgroud)
jarfile的权限为755(所有人均可执行):
administrator@ubuntu:~$ ls -la /opt/opes/crs/selfcertification/crs-selfcertification-1.0.0-SNAPSHOT.jar
-rwxr-xr-x …Run Code Online (Sandbox Code Playgroud) ClassCastException当独立JMS客户端应用程序尝试从JNDI提供程序检索连接工厂时,可能是以下原因?
Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.jms.ConnectionFactory
Run Code Online (Sandbox Code Playgroud)
这是JMS客户端的缩写版本,仅包含其start()和stop()方法.在方法的第一行上发生异常,该方法start()尝试从JNDI提供程序(远程LDAP服务器)检索连接工厂.JMS连接工厂和目标对象位于远程JMS服务器上.
class JmsClient {
private ConnectionFactory connectionFactory;
private Connection connection;
private Session session;
private MessageConsumer consumer;
private Topic topic;
public void stop() throws JMSException {
consumer.close();
session.close();
connection.close();
}
public void start(Context context, String connectionFactoryName, String topicName) throws NamingException, JMSException {
// ClassCastException occurs when retrieving connection factory.
connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryName);
connection = connectionFactory.createConnection("username","password");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
topic = …Run Code Online (Sandbox Code Playgroud) Hibernate是否在准备好的SQL语句中记录它分配给占位符的值?如何配置Log4j以便将这些值写入我的日志文件?
Akka如何处理相同类型但不同版本的不同版本消息的序列化?例如,期望消息A的版本1的Actor X是否可以从具有额外字段的Actor Y接收并处理消息A的版本2?它如何处理消息A的版本3可能已删除或重命名字段的情况?
如何将Eclipse类路径变量从打开的工作区复制到新工作区?我正在使用Eclipse Juno(Eclipse Platform 4.2.1和Eclipse Java Development Tools 3.8.2).
Ansible剧本如何在一系列任务上循环播放?我希望实现一个轮询循环,该循环执行任务序列,直到任务成功为止。当失败时,异常处理程序将尝试修复条件,然后循环将重复任务序列。
考虑以下虚构示例:
- action:
- block:
- debug: msg='i execute normally'
- command: /bin/foo
rescue:
- debug: msg='I caught an error'
- command: /bin/fixfoo
always:
- debug: msg="this always executes"
register: result
until: result
retries: 5
delay: 10
Run Code Online (Sandbox Code Playgroud)