在Tomcat 8中部署服务时遇到问题.出现以下错误:
引起:java.lang.NoSuchMethodError:javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String; 在org.apache.tomcat.websocket.server.WsServerContainer.(WsServerContainer.java:149)在org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)在org.apache.tomcat.websocket. server.WsSci.onStartup(WsSci.java:47)在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5244)在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ......还有10个
方法getVirtualServerName是在Servlet 3.1中引入的,MANIFEST.MF从我的servlet-apijar中提取后我得到了以下细节:
Specification-Title: Java API for Servlets
Specification-Version: 3.1
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet
Run Code Online (Sandbox Code Playgroud)
其中说它有3.1.那么这个错误还有其他原因吗?请帮忙
我们计划将我们的项目从Oracle JDK迁移到OpenJDK。我对此有一些疑问。
经过分析后,我发现OpenJDK will have a feature release every 6 months which is only supported until the next feature release.It's essentially a continuous stream of releases targeted to developers.现在的问题是迁移到OpenJDK是否是一个好主意。因为如果上述说法正确,则我们需要每6个月升级一次应用程序中的OpenJDK
进行此迁移需要进行哪些基本更改。当我说基本变更时,我的意思是我需要非常高级地理解。我知道的一件事是Oracle JDK和Open JDK具有不同的jar许可证。因此,是否需要像从Oracle JDK迁移到OpenJDK所提到的那样,用OpenJDK jar替换所有Oracle JDK jar ?
目前,我们正在使用:
感谢你的帮助。
谢谢
我需要一种方法,通过它我可以多次避免相同的查询执行.从代码的角度来看,我不需要任何帮助.高级方法会没问题.
目前我在不同的类中执行相同的hibernate查询,这些执行是同一请求的一部分.截至目前,我正在使用请求级缓存来存储数据.后来我从缓存而不是DB中获取这些数据以提高性能.但我想知道是否还有其他方法可以从上述方法中分离出来.
如果您可以提供帮助,将会非常有帮助.
谢谢
如何在java中将cidr转换为ip范围?我已经使用了apache SubnetUtils但忽略了该范围的第一个和最后一个值.
例如,对于CIDR 192.168.1.0/16,输出应为192.168.0.0至192.168.255.255.但我得到192.168.0.1到192.168.255.254.
请帮忙
我有一个关于 spring 依赖注入的问题。我需要知道依赖项是否按照 XML 中声明的顺序注入,或者没有这样的顺序。
例子 :
<bean id="empBean" class="com.test.EmployeeBean">
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="empAddress" ref="empAddress" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我们能保证alwaysjdbcTemplate会在之前初始化empName吗?请帮忙
我是 SprinBoot 的新手,我编写了一个简单的应用程序,它有一个控制器类。但是当我尝试从浏览器点击该控制器时,它给出了 HTTP-404 错误。它仅在添加@ComponentScan注释以加载该控制器后才开始工作。
我的问题是,即使我正在使用@SpringBootApplication,为什么我需要添加@ComponentScan注释?它不应该做同样的事情吗?
POM文件
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.springboottest</groupId>
<artifactId>springboot-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBoot Test App</name>
<description>SpringBoot Test App</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
Run Code Online (Sandbox Code Playgroud)
控制器 :
package com.test.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test")
public class MyController {
@RequestMapping("/sayHello")
public String testRequest() {
return "hello";
}
}
Run Code Online (Sandbox Code Playgroud)
主要方法:
package com.test.springboottest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication …Run Code Online (Sandbox Code Playgroud) 我对此有疑问Runtime.getRuntime().我正在运行以下代码.
public class TestMain {
public static void main(String[] args) {
Runtime rs = Runtime.getRuntime();
rs.exec("C:\\Windows\\System32\\sampleProgram.exe");
rs.exec("C:\\Windows\\System32\\sampleProgram2.exe");
rs.exec("C:\\Windows\\System32\\sampleProgram3.exe");
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如果sampleProgram需要更多时间来执行,控件是否会等待 sampleProgram完成,或者它将继续sampleProgram2执行并将并行运行?请帮忙.
目前在我的代码中我使用以下setter方法将当前日期和时间保存到DB.但它只保存日期,而不是时间.
emp.setJoiningDate(new java.sql.Date(System.currentTimeMillis()))
Run Code Online (Sandbox Code Playgroud)
方法声明:
setJoiningDate(java.sql.Date joiningDate) {
this.joiningDate= joiningDate;
}
Run Code Online (Sandbox Code Playgroud)
我不想更改参数类型(java.sql.Date).请帮忙
java ×8
spring ×2
cidr ×1
hibernate ×1
ip-address ×1
java-8 ×1
networking ×1
oracle ×1
runtime.exec ×1
servlets ×1
spring-boot ×1
tomcat8 ×1