使用Maven构建Java 8项目时:
mvn clean package
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
Java HotSpot(TM)64位服务器VM警告:忽略选项MaxPermSize = 128m; 支持在8.0中删除
如何删除此邮件?
我正在尝试使用JAXB将XML数据反序列化为Java内容树,在解组时验证XML数据:
try {
JAXBContext context = JAXBContext.newInstance("com.acme.foo");
Unmarshaller unmarshaller = context.createUnmarshaller();
unmarshaller.setSchema(schema);
FooObject fooObj = (FooObject) unmarshaller.unmarshal(new File("foo.xml"));
} catch (UnmarshalException ex) {
ex.printStackTrace();
} catch (JAXBException ex) {
ex.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
当我使用Java 8构建项目时,它很好,但使用Java 11构建它失败并出现编译错误:
package javax.xml.bind does not exist
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
在构建Jenkins管道作业(Jenkins版本2.7.4)时,我收到此警告:
Using the ‘stage’ step without a block argument is deprecated
Run Code Online (Sandbox Code Playgroud)
我如何解决它?
管道脚本代码段:
stage 'Workspace Cleanup'
deleteDir()
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Bean Validation 1.1 支持的方法参数验证功能。例如,以下方法会触发第一个参数的验证,确保其有效:
public String generateOtp(@Valid TotpAuthenticatorForm form, BindingResult bindingResult)
Run Code Online (Sandbox Code Playgroud)
当我构建Spring Boot 2.7.7项目时一切正常,但构建Spring Boot 3.0.1项目失败并出现编译错误:
package javax.validation does not exist
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我正在尝试使用SOAP创建一条简单的消息:
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage message = mf.createMessage();
Run Code Online (Sandbox Code Playgroud)
当我使用Java 8构建项目时,可以,但是使用Java 11构建项目失败,并出现编译错误:
package javax.xml.soap does not exist
Run Code Online (Sandbox Code Playgroud)
如何解决此问题?
我使用SpotBugs Maven插件进行静态分析,我想从检查中排除目录。查看spotbugs:check 目标文档,似乎无法通过这种方式配置插件。我还检查了SpotBugs 过滤器文件的文档。
在Apache Maven PMD插件中,这可以通过使用excludeRoots参数来完成:
<excludeRoots>
<excludeRoot>target</excludeRoot>
</excludeRoots>
Run Code Online (Sandbox Code Playgroud)
是否可以从SpotBugs检查中排除目录?
我正在调试模式下运行 Tomcat Web 应用程序,并使用 YourKit 分析器查看最大的对象,我发现到目前为止最大的是com.lmax.disruptor.RingBuffer. 我认为这与 log4j 有关,它RingBuffer在内部使用异步报告。有什么方法可以减少该对象的内存占用吗?为什么这么大?
我正在尝试使用 Docker 文件在 Docker 容器中运行无头 Chrome 浏览器,但每当它尝试使用它执行自动化脚本时就会出现崩溃问题。
我尝试将 Chrome 驱动程序版本更改为 75 和 76,但 Chrome 浏览器版本出现问题。
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-setuid-sandbox");
chromeOptions.addArguments("disable-infobars");
chromeOptions.addArguments("--disable-extensions");
Run Code Online (Sandbox Code Playgroud) 我正在使用Spring AMQP开发一个消费者应用程序,它接收来自RabbitMQ的消息.宣布了一个主题交换.要连接到Rabbit,我创建一个空名称的队列,因为代理将提供自动队列名称,请参阅规范:
@Bean
public TopicExchange exchange() {
TopicExchange topicExchange = new TopicExchange(topicExchangeName);
topicExchange.setShouldDeclare(false);
return topicExchange;
}
@Bean
public Queue queue() {
return new Queue("", queueDurable, queueExclusive, queueAutoDelete, queueParameters);
}
@Bean
public Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(routingKey);
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用Spring Integration Java DSL 配置AMQP入站通道适配器时:
@Autowired
private Queue queue;
@Bean
public IntegrationFlow amqpInbound(ConnectionFactory connectionFactory) {
return IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, queue))
.handle(m -> System.out.println(m.getPayload()))
.get();
}
Run Code Online (Sandbox Code Playgroud)
我得到一个错误'queueName'不能为null或为空
2018-05-25 13:39:15.080 ERROR 14636 --- [erContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer …Run Code Online (Sandbox Code Playgroud)