How do I display SQL errors from Spring and MyBatis? - java

I have the following code that I ran in the debugger with --debug but it won't print out any SQL errors. It fails silently with an exception and returns from the servlet request.
System.out.println("sourceMapper = " + sourceMapper);
Source source = sourceMapper.findByHost(host);
System.out.println("source = " + source);
This is the output
2018-05-11 13:47:58.080 INFO 29392 --- [nio-8080-exec-2] c.s.shorturl.apis.ShortUrlApiController : Method name: doUrlRequest() user agent is = curl/7.59.0
sourceMapper = org.apache.ibatis.binding.MapperProxy#30a1e904
2018-05-11 13:47:58.359 INFO 29392 --- [nio-8080-exec-2] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2018-05-11 13:47:58.489 INFO 29392 --- [nio-8080-exec-2] o.s.jdbc.support.SQLErrorCodesFactory : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
2018-05-11 13:47:58.541 DEBUG 29392 --- [nio-8080-exec-2] o.s.b.w.f.OrderedRequestContextFilter : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade#645ec595
How do I print the SQL errors that it is encountering? Or find out why it's failing and what the exception is?
MyBatis 3.4.5, MyBatis Spring 1.3.1, MyBatis Spring Boot Autoconfigure 1.3.1, MyBatis Spring Boot Starter 1.3.1, Spring Boot 1.5.6

You could add a try/catch around your code and log a caught exception:
try {
System.out.println("sourceMapper = " + sourceMapper);
Source source = sourceMapper.findByHost(host);
System.out.println("source = " + source);
} catch (Exception e) {
// log using slf4j's Logger
logger.error("An exception caught", e);
// or print it to standard output
e.printStackTrace();
}
There should be a Logger instance somewhere (probably in the same class):
private final Logger logger = LoggerFactory.getLogger(this.getClass());

Related

Unable to set the logger name in payara server log

When writing the logs of a war into payara server logs, it was not able to determine/identify the Logger name.
When I see it on the admin console, the Logger value us blank, and it is printing Log Level as SEVERE even it is just an INFO level log.
Following is the entry in payara server
Log Entry Detail
Timestamp : Mar 25, 2022 12:37:03.439
Log Level : SEVERE
Logger :
Name-Value Pairs : {levelValue=1000, timeMillis=1648211823439}
Record Number : 679
Message ID :
Complete Message : [http-thread-pool::http-listener-1(18)] INFO com.test.LogTest - com.test.LogTest
Sample code looks like the following
public class LogTest {
static Logger logger = LoggerFactory.getLogger(LogTest.class);
public static void main(String[] args) {
logger.info(logger.getName());
logger.debug("debug");
logger.info("info");
}
}
In my local I was able to get the following output
[main] INFO com.test.LogTest - com.test.LogTest
[main] DEBUG com.test.LogTest - debug
[main] INFO com.test.LogTest - info
I am using SimpleLogger (slf4j) as the logging library
Please help me on how to set the Logger value in the payara server logs, for the logs that I am logging

BeanCreationException: Error creating bean with name 'flywayInitializer'

I am trying to run my project tests in a docker container. All of the tests work just fine when running locally. Errors started occurring when I tried to move my testing to docker container.
Here is the error message:
java.lang.IllegalStateException: Failed to load ApplicationContext
[...]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException:
Migration V1__initial_user.sql failed
-------------------------------------
SQL State : 42601
Error Code : 0
Message : ERROR: syntax error at or near "GENERATED"
Position: 45
Location : db/migration/V1__initial_user.sql (/Users/villemossip/Desktop/GRP/GRP-SAS/application/build/resources/main/db/migration/V1__initial_user.sql)
Line : 36
Statement : CREATE TABLE revinfo
(
rev INTEGER GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ),
revtstmp BIGINT,
PRIMARY KEY (rev)
)
From the log we can see that container image was created, but it fails to migrate the sql schema:
[...]
2019-10-10 10:36:18.768 INFO 49547 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 5.2.4 by Boxfuse
2019-10-10 10:36:18.777 INFO 49547 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-10-10 10:36:18.795 INFO 49547 --- [ main] 🐳 [postgres:9.6.12] : Creating container for image: postgres:9.6.12
2019-10-10 10:36:19.001 INFO 49547 --- [ main] 🐳 [postgres:9.6.12] : Starting container with ID: a32dd0850baf34770cce9bdc81918cd4db40502188b85dfaa90f74e2900f9fa7
2019-10-10 10:36:19.547 INFO 49547 --- [ main] 🐳 [postgres:9.6.12] : Container postgres:9.6.12 is starting: a32dd0850baf34770cce9bdc81918cd4db40502188b85dfaa90f74e2900f9fa7
2019-10-10 10:36:23.342 INFO 49547 --- [ main] 🐳 [postgres:9.6.12] : Container postgres:9.6.12 started
2019-10-10 10:36:23.426 INFO 49547 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-10-10 10:36:23.431 INFO 49547 --- [ main] o.f.c.internal.database.DatabaseFactory : Database: jdbc:postgresql://localhost:32834/test (PostgreSQL 9.6)
2019-10-10 10:36:23.488 INFO 49547 --- [ main] o.f.core.internal.command.DbValidate : Successfully validated 6 migrations (execution time 00:00.024s)
2019-10-10 10:36:23.501 INFO 49547 --- [ main] o.f.c.i.s.JdbcTableSchemaHistory : Creating Schema History table: "public"."flyway_schema_history"
2019-10-10 10:36:23.519 INFO 49547 --- [ main] o.f.core.internal.command.DbMigrate : Current version of schema "public": << Empty Schema >>
2019-10-10 10:36:23.520 INFO 49547 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version 1 - initial user
2019-10-10 10:36:23.542 ERROR 49547 --- [ main] o.f.core.internal.command.DbMigrate : Migration of schema "public" to version 1 - initial user failed! Changes successfully rolled back.
2019-10-10 10:36:23.546 WARN 49547 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException:
Migration V1__initial_user.sql failed
-------------------------------------
[...]
Here is part of the sql script (app/src/main/resources/db/migration):
[...]
constraint user_aud_pkey primary key (id, rev)
);
CREATE TABLE revinfo
(
rev INTEGER GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ),
revtstmp BIGINT,
PRIMARY KEY (rev)
);
CREATE SEQUENCE hibernate_sequence INCREMENT 1 MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
Here is "application.properties" (app/test/java/resources):
spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver
spring.datasource.url=jdbc:tc:postgresql://localhost:5433/test
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=validate
spring.jackson.default-property-inclusion=NON_NULL
spring.flyway.baselineOnMigrate=true
spring.flyway.check-location=true
spring.flyway.locations=classpath:db/migration
spring.flyway.schemas=public
spring.flyway.enabled=true
Also in the same directory I have container-license-acceptance.txt file.
Inside "build.gradle" I added the following lines (app/build.gradle):
dependencies {
[...]
testImplementation "org.testcontainers:junit-jupiter:1.11.3"
testImplementation "org.testcontainers:postgresql:1.11.3"
}
Inside BaseInitTest file, I have the following lines (app/test/java/com):
#Testcontainers
#SpringBootTest
public class BaseIntTest {
#Container
private static final PostgreSQLContainer<?> container = new PostgreSQLContainer<>();
[...]
I don't understand, how can the same tests pass at first, but fail when I move them to docker container?
It looks like the test container with the database has started successfully, so no issue there, you're getting an empty database.
Then you try running the flyway and this fails.
Flyway in spring boot works during the initialization of the spring application context,
so the actual migration runs while the application context gets initialized, so the migration failure looks like a spring failure.
The reason, however, is logged: the migration file has an invalid content:
Migration V1__initial_user.sql failed
-------------------------------------
SQL State : 42601
Error Code : 0
Message : ERROR: syntax error at or near "GENERATED"
Position: 45
Location : db/migration/V1__initial_user.sql (/Users/villemossip/Desktop/GRP/GRP-
SAS/application/build/resources/main/db/migration/V1__initial_user.sql)
Line : 36
Statement : CREATE TABLE revinfo
(
rev INTEGER GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ),
revtstmp BIGINT,
PRIMARY KEY (rev)
)
This GENERATED BY is unsupported.
Why? Probably your docker image includes the version of RDBMS that doesn't support this syntax. So it differs from the DB that you use in a local environment without docker.
In any case it's not about docker, spring or flyway but about the DB and the migration code.
In terms of resolution, I suggest running the docker image of the DB directly (without java, testcontainers and flyway).
When it runs, just run this migration "manually" in pgadmin or something. You're expected to see the same error.
Thank you #M. Deinum and Mark Bramnik!
I found out that the issue is with Postgres version. For some reason by default docker image is created with old version 9.6.12, but sql script GENERATED BY DEFAULT was added to Postgres with version 10.
Solution 1 (Update the sql script to older version):
CREATE TABLE revinfo
(
rev INTEGER PRIMARY KEY NOT NULL,
revtstmp BIGINT
);
Solution 2:
Changed docker image version to 11.2 by creating CustomPostgreSQLContainer file in the project.
import org.testcontainers.containers.PostgreSQLContainer;
public class CustomPostgreSQLContainer extends PostgreSQLContainer<CustomPostgreSQLContainer> {
private static final String IMAGE_VERSION = "postgres:11.2";
private static CustomPostgreSQLContainer container;
CustomPostgreSQLContainer() {
super(IMAGE_VERSION);
}
public static CustomPostgreSQLContainer getInstance() {
if (container == null) {
container = new CustomPostgreSQLContainer();
}
return container;
}
#Override
public void start() {
super.start();
System.setProperty("spring.datasource.url", container.getJdbcUrl());
System.setProperty("spring.datasource.username", container.getUsername());
System.setProperty("spring.datasource.password", container.getPassword());
}
#Override
public void stop() {
//do nothing, JVM handles shut down
}
}
And updating BaseIntTest file:
#Testcontainers
#SpringBootTest
public class BaseIntTest {
#Container
private static final PostgreSQLContainer<?> container = CustomPostgreSQLContainer.getInstance();
And last removing two lines from test application.properties file:
spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver
spring.datasource.url=jdbc:tc:postgresql://localhost:5433/test
In my case I added in my application.properties file
spring.flyway.baselineOnMigrate = true
and I had also to start from version 1.1 instead of 1 otherwise flyway throws an error (flyway 8.0.5)
The problem in my case was because of using spring.datasource.url=jdbc:postgres://localhost:5432/todoListDb
instead of
spring.datasource.url=jdbc:postgresql://localhost:5432/todoListDb
(postgres instead of PostgreSQL) in my application.properties file
So try to use the right URL for your database and verify if there is a typo in your url
One reason for this issue was missing docker DB version: <embedded-database-spring-test.version>2.0.1</embedded-database-spring-test.version>
By adding this specific version, it worked for me.
As mentioned GENERATED BY DEFAUL needs a newer version of postgres image. In your case the postgres image defaults to 9.6.12.
Simple solution is to just update the datasource url in application.properties and point to a newer postgres image there.
spring.datasource.url=jdbc:tc:postgresql:11.2://localhost:5433/test

how to fix 'resource not found' when trying to download file in spring boot REST API?

I'm new to spring framework and REST, and now trying to migrate REST from jersey to spring boot 2.1
The controller works fine with jax-rs, however, I don't want to use jax-rs in spring boot. So, I tried spring Mvc and I get 'resource not found' error. Please I'd really appreciate any help.
I tried this
#GetMapping(value ="/generic/download_file/{path:[^\\.+]*}", consumes ="application/vnd.X-FileContent")
public ResponseEntity<?> downloadFile(#PathVariable("path") String filePath){
String actualFilePath = "";
try {
actualFilePath = filePath.replaceAll("\\/", "\\\\");
File file = new File(actualFilePath);
if (file.exists()) {
return ResponseEntity.ok().header("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"").body(file);
} else {
return errorHandling.errorResponseFactory("1.0.0", Thread.currentThread().getStackTrace()[1], "",
RecommendedSolution.UseValidDirectoryPath, "File not exist.");
}
} catch (Exception ex) {
ActionLog.writeLog("program_library_v510", "1.0.0", "Exception occur during gettig generic package file",
ActionLogType.DebugLog);
ActionLog.writeLog("program_library_v510", "1.0.0", "Exception occur during getting generic package file",
ActionLogType.ErrorLog);
return errorHandling.errorResponseFactory("1.0.0", Thread.currentThread().getStackTrace()[1], "",
RecommendedSolution.UnexpectedErrorMsg, "");
}
}
2019-01-07 17:17:23.930 INFO 13664 --- [nio-9090-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms
2019-01-07 17:17:23.947 DEBUG 13664 --- [nio-9090-exec-2] o.s.web.servlet.DispatcherServlet : GET "/packages/download_file/D:/xfolder/test.txt", paramete
rs={}
2019-01-07 17:17:24.002 DEBUG 13664 --- [nio-9090-exec-2] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/
resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
2019-01-07 17:17:24.006 DEBUG 13664 --- [nio-9090-exec-2] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found
2019-01-07 17:17:24.007 DEBUG 13664 --- [nio-9090-exec-2] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2019-01-07 17:17:24.015 DEBUG 13664 --- [nio-9090-exec-2] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
2019-01-07 17:17:24.029 DEBUG 13664 --- [nio-9090-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServ
letRequest)
2019-01-07 17:17:24.077 DEBUG 13664 --- [nio-9090-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [/] and supported [applic
ation/json, application/+json, application/json, application/+json]
2019-01-07 17:17:24.078 DEBUG 13664 --- [nio-9090-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Mon Jan 07 17:17:24 SGT 2019, status=40
4, error=Not Found, message=No message available, path=/packages/download_file/D:/xfolder/test.txt}]
2019-01-07 17:17:24.146 DEBUG 13664 --- [nio-9090-exec-2] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404
I suspect two things here. Let me clarify this.
What is the API url you are calling?
/generic/download_file/{path:[^\\.+]*} or /packages/download_file/D:/xfolder/test.txt
both are looks different. Please see generic and packages
The better way to pass filenames in URL is using #RequestParam instead of #PathVariable
#GetMapping(value ="/generic/download_file/", consumes ="application/vnd.X-FileContent")
public ResponseEntity downloadFile(#RequestParam("path") String filePath){

SLF4J: SimpleLogger is not logging trace and debug and also not logging exceptions

I am trying to add a logger to one of my programs, mainly to replace the System.out.println(), and it seems to give me some problems.
This is my first time using a logger, so I am a noob at it.
I had a look at a multitude of links over the past days but still haven't managed to make my logger catch an exception; here are some of the links I looked at (some of them are 5 years old and might need updates):
oracle simple formatter
slf4j - interface logger
slf4j - simple logger
slf4j - faq
slf4j - message formatter
stackoverflow 1
stackoverflow 2
I am using:
slf4j-api-1.7.22.jar
slf4j-simple-1.7.22.jar
jdk1.8.0_71
IntelliJ 2016.3.2
The simpleLogger.properties is placed directly in the resources package, this file is loaded before the logger is created, the file is loaded correctly as I can modify the date-time as I need it to be (and other settings work as well).
Part of the Main class:
...
private Logger LOG; //field
...
public static void main(String[] args) {
launch(args);
}
...
#Override
public void start(Stage primaryStage) {
/*Create logger*/
createLogger();
LOG.info("Stage start.");
...
}
...
private void createLogger() {
try {
Properties properties = new Properties();
properties.load(LOGGER_PROPERTIES); //path to prop file
} catch (IOException e) {
e.printStackTrace();
}
LOG = LoggerFactory.getLogger(Main.class);
LOG.info("Logger initialised.");
LOG.trace("test trace"); //not working
LOG.debug("test debug"); //not working
LOG.info("test info");
LOG.warn("test warning");
LOG.error("test error");
}
The simpleLogger.properties file:
org.slf4j.simpleLogger.logFile=System.out
# org.slf4j.simpleLogger.defaultLogLevel=
# org.slf4j.simpleLogger.log.a.b.c=
org.slf4j.simpleLogger.showDateTime=true
org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS
org.slf4j.simpleLogger.showThreadName=false
org.slf4j.simpleLogger.showLogName=false
org.slf4j.simpleLogger.showShortLogName=true
org.slf4j.simpleLogger.levelInBrackets=true
# org.slf4j.simpleLogger.warnLevelString=
# THE FORMAT TRIED
#org.slf4j.simpleLogger.SimpleFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n
#java.util.logging.SimpleFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n
#java.util.logging.SimpleFormatter.format="%1$tc %2$s%n%4$s: %5$s%6$s%n"
#org.slf4j.simpleLogger.format=[%1$tc] %4$s: %2$s - %5$s %6$s%n %7$s
#org.slf4j.helpers.MessageFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n %7$s
#java.util.logging.SimpleFormatter.format="%1$tc %2$s%n%4$s: %5$s%6$s%n"
Part of the class where I am attempting to create an exception:
LOG.info("Creating window - More info: loading.. .fxml");
try {
BP_INFO = FXMLLoader.load(getClass().getResource("/fxml/ImageInf_.fxml")); //HERE change back to ImageInfo.fxml
LOG.info("Creating window - More info: loaded .fxml successfully.");
} catch (IOException e) {
// HERE not showing anything below
System.out.println("CATCH - From Sys out");
LOG.error("CATCH - EXCEPTION", (Throwable) e);
LOG.error("Creating window - More info: Exception");
LOG.error("Creating window - More info: Exception", e);
LOG.error("Creating window - More info: Exception {}", e);
LOG.error("Creating window - More info: Exception {} {} {}", Level.INFO, e.getMessage(), e);
// e.printStackTrace();
}
Console output:
12:17:08:995 [INFO] Main - Logger initialised.
12:17:08:996 [INFO] Main - test info
12:17:08:997 [WARN] Main - test warning
12:17:08:997 [ERROR] Main - test error
12:17:08:997 [INFO] Main - Stage start.
...
12:17:27:140 [INFO] View - Creating window - More info: loading.. .fxml
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
...
Problem 1:
As you can see trace and debug are not working. I have tried all the properties in the prop. file and some more as well but so far did not manage to catch any exception or apply a specific format.
Problem 2:
As you can see, the exception is also not logged at all.
Additional info: I have reset IntelliJ settings, I have been cleaning the win %temp% folder various times, I have been cleaning caches and restarted Intellij various times; all this in an attempt if the prop. file was not read correctly or kept somewhere in a cache.
Any help is much appreciated. Please respond in a simplistic way.
We may use Slf4j within a JavaFX project by using only these dependencies:
slf4j-api-1.7.22.jar
slf4j-simple-1.7.22.jar
Here's an example Application class:
...
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Todo extends Application {
private static final Logger log = LoggerFactory.getLogger(Todo.class);
...
public static void main(String[] args) {
log.info("launching...");
log.warn("launching...");
log.error("launching...");
log.debug("launching...");
log.trace("launching...");
launch(args);
}
}
Slf4j simple already has default settings that may be fine for various scenarios. That not being the case, the logger may be configured by adding simplelogger.properties to the classpath, which will be automatically picked up by Slf4j on application startup. The javadoc for the SimpleLogger class nicely enlists all the properties that may be configured.
The contents of a simplelogger.properties file that modifies the log level only:
org.slf4j.simpleLogger.defaultLogLevel=trace
And here is the output when running with the log level set to trace:
[main] INFO todo.Todo - launching...
[main] WARN todo.Todo - launching...
[main] ERROR todo.Todo - launching...
[main] DEBUG todo.Todo - launching...
[main] TRACE todo.Todo - launching...
Problem #1 (trace and debug level is not logged)
From the doc of SimpleLogger:
org.slf4j.simpleLogger.defaultLogLevel - Default log level for all
instances of SimpleLogger. Must be one of ("trace", "debug", "info",
"warn", "error" or "off"). If not specified, defaults to "info".
Because the defult level is info, and trace and debug levels are "under" info, they will be filtered out by the logger and will not reach the appender.
So if you add the following line in the properties file:
org.slf4j.simpleLogger.defaultLogLevel = trace
you should see also messages with trace and debug level.
Problem #2 (the error trace is not logged properly)
You are catching IOExceptions, but an InvocationTargetException is actually thrown (which one is not catched), therefore the execution will never enter your catch block. What you see on the console is an unhandled runtime exception printed.
As described here, there could be per user configuration of Maven logging for one installation.
I copied default simplelogger.properties to $M2_HOME/conf/logging and added:
org.slf4j.simpleLogger.log.com.example=trace
and it logs fine.
This is not maybe the best solution, but the one I've found fitting my needs. You can log DEBUG but not TRACE as I remember I've read somewhere.

Error in request sent to appengine backend devserver

I have a bunch of code which would run on backend but when testing locally I am getting memcache related error
INFO : { AppEngineUserRealm isUserInRole } - Checking if principal test#example.com is in role admin
SEVERE : { ShardedMemcacheUtil get } - Error encountered while getting [ configuration ] from memcache.
java.lang.ClassCastException: com.google.appengine.tools.appstats.StatsProtos$RequestStatProto$Builder cannot be cast to com.google.appengine.tools.appstats.StatsProtos$RequestStatProto$Builder
at com.google.appengine.tools.appstats.MemcacheWriter.write(MemcacheWriter.java:210)
at com.google.appengine.tools.appstats.Recorder.processRecordingFuture(Recorder.java:456)
at com.google.appengine.tools.appstats.Recorder.processAsyncRpc(Recorder.java:404)
at com.google.appengine.tools.appstats.RecordingFuture.maybeRecordStats(RecordingFuture.java:140)
at com.google.appengine.tools.appstats.RecordingFuture.get(RecordingFuture.java:110)
at com.google.appengine.tools.appstats.RecordingFuture.get(RecordingFuture.java:20)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88)
at com.google.appengine.api.memcache.MemcacheServiceImpl.quietGet(MemcacheServiceImpl.java:26)
at com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:49)
The request was sent to the following URL so that the code is executed in backend.
http://localhost:52843/
The above request runs fine when sent to
http://localhost:8888/
Which is actually devserver.
Any clue what's wrong with it when run inside backend ? Also why there are two ports opened for backend 58251 and 58252
INFO : { JettyLogger info } - Started SelectChannelConnector#127.0.0.1:8888
INFO : { AbstractModule startup } - Module instance default is running at http://localhost:8888/
INFO : { AbstractModule startup } - The admin console is running at http://localhost:8888/_ah/admin
INFO : { JettyLogger info } - jetty-6.1.x
INFO : { ApiProxyLocalImpl log } - javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'dispatcher'
INFO : { JettyLogger info } - Started SelectChannelConnector#127.0.0.1:58251
INFO : { ServerWrapper startup } - server: -1.backend1 is running on port 58251
INFO : { JettyLogger info } - jetty-6.1.x
INFO : { ApiProxyLocalImpl log } - javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'dispatcher'
INFO : { JettyLogger info } - Started SelectChannelConnector#127.0.0.1:58252
INFO : { ServerWrapper startup } - server: 0.backend1 is running on port 58252
INFO : { DevAppServerImpl doStart } - Dev App Server is now running
UPDATE Looks like it was happening because I compiles with Jdk8. I came to know only after I deployed to cloud and it gave me version error. Still not sure why only backend was effected locally.

Categories

Resources