Google App引擎无法创建DevAppServer [英] Google app engine unable to create a DevAppServer

查看:62
本文介绍了Google App引擎无法创建DevAppServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试创建本地应用服务器以测试我的Web应用时,我完全无法这样做.有人在此处看到了相同的错误,并且曾经提示这是JDK> 12的问题,但是我仅使用Java8.我能够像平常一样部署应用程序,但不能创建本地服务器.我已经通过使用本机gcloud CLI的powershell,使用intellij插件以及现在通过maven插件进行了尝试,每次都遇到相同的问题.任何帮助将非常感激.

When trying to create a local app server to test my web app, I'm completely unable to do so. Somebody else has seen the same error here and was advised that it was an issue with JDK>12, however I'm only using java 8. I'm able to deploy the app as normal but not create the local server. I've tried it through powershell using the native gcloud CLI, using the intellij plugin and now through the maven plugin and get the same issue each time. Any help would be much appreciated.

堆栈跟踪

Apr 18, 2020 9:27:22 PM com.google.cloud.tools.appengine.operations.DevAppServerRunner run
INFO: submitting command: C:\Program Files\Java\jdk-14.0.1\bin\java.exe -Duse_jetty9_runtime=true -D--enable_all_permissions=true -Dappengine.sdk.root=C:\Users\samth\AppData\Local\google\ct4j-cloud-sdk\LATEST\google-cloud-sdk\platform\google_appengine\google\appengine\tools\java -cp C:\Users\samth\AppData\Local\google\ct4j-cloud-sdk\LATEST\google-cloud-sdk\platform\google_appengine\google\appengine\tools\java\lib\appengine-tools-api.jar com.google.appengine.tools.development.DevAppServerMain --allow_remote_shutdown --disable_update_check --no_java_agent C:\Users\samth\Documents\FiveCsWebsite\target\5CsWebsite-localtest
[INFO] GCLOUD: WARNING: An illegal reflective access operation has occurred
[INFO] GCLOUD: WARNING: Illegal reflective access by com.google.appengine.tools.development.StreamHandlerFactory (file:/C:/Users/samth/AppData/Local/google/ct4j-cloud-sdk/LATEST/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/impl/appengine-local-runtime.jar) to method java.net.URL.getURLStreamHandler(java.lang.String)
[INFO] GCLOUD: WARNING: Please consider reporting this to the maintainers of com.google.appengine.tools.development.StreamHandlerFactory
[INFO] GCLOUD: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[INFO] GCLOUD: WARNING: All illegal access operations will be denied in a future release
[INFO] GCLOUD: java.lang.RuntimeException: Unable to create a DevAppServer
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:369)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:301)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:383)
[INFO] GCLOUD:  at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)
[INFO] GCLOUD: Caused by: java.lang.ExceptionInInitializerError
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:124)
[INFO] GCLOUD:  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[INFO] GCLOUD:  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[INFO] GCLOUD:  at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[INFO] GCLOUD:  at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
[INFO] GCLOUD:  at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:354)
[INFO] GCLOUD:  ... 5 more
[INFO] GCLOUD: Caused by: java.lang.IllegalStateException: java.lang.NoSuchMethodException: java.net.SocksSocketImpl.<init>()
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevSocketImplFactory.<clinit>(DevSocketImplFactory.java:76)
[INFO] GCLOUD:  ... 12 more
[INFO] GCLOUD: Caused by: java.lang.NoSuchMethodException: java.net.SocksSocketImpl.<init>()
[INFO] GCLOUD:  at java.base/java.lang.Class.getConstructor0(Class.java:3427)
[INFO] GCLOUD:  at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2631)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevSocketImplFactory.<clinit>(DevSocketImplFactory.java:72)
[INFO] GCLOUD:  ... 12 more

pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <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>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <groupId>org.fivecs.website</groupId>
    <artifactId>5CsWebsite</artifactId>
    <packaging>war</packaging>
    <version>localtest</version>

    <build>
        <plugins>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>2.2.0</version>
                <configuration>
                    <deploy.projectId>fivecs-1088</deploy.projectId>
    <!--                 will be the version number visible on google cloud platform-->
                    <deploy.version>13</deploy.version>

    <!--                 release the version immediately-->
                    <deploy.promote>false</deploy.promote>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <dependencies>

        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>1.9.76</version>
        </dependency>

        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client-appengine</artifactId>
            <version>1.25.0</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.5</version>
        </dependency>

    </dependencies>

</project>

推荐答案

我遇到了同样的问题,经过几小时的尝试一切,我发现您可以

I had the same problem and after several hours of trying virtually everything I found that you can migrate your application from java8 to java11 as a stand-alone application. After doing that, my application now runs both locally and remotely when deployed.

这对我有用.

我删除了 main/webapp/WEB-INF/appengine-web.xml 文件,并创建了 main/appengine/app.yaml 文件,仅指定了此

I removed the main/webapp/WEB-INF/appengine-web.xml file and created the main/appengine/app.yaml file specifying only this

runtime: java11

我删除了 war 插件并添加了 application ,然后指定了

I removed the war plugin and added the application, then I specified the

application {
    mainClassName = "my.package.Main"
}

不确定这是否必要,但我也对此进行了更新

Not sure whether this is necessary but I also updated this

java {
    sourceCompatibility = JavaVersion.VERSION_11
}


与您的问题无关,但可能对其他人有帮助.由于我使用的是Kotlin,因此还必须将 main 函数包装到 Main 类中,并使其像这样静态:


Not related to your question but might be helpful for someone else. Since I'm using Kotlin, I also had to wrap the main function with the Main class and make it static like that:


@SpringBootApplication
class MyApplication

object Main {
    @JvmStatic
    fun main(args: Array<String>) {
        runApplication<MyApplication>(*args) {
            setBannerMode(Banner.Mode.OFF)
        }
    }
}

这篇关于Google App引擎无法创建DevAppServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆