What I do?
I sent a GET request from Postman to Tomcat v9.0 with following data.
{
"diaryId":2,
"userId":2,
"createTimestamp":"2022-05-05 12:00:00",
"totalFat":2.52,
"totalCarbon":2.3,
"totalProtein":2.1,
"totalFiber":2.1,
"totalSugar":1.2,
"totalSodium":1.1,
"totalCalories":1.21
}
figure as follows.
Why does the Console in Eclipse IDE prints the following output after I run the Tomcat server then sending a request with GET method and given url http://localhost:8080/HealthHelper/dietDiary/test using Postman?
Ready to deserialize.
dietDiary2:DietDiary2 [diaryId=2, userId=2, createTimestamp=2021-12-26 00:00:00.0, totalFat=2.52, totalCarbon=2.3, totalProtein=2.1, totalFiber=2.1, totalSugar=1.2, totalSodium=1.1, totalCalories=1.21]
Does I do some wrong?
Appreciation
Any replies about this issue will be highly appreciated.
Code
/HealthHelper/src/main/java/controller/TestController.java
With Eclipse IDE I wrote a Servlet code in Java in /HealthHelper/src/main/java/controller/TestController.java, there are a WebServlet annotation with part of url /dietDiary/test -- @WebServlet("/dietDiary/test") shown as follows.
package controller;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import constant.DatePattern;
import vo.DietDiary2;
@WebServlet("/dietDiary/test")
public class TestController extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException{
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder
.setDateFormat(DatePattern.datePattern);
Gson gson = gsonBuilder.create();
System.out.println("Ready to deserialize.");
DietDiary2 dietDiary2 = gson.fromJson(req.getReader(), DietDiary2.class);
System.out.println("dietDiary2:"+dietDiary2.toString());
}
}
/HealthHelper/src/main/java/constant/DatePattern.java
package constant;
public class DatePattern {
public final static String datePattern = "YYYY-MM-DD hh:mm:ss";
}
/HealthHelper/src/main/java/vo/DietDiary2.java
In /HealthHelper/src/main/java/vo/DietDiary2.java, there are DietDiary2 public class that satsifies the JavaBean rule, shown as follows.
Notice that I use java.sql.Timestamp class to store Timestamp.
package vo;
import java.sql.Timestamp;
public class DietDiary2 {
private int diaryId;
private int userId;
private Timestamp createTimestamp;
private Double totalFat;
private Double totalCarbon;
private Double totalProtein;
private Double totalFiber;
private Double totalSugar;
private Double totalSodium;
private Double totalCalories;
public int getDiaryId() {
return diaryId;
}
public void setDiaryId(int diaryId) {
this.diaryId = diaryId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public Timestamp getCreateTimestamp() {
return createTimestamp;
}
public void setCreateTimestamp(Timestamp createTimestamp) {
this.createTimestamp = createTimestamp;
}
public Double getTotalFat() {
return totalFat;
}
public void setTotalFat(Double totalFat) {
this.totalFat = totalFat;
}
public Double getTotalCarbon() {
return totalCarbon;
}
public void setTotalCarbon(Double totalCarbon) {
this.totalCarbon = totalCarbon;
}
public Double getTotalProtein() {
return totalProtein;
}
public void setTotalProtein(Double totalProtein) {
this.totalProtein = totalProtein;
}
public Double getTotalFiber() {
return totalFiber;
}
public void setTotalFiber(Double totalFiber) {
this.totalFiber = totalFiber;
}
public Double getTotalSugar() {
return totalSugar;
}
public void setTotalSugar(Double totalSugar) {
this.totalSugar = totalSugar;
}
public Double getTotalSodium() {
return totalSodium;
}
public void setTotalSodium(Double totalSodium) {
this.totalSodium = totalSodium;
}
public Double getTotalCalories() {
return totalCalories;
}
public void setTotalCalories(Double totalCalories) {
this.totalCalories = totalCalories;
}
public boolean equals(Object object) {
if(object instanceof DietDiary2) {
return false;
}
DietDiary2 dietDiary = (DietDiary2) object;
if(!(this.getDiaryId() == dietDiary.getDiaryId())) {
return false;
}
if(!(this.getUserId() == dietDiary.getUserId())) {
return false;
}
if(!(this.getCreateTimestamp() == dietDiary.getCreateTimestamp())) {
return false;
}
return true;
}
@Override
public String toString() {
return "DietDiary2 [diaryId=" + diaryId + ", userId=" + userId + ", createTimestamp=" + createTimestamp
+ ", totalFat=" + totalFat + ", totalCarbon=" + totalCarbon + ", totalProtein=" + totalProtein
+ ", totalFiber=" + totalFiber + ", totalSugar=" + totalSugar + ", totalSodium=" + totalSodium
+ ", totalCalories=" + totalCalories + "]";
}
}
info at Console in Eclipse IDE.
info at Console when start execution of Tomcat v9.0.
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 3 2024 20:22:11 UTC
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.89.0
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 11
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Users\Jay\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706\jre
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 23+37
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Eclipse Adoptium
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\apache-tomcat-9.0.89\webapps
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dstdout.encoding=UTF-8
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dstderr.encoding=UTF-8
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -XX:+ShowCodeDetailsInExceptionMessages
Oct 26, 2024 8:57:50 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [C:\Users\Jay\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Users/Jay/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706/jre/bin/server;C:/Users/Jay/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706/jre/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\Jay\.jdks\openjdk-23\bin;C:\Users\Jay\AppData\Local\Microsoft\WindowsApps;C:\Users\Jay\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Jay\.jdks\openjdk-23\bin;;C:\Windows\System32;;.]
Oct 26, 2024 8:57:50 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [486] milliseconds
Oct 26, 2024 8:57:51 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Oct 26, 2024 8:57:51 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.89]
Oct 26, 2024 8:57:51 PM org.apache.tomcat.util.descriptor.web.WebXml setVersion
WARNING: Unknown version string [5.0]. Default version will be used.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Oct 26, 2024 8:57:52 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\BookshopDemo_Server]
Oct 26, 2024 8:57:52 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\BookshopDemo_Server] has finished in [38] ms
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\docs]
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\docs] has finished in [15] ms
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\examples]
Oct 26, 2024 8:57:52 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Oct 26, 2024 8:57:52 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Oct 26, 2024 8:57:52 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@619f2afc')
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\examples] has finished in [196] ms
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\FCMDemo_Server]
Oct 26, 2024 8:57:53 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\FCMDemo_Server] has finished in [1,435] ms
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\host-manager]
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\host-manager] has finished in [15] ms
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\manager]
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\manager] has finished in [13] ms
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\ROOT]
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\ROOT] has finished in [10] ms
Oct 26, 2024 8:57:54 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Oct 26, 2024 8:57:54 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [3024] milliseconds
info at Console after sent GET request with url http://localhost:8080/HealthHelper/dietDiary/test with Postman.
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 3 2024 20:22:11 UTC
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.89.0
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 11
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Users\Jay\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706\jre
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 23+37
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Eclipse Adoptium
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\apache-tomcat-9.0.89
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\apache-tomcat-9.0.89\webapps
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dstdout.encoding=UTF-8
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dstderr.encoding=UTF-8
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -XX:+ShowCodeDetailsInExceptionMessages
Oct 26, 2024 8:57:50 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [C:\Users\Jay\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Users/Jay/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706/jre/bin/server;C:/Users/Jay/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_23.0.0.v20240919-1706/jre/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\Jay\.jdks\openjdk-23\bin;C:\Users\Jay\AppData\Local\Microsoft\WindowsApps;C:\Users\Jay\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Jay\.jdks\openjdk-23\bin;;C:\Windows\System32;;.]
Oct 26, 2024 8:57:50 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Oct 26, 2024 8:57:50 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [486] milliseconds
Oct 26, 2024 8:57:51 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Oct 26, 2024 8:57:51 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.89]
Oct 26, 2024 8:57:51 PM org.apache.tomcat.util.descriptor.web.WebXml setVersion
WARNING: Unknown version string [5.0]. Default version will be used.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Oct 26, 2024 8:57:52 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\BookshopDemo_Server]
Oct 26, 2024 8:57:52 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\BookshopDemo_Server] has finished in [38] ms
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\docs]
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\docs] has finished in [15] ms
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\examples]
Oct 26, 2024 8:57:52 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Oct 26, 2024 8:57:52 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Oct 26, 2024 8:57:52 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@619f2afc')
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\examples] has finished in [196] ms
Oct 26, 2024 8:57:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\FCMDemo_Server]
Oct 26, 2024 8:57:53 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\FCMDemo_Server] has finished in [1,435] ms
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\host-manager]
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\host-manager] has finished in [15] ms
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\manager]
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\manager] has finished in [13] ms
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\apache-tomcat-9.0.89\webapps\ROOT]
Oct 26, 2024 8:57:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\apache-tomcat-9.0.89\webapps\ROOT] has finished in [10] ms
Oct 26, 2024 8:57:54 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Oct 26, 2024 8:57:54 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [3024] milliseconds
Ready to deserialize.
dietDiary2:DietDiary2 [diaryId=2, userId=2, createTimestamp=2021-12-26 00:00:00.0, totalFat=2.52, totalCarbon=2.3, totalProtein=2.1, totalFiber=2.1, totalSugar=1.2, totalSodium=1.1, totalCalories=1.21]
other info
I summary the other info (which most of them are mentioned above) in this section.
Server
Backend Server
Overview of settings about Tomcat
- version is 9.0
- IP address is
localhost - port number is
8080(default port number in Tomcat).
Frontend Server
Postman. I use Postman to test the Servlet.
request
url
http://localhost:8080/HealthHelper/dietDiary/test
method
GET
IDE
Eclipse
Programming language
Java
Referenced Library under HealthHelper project
What did I try?
I have check these settings are correct.
- url of request:
About Info, see above.
- method of request DOES match the method in
javax.servlet.
Sending a request with GET method will call the doGet method when the url does match (see the 1. point)
Additionally, I have read these docs.
What did I expected?
The value of createTimestamp that is received from the server (here is Postman) is consistent with corresponding value of key createTimestamp in json string that is sent from the server.
More exactly to say, I expected that
The console in Eclipse prints
Ready to deserialize.
dietDiary2:DietDiary2 [diaryId=2, userId=2, createTimestamp=2022-05-05 12:00:00, totalFat=2.52, totalCarbon=2.3, totalProtein=2.1, totalFiber=2.1, totalSugar=1.2, totalSodium=1.1, totalCalories=1.21]
when a request is sent with following data.
{
"diaryId":2,
"userId":2,
"createTimestamp":"2022-05-05 12:00:00",
"totalFat":2.52,
"totalCarbon":2.3,
"totalProtein":2.1,
"totalFiber":2.1,
"totalSugar":1.2,
"totalSodium":1.1,
"totalCalories":1.21
}




Instant,OffsetDateTimeorZonedDateTime. Thejava.sql.Timestampclass had severe problems and hasn‘t been used since before JDBC 4.2, and back then only for database values.