Tag: 码头

嵌入式Jetty没有找到带注释的Servlet

简而言之:我有一个项目提供了一个包含带注释但没有web.xml的servlet的war artifact。 如果我尝试在码头使用战争,我总是只得到战争内容的目录列表,而不是servlet执行。 任何想法? 长话短说:我的servlets看起来像这样 package swa; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet( asyncSupported = false, urlPatterns={"/*"}) public class ServletX extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setContentType("text/html"); […]

带有Jetty + Jersey的Spring Boot始终显示404

我有一个奇怪的问题。 我使用Spring boot 1.3.3和mvc(不包括tomcat),jetty和jersey(JAX-RS注释)开发项目。 我的端点完美地运行从IDEA运行组装的java – 罐子.JAR。 但后来我试图使用spring-boot-maven-plugin中的可执行文件选项来制作我的JAR可执行文件。 我的项目仍然做出正确的请求,如果我从IDEA启动它,但编译的可执行文件.JAR总是发送404错误。 好的,我在JerseyConfig类中做了一些修改。 我替换了 packages(ru.finnetrolle.telebot.restful.JerseyConfig::class.java.`package`.name) 同 register(BroadcastResource::class.java) 和可执行JAR在我的开发人员的PC上正常工作。 但是,当我尝试在我的Linux服务器上组装它,并将simlink添加到init.d – 所有端点再次开始对所有请求说404。 如果我从本地和从远程主机请求,我有404。 我也补充一点 spring.jersey.application-path=/ server.servlet-path=/monitoring 到我的application.properties文件(我也使用Spring执行器),但没有任何变化 – 所有工作没有和不工作 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> </configuration> </plugin> 我也发现了一个问题描述我的问题,但没有帮助https://github.com/spring-projects/spring-boot/issues/3413 PS我正在使用Kotlin,但是这不应该影响这个

Spring MVC错误404错误的请求Kotlin

我正在使用Kotlin开发Spring MVC应用程序。 我有一个简单的表单,当我提交时,我得到错误404错误的请求 。 我使用的Jetty服务器和Intellij社区版 。我试过调试,但因为我从来没有调试过的Web应用程序,它不是那么有用。 web.xml中 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>frontDispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>frontDispatcher</servlet-name> <url-pattern>/springkotlinmvc/*</url-pattern> </servlet-mapping> </web-app> frontDispatcher-servlet.xml中 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context = "http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:annotation-config/> <mvc:annotation-driven/> <context:component-scan base-package="org.manya.kotlin"/> <bean id="viewResolver" […]