Why get error 404 if app starts and not get errors to console?

0

I develop web app via IntelliJ Idea. Web App base on Google App Engine, Ktor, Kotlin. App starts, but when I go to localhost:8080, then get:

This localhost page can’t be found
No webpage was found for the web address: http://localhost:8080/
HTTP ERROR 404

In console not written some errors

But if run app via gradle appengineRun then all is ok

Example code:

fun Application.module() {
    // This adds Date and Server headers to each response, and allows custom additional headers
    install(DefaultHeaders)
    // This uses use the logger to log every call (request/response)
    install(CallLogging)

    install(CORS) {
        method(HttpMethod.Options)
        method(HttpMethod.Put)
        method(HttpMethod.Delete)
        method(HttpMethod.Patch)
        header(HttpHeaders.Authorization)
        allowCredentials = true
        host("api.vk.com")
    }

    routing {
        get("/") {
            call.respondText("It's server for apartments searching!", contentType = ContentType.Text.Plain)
        }
    }
}

Attached settings in IntelliJ Idea

Project Structure:

Facets Facets

Artifacts Artifacts

Modules Modules

Google App Engine Standard Local Server Google App Engine Standard Local Server

After click run get this:

Starting the App Engine local development server...
Jan 06, 2020 4:16:05 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
2020-01-06 16:16:06.052:INFO::main: Logging initialized @1216ms to org.eclipse.jetty.util.log.StdErrLog
2020-01-06 16:16:06.230:WARN:oejs.AbstractConnector:main: Ignoring deprecated socket close linger time
Connected to server
2020-01-06 16:16:07.288:INFO:oejs.Server:main: jetty-9.4.18.v20190429; built: 2019-04-29T20:42:08.989Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_201-b09
2020-01-06 16:16:10.345:WARN:oeja.AnnotationParser:qtp1073502961-17: org.slf4j.impl.StaticLoggerBinder scanned from multiple locations: jar:file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/log4j-slf4j-impl-2.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class, jar:file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class
2020-01-06 16:16:10.346:WARN:oeja.AnnotationParser:qtp1073502961-17: org.slf4j.impl.StaticMDCBinder scanned from multiple locations: jar:file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/log4j-slf4j-impl-2.11.2.jar!/org/slf4j/impl/StaticMDCBinder.class, jar:file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticMDCBinder.class
2020-01-06 16:16:10.346:WARN:oeja.AnnotationParser:qtp1073502961-17: org.slf4j.impl.StaticMarkerBinder scanned from multiple locations: jar:file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/log4j-slf4j-impl-2.11.2.jar!/org/slf4j/impl/StaticMarkerBinder.class, jar:file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticMarkerBinder.class
2020-01-06 16:16:10.867:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=2202ms
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/log4j-slf4j-impl-2.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
         contextInitialized
Jan 06, 2020 1:16:11 PM com.google.auth.oauth2.ComputeEngineCredentials runningOnComputeEngine
INFO: Failed to detect whether we are running on Google Compute Engine.
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
2020-01-06 16:16:12.453:INFO:oejsh.ContextHandler:main: Started c.g.a.t.d.j.DevAppEngineWebAppContext@3d08f3f5{/,file:///C:/Projects/ApartmentSearching/classes/artifacts/com_group_app/,AVAILABLE}{C:\Projects\ApartmentSearching\classes\artifacts\com_group_app}
2020-01-06 16:16:12.454:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
2020-01-06 16:16:12.454:INFO:oejs.session:main: node0 Scavenging disabled
2020-01-06 16:16:12.471:INFO:oejs.AbstractConnector:main: Started NetworkTrafficSelectChannelConnector@20398b7c{HTTP/1.1,[http/1.1]}{localhost:8080}
2020-01-06 16:16:12.472:INFO:oejs.Server:main: Started @7636ms
Jan 06, 2020 1:16:12 PM com.google.appengine.tools.development.AbstractModule startup
INFO: Module instance default is running at http://localhost:8080/
Jan 06, 2020 1:16:12 PM com.google.appengine.tools.development.AbstractModule startup
INFO: The admin console is running at http://localhost:8080/_ah/admin
Jan 06, 2020 4:16:12 PM com.google.appengine.tools.development.DevAppServerImpl doStart
INFO: Dev App Server is now running

Reason

<listener>
    <listener-class>com.group.Bootstrapper</listener-class>
</listener>
class Bootstrapper : ServletContextListener {
    override fun contextInitialized(sce: ServletContextEvent?) {
        println("         contextInitialized")
        ObjectifyService.init()
        ObjectifyService.register(User::class.java)
    }

    override fun contextDestroyed(sce: ServletContextEvent?) {}
}

How fix it, except deleting this class?

google-app-engine
kotlin
intellij-idea
ktor

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0