小编gaj*_*ajo的帖子

Tomcat无法启动:java.net.BindException:无法分配请求的地址

当我启动Tomcat的语言环境实例时,我收到以下错误:

    SEVERE: StandardServer.await: create[8005]: 
    java.net.BindException: Cannot assign requested address: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
    at java.net.ServerSocket.bind(ServerSocket.java:319)
    at java.net.ServerSocket.<init>(ServerSocket.java:185)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:662)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:614)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Run Code Online (Sandbox Code Playgroud)

我在论坛上看到人们有同样的问题.Netstat未显示正在使用的端口8080,8005或8009.我试图改变端口,但我得到了同样的错误.我还检查了Windows\System32\drivers\etc中的hosts文件和该行

127.0.0.1       localhost
Run Code Online (Sandbox Code Playgroud)

没有评论.我没有更改server.xml中的任何内容,因为昨天我无法让它工作.有任何想法吗?

编辑:

<Server port="8005" shutdown="SHUTDOWN">

Connectors:
 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000" 
               redirectPort="8443" />

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

tomcat

10
推荐指数
3
解决办法
3万
查看次数

使用@POST或@PUT使用@QueryParam

我正在使用针对apache Tomcat的一些REST Web服务的jersey API.我需要将多个参数传递给方法,所以我决定使用@QueryParam注释,如下所示:

@GET
@Path("/date")
@Produces(MediaType.APPLICATION_JSON)
public Response getDate(@QueryParam("id") String Id, @QueryParam("inDate") String inDate)
{
...
}
Run Code Online (Sandbox Code Playgroud)

当我这样称它时一切正常.但是当我使用注释@POST或@PUT而不是@GET时,它会显示错误:

HTTP状态405 - 不允许的方法

消息方法不允许

description对于请求的资源,不允许使用指定的HTTP方法(Method Not Allowed).

是否可以使用POST或PUT进行此操作以及如何使用?

任何帮助表示赞赏.

java rest jersey

8
推荐指数
1
解决办法
2万
查看次数

Spring boot 1.2.1没有为依赖项找到类型的限定bean

我已经从春季启动版本1.1.5升级到1.2.1,现在我得到了NoSuchBeanDefinitionException.

我有简单的主要课程

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
Run Code Online (Sandbox Code Playgroud)

后来我有了回购

@Repository
public interface UserRepository extends MongoRepository<User, String>, UserRepositoryCustom {

   ...


}
Run Code Online (Sandbox Code Playgroud)

定制回购

public interface UserRepositoryCustom {
    // custom methods
}
Run Code Online (Sandbox Code Playgroud)

和impl类.

在将spring boot版本更新到1.2.1之前,一切都按预期工作.我已阅读https://github.com/spring-projects/spring-boot/issues/2237并尝试删除@Repository注释但未成功.我错过了什么吗?Thnx寻求帮助

编辑堆栈跟踪:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.example.respositories.UserRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308) …
Run Code Online (Sandbox Code Playgroud)

spring spring-data-mongodb spring-boot

0
推荐指数
1
解决办法
9322
查看次数

标签 统计

java ×1

jersey ×1

rest ×1

spring ×1

spring-boot ×1

spring-data-mongodb ×1

tomcat ×1