简体   繁体   中英

How to fix “com.google.cloud.tools.appengine.AppEngineException: java.nio.file.NoSuchFileException: …\exploded-{project}\WEB-INF\appengine-web.xml”

I am working on deploying to the Google App Engine Standard Environment. Before deploying, I want to test locally, so I am running gradlew appengineRun .

Everything is working up until I hit this error: "com.google.cloud.tools.appengine.AppEngineException: java.nio.file.NoSuchFileException: C:\\Users{user}\\StudioProjects{project}\\build\\exploded-{project}\\WEB-INF\\appengine-web.xml".

This is very odd, as I checked the file structure in my project and the appengine-web.xml is present.

{project}
    ...
    build
        ...
        exploded-{project}
            ...
            WEB-INF
                ...
                appengine-web

I do not know why the file is "not there" when I can see it available exactly where it should be.

My appengine-web.xml file:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>{ID}</application>
    <use-google-connector-j>true</use-google-connector-j>
    <version>1</version>
    <threadsafe>true</threadsafe>
    <runtime>java8</runtime>
    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/classes/logging.properties" />
    </system-properties>
    <automatic-scaling>
        <!-- scaling details -->
    </automatic-scaling>
</appengine-web-app>

I do have one issue, the namespace is in red and I get the URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) message when I scroll over it.

I have attempted to fix this solution by fetching the resource, but that has not succeeded. I do not know if that may be the issue, but it is my only decent guess.

I need the appengine-web.xml file to be recognized in order to progress. If anyone knows what is going on, or has an idea to point me in the right direction, it will be appreciated.

TLDR:

There is a difference between a file that has name and a type you select, and a file name in the form {file-name}.{type}. If you want the file to be recognized, do the latter.

Details

Turns out, in the eyes of gradle, there is a massive difference between having a file named appengine-web and declaring it to be a .xml file and making a file named appengine-web.xml.

I added a new file that had the .xml as part of its name and that fixed the issue I was facing before.

Once I finished that, I ran into an identical issue with a file for logging properties (see the system-properties field in the .xml file in my question).

I created a file called logging and made it a .properties file, this file was not found. I then made a file called logging.properties and the file was successfully found.

Moral of the story, explicitly declare the file type in the name when dealing with Google App Engine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM