How to interpret the error “java.lang.IllegalArgumentException: java.text.ParseException: End of header”





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















This is almost a duplicate but I find the answer on that link to be somewhat illegitimate, because the program was fixed by changing a get request to a post request with the path '..../get'.



I'm receiving the error below. I don't know what I should be looking to fix based on this error. None of the files mentioned in the error were written by me and I assume that they are files in packages I have installed.



Other solutions have recommended that I include the line import org.springframework.context.ApplicationContext or update my maven project. I remember reading somewhere that I might need to set my CATALINA_HOME variable, which I set in my bashrc, and that also didn't work. Using mvn dependency resolve followed by mvn clean install and updating my maven project also did not work.



I would like to know how to find out where I should look based on this error. I don't know what it's telling me, other than there is some illegal argument somewhere and that some header ends.



The error occurs when I restart my tomcat server in eclipse.



enter image description here





UPDATE



I ended up ditching this project and started a new project using javaspark instead. I'm still curious what people have to say about how they would debug this. To me there's almost nothing intuitive about the error message I was given, and the only things I can think to do would be to do more general research into maven and CATALINA to get a better understanding of them, but I doubt that doing this would make the errors obvious to me.



From a strictly theoretical point of view, what would be your first steps after reading these errors(other than copying and pasting the error into a search engine).





Error



Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalArgumentException: java.text.ParseException: End of header
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:289)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
... 53 more

Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [Jersey Web Application] in web application [/RestServer] threw load() exception
java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)




ServerInRest.java



    package serverPackage;

import java.io.IOException;
import java.util.LinkedList;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;

import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.context.ApplicationContext;


@Path("/serverinrest")
public class ServerInRest {

//All the chatrooms available on this server
protected LinkedList<MyChatroom> chatRooms = new LinkedList<MyChatroom>(); //All the chatrooms on this Server. This chatrooms list and the userlist and messagelist in the chatrooms are the only stateful part of this server.

/*
* Constructor for the server. Initializes the Chatroom list and JSON parser
*/
public ServerInRest() {
chatRooms = new LinkedList<MyChatroom>();
}

/* Receives a message that is stored in the chatrooms messages list, and sends this message to all users in that chatroom.
* @Param user The user who is sending the message
* @Param room The room the message is to be sent to
* @Param message The message to be sent
*/
@Path("/message")
@PUT
@Produces("Application/Json")
public JSONObject message(@RequestHeader("user") String user, @RequestHeader("room") String room, @RequestHeader("message") String message) throws IOException {
String header = "Message";
String response = "Sent";
MyChatroom c = this.roomObject(room);
c.addMessage(message, user);
return conToJson(header,response);
}

/* Removes a user named in the user list of the chatroom
* @Param user The user to be removed
* @Param room The room the user will be removed from
*/
@Path("/leave")
@PUT
@Produces("application/xml")
public JSONObject leaveRoom(@RequestHeader("user") String user, @RequestHeader("room") String room) throws IOException {
String header = "Left Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.removeUser(user);
return conToJson(header, response);
}

/* Adds a user to the user list of the chatroom
* @Param user The user to be added
* @Param room The room the user will be added to
*/
@Path("/join")
@PUT
@Produces("application/")
public JSONObject joinRoom(@RequestHeader("user") String user, @RequestHeader("room") String room){
String header = "Joined Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.addUser(user);
return conToJson(header, response);
}

/* Creates a room for this server and adds it to the servers room list
* @Param room The name of the room
*/
@Path("{r}")
@POST
@Produces("application/json")
public String createRooms(@RequestHeader("room") String room){
String header = "Created_room";
String response = room;
MyChatroom c = new MyChatroom(room);
chatRooms.add(c);
return "Created room" + response;//conToJson(header, response);
}

/* Lists the names of all the rooms on this server
* @return A string containing the names of all the rooms
*/
@GET
@Produces("application/json")
public JSONObject listRooms(@RequestHeader("user") String room) {
print("test1");
String rooms = "Available_Roomsn"; //% is used to determine if there needs to be user input or not
for (int j = 0; j < chatRooms.size(); j++) {
rooms = rooms + chatRooms.get(j).getName() + "n";
}
print("test3");
return conToJson("Rooms",rooms);
}

/* Takes a room name and returns the room object with that name
* @param room: A string containing the name of the chatroom
* @return A chatroom containing the same name as name
*/
private MyChatroom roomObject(String room) {
for (int i = 0; i < chatRooms.size(); i++) {
MyChatroom c = chatRooms.get(i);
if (c.getName().equals(room)) {
return c;
}
}
return null;
}

/**
* Lazy form of printing a string
* @param x The string to be printed
*/
private void print(String x) {
System.out.println(x);
}

/* Returns a JSONObject representation of a string
* @Param response: A string
* @Return A JSON representation of response
*/
private JSONObject conToJson(String header, String response) {
JSONObject j;
try {
j = new JSONObject();
j.put(header,response);
} catch (Exception e) {
System.out.println("test0");
return null;
}
return j;
}

}




pom.xml



<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>RestServer</groupId>
<artifactId>RestServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>

</plugins>
</build>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20170516</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>

</dependencies>
</project>









share|improve this question

























  • In the stack trace, I'm seeing a parsing error, media types, and HttpHeader. I suggest you check the incoming request; possibly, it is malformed.

    – Steve11235
    Jan 3 at 14:55











  • @Steve11235 This is printed before I make a request. It occurs when I restart my tomcat server. I've uploaded a screenshot of the only thing I do to start this server. I receive the same error also when I try to visit the url in my web browser by visiting http://localhost:8080/RestServer/serv/myserver

    – Jacob
    Jan 3 at 14:57













  • Now I see that in the stack trace. That is very odd. This sucks, but try stripping your class down to the bare minimum and get it running. Then, add back methods until the error occurs.

    – Steve11235
    Jan 3 at 15:02











  • @Steve11235 I"m doing that right now. I"m also getting a few dependency errors now ex, SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0 SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1 I was getting those before and thought I had fixed this part, but inevitably they returned.

    – Jacob
    Jan 3 at 15:32






  • 1





    You are mixing Spring MVC with Jersey. These two frameworks are not compatible nor the same. The annotation @RequestHeader is for Spring MVC. For Jersey, you would use @HeaderParam. The error is telling you that Jersey can't resolve all the parameters for the method. And the reason is because it doesn't recognize those annotations.

    – Paul Samsotha
    Jan 4 at 7:00


















1















This is almost a duplicate but I find the answer on that link to be somewhat illegitimate, because the program was fixed by changing a get request to a post request with the path '..../get'.



I'm receiving the error below. I don't know what I should be looking to fix based on this error. None of the files mentioned in the error were written by me and I assume that they are files in packages I have installed.



Other solutions have recommended that I include the line import org.springframework.context.ApplicationContext or update my maven project. I remember reading somewhere that I might need to set my CATALINA_HOME variable, which I set in my bashrc, and that also didn't work. Using mvn dependency resolve followed by mvn clean install and updating my maven project also did not work.



I would like to know how to find out where I should look based on this error. I don't know what it's telling me, other than there is some illegal argument somewhere and that some header ends.



The error occurs when I restart my tomcat server in eclipse.



enter image description here





UPDATE



I ended up ditching this project and started a new project using javaspark instead. I'm still curious what people have to say about how they would debug this. To me there's almost nothing intuitive about the error message I was given, and the only things I can think to do would be to do more general research into maven and CATALINA to get a better understanding of them, but I doubt that doing this would make the errors obvious to me.



From a strictly theoretical point of view, what would be your first steps after reading these errors(other than copying and pasting the error into a search engine).





Error



Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalArgumentException: java.text.ParseException: End of header
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:289)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
... 53 more

Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [Jersey Web Application] in web application [/RestServer] threw load() exception
java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)




ServerInRest.java



    package serverPackage;

import java.io.IOException;
import java.util.LinkedList;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;

import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.context.ApplicationContext;


@Path("/serverinrest")
public class ServerInRest {

//All the chatrooms available on this server
protected LinkedList<MyChatroom> chatRooms = new LinkedList<MyChatroom>(); //All the chatrooms on this Server. This chatrooms list and the userlist and messagelist in the chatrooms are the only stateful part of this server.

/*
* Constructor for the server. Initializes the Chatroom list and JSON parser
*/
public ServerInRest() {
chatRooms = new LinkedList<MyChatroom>();
}

/* Receives a message that is stored in the chatrooms messages list, and sends this message to all users in that chatroom.
* @Param user The user who is sending the message
* @Param room The room the message is to be sent to
* @Param message The message to be sent
*/
@Path("/message")
@PUT
@Produces("Application/Json")
public JSONObject message(@RequestHeader("user") String user, @RequestHeader("room") String room, @RequestHeader("message") String message) throws IOException {
String header = "Message";
String response = "Sent";
MyChatroom c = this.roomObject(room);
c.addMessage(message, user);
return conToJson(header,response);
}

/* Removes a user named in the user list of the chatroom
* @Param user The user to be removed
* @Param room The room the user will be removed from
*/
@Path("/leave")
@PUT
@Produces("application/xml")
public JSONObject leaveRoom(@RequestHeader("user") String user, @RequestHeader("room") String room) throws IOException {
String header = "Left Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.removeUser(user);
return conToJson(header, response);
}

/* Adds a user to the user list of the chatroom
* @Param user The user to be added
* @Param room The room the user will be added to
*/
@Path("/join")
@PUT
@Produces("application/")
public JSONObject joinRoom(@RequestHeader("user") String user, @RequestHeader("room") String room){
String header = "Joined Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.addUser(user);
return conToJson(header, response);
}

/* Creates a room for this server and adds it to the servers room list
* @Param room The name of the room
*/
@Path("{r}")
@POST
@Produces("application/json")
public String createRooms(@RequestHeader("room") String room){
String header = "Created_room";
String response = room;
MyChatroom c = new MyChatroom(room);
chatRooms.add(c);
return "Created room" + response;//conToJson(header, response);
}

/* Lists the names of all the rooms on this server
* @return A string containing the names of all the rooms
*/
@GET
@Produces("application/json")
public JSONObject listRooms(@RequestHeader("user") String room) {
print("test1");
String rooms = "Available_Roomsn"; //% is used to determine if there needs to be user input or not
for (int j = 0; j < chatRooms.size(); j++) {
rooms = rooms + chatRooms.get(j).getName() + "n";
}
print("test3");
return conToJson("Rooms",rooms);
}

/* Takes a room name and returns the room object with that name
* @param room: A string containing the name of the chatroom
* @return A chatroom containing the same name as name
*/
private MyChatroom roomObject(String room) {
for (int i = 0; i < chatRooms.size(); i++) {
MyChatroom c = chatRooms.get(i);
if (c.getName().equals(room)) {
return c;
}
}
return null;
}

/**
* Lazy form of printing a string
* @param x The string to be printed
*/
private void print(String x) {
System.out.println(x);
}

/* Returns a JSONObject representation of a string
* @Param response: A string
* @Return A JSON representation of response
*/
private JSONObject conToJson(String header, String response) {
JSONObject j;
try {
j = new JSONObject();
j.put(header,response);
} catch (Exception e) {
System.out.println("test0");
return null;
}
return j;
}

}




pom.xml



<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>RestServer</groupId>
<artifactId>RestServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>

</plugins>
</build>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20170516</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>

</dependencies>
</project>









share|improve this question

























  • In the stack trace, I'm seeing a parsing error, media types, and HttpHeader. I suggest you check the incoming request; possibly, it is malformed.

    – Steve11235
    Jan 3 at 14:55











  • @Steve11235 This is printed before I make a request. It occurs when I restart my tomcat server. I've uploaded a screenshot of the only thing I do to start this server. I receive the same error also when I try to visit the url in my web browser by visiting http://localhost:8080/RestServer/serv/myserver

    – Jacob
    Jan 3 at 14:57













  • Now I see that in the stack trace. That is very odd. This sucks, but try stripping your class down to the bare minimum and get it running. Then, add back methods until the error occurs.

    – Steve11235
    Jan 3 at 15:02











  • @Steve11235 I"m doing that right now. I"m also getting a few dependency errors now ex, SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0 SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1 I was getting those before and thought I had fixed this part, but inevitably they returned.

    – Jacob
    Jan 3 at 15:32






  • 1





    You are mixing Spring MVC with Jersey. These two frameworks are not compatible nor the same. The annotation @RequestHeader is for Spring MVC. For Jersey, you would use @HeaderParam. The error is telling you that Jersey can't resolve all the parameters for the method. And the reason is because it doesn't recognize those annotations.

    – Paul Samsotha
    Jan 4 at 7:00














1












1








1








This is almost a duplicate but I find the answer on that link to be somewhat illegitimate, because the program was fixed by changing a get request to a post request with the path '..../get'.



I'm receiving the error below. I don't know what I should be looking to fix based on this error. None of the files mentioned in the error were written by me and I assume that they are files in packages I have installed.



Other solutions have recommended that I include the line import org.springframework.context.ApplicationContext or update my maven project. I remember reading somewhere that I might need to set my CATALINA_HOME variable, which I set in my bashrc, and that also didn't work. Using mvn dependency resolve followed by mvn clean install and updating my maven project also did not work.



I would like to know how to find out where I should look based on this error. I don't know what it's telling me, other than there is some illegal argument somewhere and that some header ends.



The error occurs when I restart my tomcat server in eclipse.



enter image description here





UPDATE



I ended up ditching this project and started a new project using javaspark instead. I'm still curious what people have to say about how they would debug this. To me there's almost nothing intuitive about the error message I was given, and the only things I can think to do would be to do more general research into maven and CATALINA to get a better understanding of them, but I doubt that doing this would make the errors obvious to me.



From a strictly theoretical point of view, what would be your first steps after reading these errors(other than copying and pasting the error into a search engine).





Error



Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalArgumentException: java.text.ParseException: End of header
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:289)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
... 53 more

Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [Jersey Web Application] in web application [/RestServer] threw load() exception
java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)




ServerInRest.java



    package serverPackage;

import java.io.IOException;
import java.util.LinkedList;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;

import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.context.ApplicationContext;


@Path("/serverinrest")
public class ServerInRest {

//All the chatrooms available on this server
protected LinkedList<MyChatroom> chatRooms = new LinkedList<MyChatroom>(); //All the chatrooms on this Server. This chatrooms list and the userlist and messagelist in the chatrooms are the only stateful part of this server.

/*
* Constructor for the server. Initializes the Chatroom list and JSON parser
*/
public ServerInRest() {
chatRooms = new LinkedList<MyChatroom>();
}

/* Receives a message that is stored in the chatrooms messages list, and sends this message to all users in that chatroom.
* @Param user The user who is sending the message
* @Param room The room the message is to be sent to
* @Param message The message to be sent
*/
@Path("/message")
@PUT
@Produces("Application/Json")
public JSONObject message(@RequestHeader("user") String user, @RequestHeader("room") String room, @RequestHeader("message") String message) throws IOException {
String header = "Message";
String response = "Sent";
MyChatroom c = this.roomObject(room);
c.addMessage(message, user);
return conToJson(header,response);
}

/* Removes a user named in the user list of the chatroom
* @Param user The user to be removed
* @Param room The room the user will be removed from
*/
@Path("/leave")
@PUT
@Produces("application/xml")
public JSONObject leaveRoom(@RequestHeader("user") String user, @RequestHeader("room") String room) throws IOException {
String header = "Left Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.removeUser(user);
return conToJson(header, response);
}

/* Adds a user to the user list of the chatroom
* @Param user The user to be added
* @Param room The room the user will be added to
*/
@Path("/join")
@PUT
@Produces("application/")
public JSONObject joinRoom(@RequestHeader("user") String user, @RequestHeader("room") String room){
String header = "Joined Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.addUser(user);
return conToJson(header, response);
}

/* Creates a room for this server and adds it to the servers room list
* @Param room The name of the room
*/
@Path("{r}")
@POST
@Produces("application/json")
public String createRooms(@RequestHeader("room") String room){
String header = "Created_room";
String response = room;
MyChatroom c = new MyChatroom(room);
chatRooms.add(c);
return "Created room" + response;//conToJson(header, response);
}

/* Lists the names of all the rooms on this server
* @return A string containing the names of all the rooms
*/
@GET
@Produces("application/json")
public JSONObject listRooms(@RequestHeader("user") String room) {
print("test1");
String rooms = "Available_Roomsn"; //% is used to determine if there needs to be user input or not
for (int j = 0; j < chatRooms.size(); j++) {
rooms = rooms + chatRooms.get(j).getName() + "n";
}
print("test3");
return conToJson("Rooms",rooms);
}

/* Takes a room name and returns the room object with that name
* @param room: A string containing the name of the chatroom
* @return A chatroom containing the same name as name
*/
private MyChatroom roomObject(String room) {
for (int i = 0; i < chatRooms.size(); i++) {
MyChatroom c = chatRooms.get(i);
if (c.getName().equals(room)) {
return c;
}
}
return null;
}

/**
* Lazy form of printing a string
* @param x The string to be printed
*/
private void print(String x) {
System.out.println(x);
}

/* Returns a JSONObject representation of a string
* @Param response: A string
* @Return A JSON representation of response
*/
private JSONObject conToJson(String header, String response) {
JSONObject j;
try {
j = new JSONObject();
j.put(header,response);
} catch (Exception e) {
System.out.println("test0");
return null;
}
return j;
}

}




pom.xml



<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>RestServer</groupId>
<artifactId>RestServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>

</plugins>
</build>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20170516</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>

</dependencies>
</project>









share|improve this question
















This is almost a duplicate but I find the answer on that link to be somewhat illegitimate, because the program was fixed by changing a get request to a post request with the path '..../get'.



I'm receiving the error below. I don't know what I should be looking to fix based on this error. None of the files mentioned in the error were written by me and I assume that they are files in packages I have installed.



Other solutions have recommended that I include the line import org.springframework.context.ApplicationContext or update my maven project. I remember reading somewhere that I might need to set my CATALINA_HOME variable, which I set in my bashrc, and that also didn't work. Using mvn dependency resolve followed by mvn clean install and updating my maven project also did not work.



I would like to know how to find out where I should look based on this error. I don't know what it's telling me, other than there is some illegal argument somewhere and that some header ends.



The error occurs when I restart my tomcat server in eclipse.



enter image description here





UPDATE



I ended up ditching this project and started a new project using javaspark instead. I'm still curious what people have to say about how they would debug this. To me there's almost nothing intuitive about the error message I was given, and the only things I can think to do would be to do more general research into maven and CATALINA to get a better understanding of them, but I doubt that doing this would make the errors obvious to me.



From a strictly theoretical point of view, what would be your first steps after reading these errors(other than copying and pasting the error into a search engine).





Error



Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalArgumentException: java.text.ParseException: End of header
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:289)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
... 53 more

Jan. 03, 2019 8:19:09 A.M. org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [Jersey Web Application] in web application [/RestServer] threw load() exception
java.text.ParseException: End of header
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:168)
at com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:129)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:111)
at com.sun.jersey.core.header.reader.HttpHeaderListAdapter.next(HttpHeaderListAdapter.java:98)
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:100)
at com.sun.jersey.core.header.QualitySourceMediaType.valueOf(QualitySourceMediaType.java:87)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:360)
at com.sun.jersey.core.header.reader.HttpHeaderReader$5.create(HttpHeaderReader.java:358)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:461)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:365)
at com.sun.jersey.core.header.reader.HttpHeaderReader.readQualitySourceMediaType(HttpHeaderReader.java:373)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:287)
at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:274)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addProduces(IntrospectionModeller.java:173)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:344)
at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:128)
at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:769)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1595)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1356)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4849)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)




ServerInRest.java



    package serverPackage;

import java.io.IOException;
import java.util.LinkedList;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;

import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.context.ApplicationContext;


@Path("/serverinrest")
public class ServerInRest {

//All the chatrooms available on this server
protected LinkedList<MyChatroom> chatRooms = new LinkedList<MyChatroom>(); //All the chatrooms on this Server. This chatrooms list and the userlist and messagelist in the chatrooms are the only stateful part of this server.

/*
* Constructor for the server. Initializes the Chatroom list and JSON parser
*/
public ServerInRest() {
chatRooms = new LinkedList<MyChatroom>();
}

/* Receives a message that is stored in the chatrooms messages list, and sends this message to all users in that chatroom.
* @Param user The user who is sending the message
* @Param room The room the message is to be sent to
* @Param message The message to be sent
*/
@Path("/message")
@PUT
@Produces("Application/Json")
public JSONObject message(@RequestHeader("user") String user, @RequestHeader("room") String room, @RequestHeader("message") String message) throws IOException {
String header = "Message";
String response = "Sent";
MyChatroom c = this.roomObject(room);
c.addMessage(message, user);
return conToJson(header,response);
}

/* Removes a user named in the user list of the chatroom
* @Param user The user to be removed
* @Param room The room the user will be removed from
*/
@Path("/leave")
@PUT
@Produces("application/xml")
public JSONObject leaveRoom(@RequestHeader("user") String user, @RequestHeader("room") String room) throws IOException {
String header = "Left Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.removeUser(user);
return conToJson(header, response);
}

/* Adds a user to the user list of the chatroom
* @Param user The user to be added
* @Param room The room the user will be added to
*/
@Path("/join")
@PUT
@Produces("application/")
public JSONObject joinRoom(@RequestHeader("user") String user, @RequestHeader("room") String room){
String header = "Joined Room";
String response = room;
MyChatroom c = this.roomObject(room);
c.addUser(user);
return conToJson(header, response);
}

/* Creates a room for this server and adds it to the servers room list
* @Param room The name of the room
*/
@Path("{r}")
@POST
@Produces("application/json")
public String createRooms(@RequestHeader("room") String room){
String header = "Created_room";
String response = room;
MyChatroom c = new MyChatroom(room);
chatRooms.add(c);
return "Created room" + response;//conToJson(header, response);
}

/* Lists the names of all the rooms on this server
* @return A string containing the names of all the rooms
*/
@GET
@Produces("application/json")
public JSONObject listRooms(@RequestHeader("user") String room) {
print("test1");
String rooms = "Available_Roomsn"; //% is used to determine if there needs to be user input or not
for (int j = 0; j < chatRooms.size(); j++) {
rooms = rooms + chatRooms.get(j).getName() + "n";
}
print("test3");
return conToJson("Rooms",rooms);
}

/* Takes a room name and returns the room object with that name
* @param room: A string containing the name of the chatroom
* @return A chatroom containing the same name as name
*/
private MyChatroom roomObject(String room) {
for (int i = 0; i < chatRooms.size(); i++) {
MyChatroom c = chatRooms.get(i);
if (c.getName().equals(room)) {
return c;
}
}
return null;
}

/**
* Lazy form of printing a string
* @param x The string to be printed
*/
private void print(String x) {
System.out.println(x);
}

/* Returns a JSONObject representation of a string
* @Param response: A string
* @Return A JSON representation of response
*/
private JSONObject conToJson(String header, String response) {
JSONObject j;
try {
j = new JSONObject();
j.put(header,response);
} catch (Exception e) {
System.out.println("test0");
return null;
}
return j;
}

}




pom.xml



<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>RestServer</groupId>
<artifactId>RestServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>

</plugins>
</build>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20170516</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>

</dependencies>
</project>






java rest http tomcat jersey






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 22:56







Jacob

















asked Jan 3 at 14:41









JacobJacob

97327




97327













  • In the stack trace, I'm seeing a parsing error, media types, and HttpHeader. I suggest you check the incoming request; possibly, it is malformed.

    – Steve11235
    Jan 3 at 14:55











  • @Steve11235 This is printed before I make a request. It occurs when I restart my tomcat server. I've uploaded a screenshot of the only thing I do to start this server. I receive the same error also when I try to visit the url in my web browser by visiting http://localhost:8080/RestServer/serv/myserver

    – Jacob
    Jan 3 at 14:57













  • Now I see that in the stack trace. That is very odd. This sucks, but try stripping your class down to the bare minimum and get it running. Then, add back methods until the error occurs.

    – Steve11235
    Jan 3 at 15:02











  • @Steve11235 I"m doing that right now. I"m also getting a few dependency errors now ex, SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0 SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1 I was getting those before and thought I had fixed this part, but inevitably they returned.

    – Jacob
    Jan 3 at 15:32






  • 1





    You are mixing Spring MVC with Jersey. These two frameworks are not compatible nor the same. The annotation @RequestHeader is for Spring MVC. For Jersey, you would use @HeaderParam. The error is telling you that Jersey can't resolve all the parameters for the method. And the reason is because it doesn't recognize those annotations.

    – Paul Samsotha
    Jan 4 at 7:00



















  • In the stack trace, I'm seeing a parsing error, media types, and HttpHeader. I suggest you check the incoming request; possibly, it is malformed.

    – Steve11235
    Jan 3 at 14:55











  • @Steve11235 This is printed before I make a request. It occurs when I restart my tomcat server. I've uploaded a screenshot of the only thing I do to start this server. I receive the same error also when I try to visit the url in my web browser by visiting http://localhost:8080/RestServer/serv/myserver

    – Jacob
    Jan 3 at 14:57













  • Now I see that in the stack trace. That is very odd. This sucks, but try stripping your class down to the bare minimum and get it running. Then, add back methods until the error occurs.

    – Steve11235
    Jan 3 at 15:02











  • @Steve11235 I"m doing that right now. I"m also getting a few dependency errors now ex, SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0 SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1 I was getting those before and thought I had fixed this part, but inevitably they returned.

    – Jacob
    Jan 3 at 15:32






  • 1





    You are mixing Spring MVC with Jersey. These two frameworks are not compatible nor the same. The annotation @RequestHeader is for Spring MVC. For Jersey, you would use @HeaderParam. The error is telling you that Jersey can't resolve all the parameters for the method. And the reason is because it doesn't recognize those annotations.

    – Paul Samsotha
    Jan 4 at 7:00

















In the stack trace, I'm seeing a parsing error, media types, and HttpHeader. I suggest you check the incoming request; possibly, it is malformed.

– Steve11235
Jan 3 at 14:55





In the stack trace, I'm seeing a parsing error, media types, and HttpHeader. I suggest you check the incoming request; possibly, it is malformed.

– Steve11235
Jan 3 at 14:55













@Steve11235 This is printed before I make a request. It occurs when I restart my tomcat server. I've uploaded a screenshot of the only thing I do to start this server. I receive the same error also when I try to visit the url in my web browser by visiting http://localhost:8080/RestServer/serv/myserver

– Jacob
Jan 3 at 14:57







@Steve11235 This is printed before I make a request. It occurs when I restart my tomcat server. I've uploaded a screenshot of the only thing I do to start this server. I receive the same error also when I try to visit the url in my web browser by visiting http://localhost:8080/RestServer/serv/myserver

– Jacob
Jan 3 at 14:57















Now I see that in the stack trace. That is very odd. This sucks, but try stripping your class down to the bare minimum and get it running. Then, add back methods until the error occurs.

– Steve11235
Jan 3 at 15:02





Now I see that in the stack trace. That is very odd. This sucks, but try stripping your class down to the bare minimum and get it running. Then, add back methods until the error occurs.

– Steve11235
Jan 3 at 15:02













@Steve11235 I"m doing that right now. I"m also getting a few dependency errors now ex, SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0 SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1 I was getting those before and thought I had fixed this part, but inevitably they returned.

– Jacob
Jan 3 at 15:32





@Steve11235 I"m doing that right now. I"m also getting a few dependency errors now ex, SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0 SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1 I was getting those before and thought I had fixed this part, but inevitably they returned.

– Jacob
Jan 3 at 15:32




1




1





You are mixing Spring MVC with Jersey. These two frameworks are not compatible nor the same. The annotation @RequestHeader is for Spring MVC. For Jersey, you would use @HeaderParam. The error is telling you that Jersey can't resolve all the parameters for the method. And the reason is because it doesn't recognize those annotations.

– Paul Samsotha
Jan 4 at 7:00





You are mixing Spring MVC with Jersey. These two frameworks are not compatible nor the same. The annotation @RequestHeader is for Spring MVC. For Jersey, you would use @HeaderParam. The error is telling you that Jersey can't resolve all the parameters for the method. And the reason is because it doesn't recognize those annotations.

– Paul Samsotha
Jan 4 at 7:00












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54024491%2fhow-to-interpret-the-error-java-lang-illegalargumentexception-java-text-parsee%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54024491%2fhow-to-interpret-the-error-java-lang-illegalargumentexception-java-text-parsee%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith