appengine-web.xml does not contain a <threadsafe> element - java

Working on an app engine java application I am getting the error in the subject.
I have looked at similar questions that say that a
<threadsafe>true</threadsafe>
element should be added to appengine-web.xml, but my appengine-web.xml file is auto generted based on app.yaml and the instructions here do not provide any help...
I think it might be acheived using the instructions re "Custom XML Output" in that same page but they seem to be missing the part on how to actually do it...

The 'threadsafe' option would need to be appear in a place similar to the 'sessions-enabled' option. I suggest trying the following additional line in app.yaml after the 'runtime' line:
threadsafe: true
It's not documented, as you said, but 'sessions_enabled' corresponds to 'sessions-enabled', so it might work. ("feature!" ;-)

A minimal sample appengine-web.xml file looks like this as found here:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>_your_app_id_</application>
<version>1</version>
<threadsafe>true</threadsafe>
</appengine-web-app>

Related

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.

How to speed up deployment to Jetty?

Deployment to the Jetty server is very slow (around 45 seconds), which is tough for development, so I'm looking for advice on how to speed it up.
I'm using Maven with the Jetty plugin (jetty-maven-plugin), and the jetty:run goal on a vaadin project created from the archetype com.vaadin:vaadin-archetype-application.
I found reference here: wiki.eclipse.org/Jetty/Howto/Avoid_slow_deployment, and it makes sense that this is the problem, because there are many jar files to be scanned (from vaadin framework), but I cannot figure out where to put the xml file, what to name it, and how to get the maven jetty:run goal to use it (and I have tried lots of variations that I could think of!)
Any help is appreciated!
You can configure an individual context in the plugin either by adding attributes/parameters in the web.xml (for some limited things) or using a context xml file that applies to the context, which you need to specify with the contextXml element of the plugin configuration.
See https://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#configuring-your-webapp
P.S. Jetty 9 is a little faster in scanning etc.
Gregw pointed me in the right direction. Here is the complete detail of how I ended up resolving this:
1) I added a file named jetty-web.xml in my src/main/webapp/WEB-INF folder. It contained:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>nothing.jar</Arg>
</Call>
</Configure>
Note at this point I don't have any jars the need scanning, so I just put in a dummy entry of "nothing.jar" as the pattern to match.
2) Edit the jetty-maven-plugin's entry in pom.xml: in the section, I added
<contextXml>${basedir}/src/main/webapp/WEB-INF/jetty-web.xml</contextXml>
Now redeploys happen in just a couple seconds.

Why does weblogic not use my deployment plan?

I am having some trouble trying to adjust the deployment settings of our application in weblogic. I feel what I'm trying to do ought to be quite simple, but it's not working as expected.
I am just trying to override the context-root in weblogic.xml and the JNDI name for the data source, so these can both be configured at deployment time.
I have removed the application.xml from the ear file, so that shouldn't be affecting the overrides.
What I have so far:
weblogic.xml:
<context-root>mosaic</context-root>
<resource-description>
<res-ref-name>jdbc/LogicalDS</res-ref-name>
<jndi-name>LogicalDS</jndi-name>
</resource-description>
web.xml
<resource-ref>
<description>A logical reference to the datasource - mapped in deployment plan</description>
<res-ref-name>jdbc/LogicalDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
plan.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:deployment-plan xmlns:wls="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd" global-variables="true">
<!--weblogic-version:10.3.5-->
<wls:application-name>mosaic.ear</wls:application-name>
<wls:variable-definition>
<wls:variable>
<wls:name>datasource_name</wls:name>
<wls:value xsi:nil="true"></wls:value>
<wls:description>The name of the datasource to map to the mosaic application</wls:description>
</wls:variable>
<wls:variable>
<wls:name>new_context_root</wls:name>
<wls:value xsi:nil="true"></wls:value>
<wls:description>URL to deploy Mosaic at</wls:description>
</wls:variable>
</wls:variable-definition>
<wls:module-override>
<wls:module-name>mosaic.war</wls:module-name>
<wls:module-type>war</wls:module-type>
<wls:module-descriptor>
<wls:root-element>weblogic-web-app</wls:root-element>
<wls:uri>WEB-INF/weblogic.xml</wls:uri>
<wls:variable-assignment>
<wls:name>new_context_root</wls:name>
<wls:xpath>/weblogic-web-app/context-root</wls:xpath>
<wls:operation>replace</wls:operation>
</wls:variable-assignment>
<wls:variable-assignment>
<wls:description>Data source for mosaic application</wls:description>
<wls:name>datasource_name</wls:name>
<wls:xpath>/weblogic-web-app/resource-env-description/resource-env-ref-name</wls:xpath>
<wls:operation>replace</wls:operation>
</wls:variable-assignment>
<wls:variable-assignment>
<wls:name>datasource_name</wls:name>
<wls:xpath>/weblogic-web-app/resource-description/[res-ref-name="jdbc/LogicalDS"]/jndi-name</wls:xpath>
<wls:operation>replace</wls:operation>
</wls:variable-assignment>
</wls:module-descriptor>
</wls:module-override>
</wls:deployment-plan>
Nothing happens when I use the deployment plan, and none of the variables appear under the Deployment Plan configuration screens in the admin console. From what I understand, I should at least be asked for these variables, since I have specified that they are null in the deployment plan.
When I use WLST to browse the tree, I find that the runtime configuration just stays as the values in the deployment descriptors.
I have verified the deployment plan is being used in the general tab of the admin console.
Can anyone help me find out what I am doing wrong here ?
I see that you have "datasource_name" variable replacement twice. Is that intended? Your xpath appears to be incorrect:
resource-description/[res-ref-name=
etc.
Should it be:
resource-description[res-ref-name=
etc.
My suggestion is to change one thing at at time, for example, the web app context first, and test. The web app context can be also set in the admin console, so you should see the value there.
There are few good articles about deployment plan:
https://blogs.oracle.com/jamesbayer/entry/11gr1_update_and_a_deployment
http://m-button.blogspot.com/2008/08/how-to-use-deployment-plan.html
A good resource mapping doc:
http://docs.oracle.com/cd/E15523_01/web.1111/e13737/packagedjdbc.htm
(look for the diagram near the bottom).
Is your variable a "replace" or "define"?

How do I resolve duplicate property errors in this j2ee schema?

I inherited a J2EE app written for deployment on Weblogic 10 and the developer primarily responsible for this application does not get this error when he opens the project in Eclipse.
I have the following very simple weblogic.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/920/weblogic-web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
Eclipse generates a single XML validation problem for this file, which actually consists of a number of the same errors. The parent text of the XML problem is this:
The errors below were detected when validating the file "j2ee_1_4.xsd"
via the file "weblogic.xml". In most cases these errors can be
detected by validating "j2ee_1_4.xsd" directly. However it is
possible that errors will only occur when j2ee_1_4.xsd is validated in
the context of weblogic.xml.
And an example of the child errors. They all read this way:
sch-props.correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'http://java.sun.com/xml/ns/j2ee,descriptionGroup'.
This is followed by a line number. There are about 50 of these errors, and only the quoted name at the end of the error changes.
I found the following bug in Sun's bug tracker which seemed to indicate a possible cause, but I'm not sure how I'd apply it to my project, if it's even relevant.
Impossible to create javax.xml.validation.Schema instance from "web-app_2_4.xsd"
I can't help but think that this is related to my Eclipse configuration, but at this point I'm at a loss.
Thanks for your time.
I ran into the same issue. I found an article online about needing to update to the latest schema so I looked through Oracle for latest schemas versions here: http://www.oracle.com/webfolder/technetwork/weblogic/weblogic-web-app/index.html
I modified my weblogic.xml file with the following:
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
...
</weblogic-web-app>
Regards,
Jose
You say this is written for WL 10.
My weblogic.xml begins as
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app
http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
while I can see yours points to the Weblogic 9 namespace
xmlns="http://www.bea.com/ns/weblogic/90"
Does changing this make a difference?

GWT Module inheritance and NO source code available on application running time

I am starting to use GWT for a class project and wanted to know real use cases for RPC. So, I found this example on this same website: Stack Overflow - Simple RPC Use Case Problem (Code Included)
Why I did this example? because I was getting the same errors that the user posted on my own project and I decided to try and follow his code on my computer to see if I could really face my own mistakes.
So the point is that after copying the files on an Eclipse GWT project and deploy the app, I got this two errors on running time:
1st Error
12:14:07.874 [ERROR] [test] Line 17: No source code is available for type com.google.gwt.user.server.rpc.RemoteServiceServlet; did you forget to inherit a required module?
2nd Error
12:42:54.547 [ERROR] [test] Unable to find type 'org.redboffin.worldhug.client.test.Test'
12:14:09.341 [ERROR] [test] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
So I tried to correct Test.gwt.xml as Craig suggested on the post. Unfortunately, that solution is not working to me because still I am getting the same errors.
1st error: I don't know what is happening because, for example, in the file it is depicted, RemoteServiceServlet is imported some rows before (despite it is not seen). This file is on package "org.redboffin.worldhug.server.test;"
2nd error: If user who posted initial thread did not need to "inherit" a new package in his project, I can't understand why do I need them. Anyway, I put a new inherit line one the .gwt.xml file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='test'>
<inherits name="com.google.gwt.user.User" />
<entry-point class="org.redboffin.worldhug.client.test.Test"></entry-point>
<source path="client" />
<source path="shared" />
<inherits name="org.redboffin.worldhug.client.test.Test" />
</module>
And that is what I got:
Loading inherited module 'org.redboffin.worldhug.client.test.Test'
[ERROR] Unable to find 'org/redboffin/worldhug/client/test/Test.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
(of course, it didn't compile)
So, I really don't know what is going on. Please, can someone bring some light to this issue? Why is this not working? What I am doing bad? What is this type that it is needed on the 2nd error?
Hello Irene and other Web-Wanderers,
Maybe this is a double post on a already answered post or let me say it is a try to clarify about includes of Java Source code in the xml file. I got stuck at the same point, but I couldn't point out what Adrian meant. The last two source tags will tell what packages and trailed source files shall be compiled. That is why you should name each package in the attribute called "path".
The file below was auto-generated in Eclipse Indigo in Framework version: appengine-java-sdk-1.6.4.1. It is bereft of unnecessary comments.
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='wk_cms'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.json.JSON'/>
<inherits name='com.google.gwt.http.HTTP'/>
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='de.someproject.wkcms.client.Wk_cms'/>
<!-- Specify the paths for translatable code -->
<source path='client'/> <<-- my code (package client)
<source path='communication'/> <<-- my code (package communication)
</module>
I hope this keeps everyone afar from probing and testing before having success... =)
Best regards,
Semo
PS. The file edited was not web.xml but PROJECTNAME.gwt.xml.
Think I see it:
Test.java should be in the client.test package not just client, or everything should point to client.Test rather than client.test.Test.
Your server class seems to be under the package server.test, rather than just server, which is probably wrong. Check the mapping in web.xml correctly points to this class.
I suspect the real error is probably somewhere else though - I would have expected it still to compile.
(Not sure if I have to "answer your question" or not, first try on Stack Overflow site!)
Thanks for your comment, Adrian!
This is the content of "web.xml" file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Servlets -->
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>org.redboffin.worldhug.server.test.TestServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/worldhug/test/testService</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>test.html</welcome-file>
</welcome-file-list>
</web-app>
It seems that the servlet tag is pointing to the right place to my eyes: TestServiceImpl.java is inside package "org.redboffin.worldhug.server.test" Did you mean that?
Any other idea?
Thank you again! :)
You will have to include the following
<source path='client.test'/>

Categories