Having the following error when trying to deploy AppEngine with Java8:
Execution failed for task ':endpoints:endpointsDiscoveryDocs'.
> Unrecognized element <vpc-access-connector>
This element is available since 2019 and I'm using a recent version of appengine.
here is part of the appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<threadsafe>true</threadsafe>
<instance-class>F4</instance-class>
<runtime>java8</runtime>
<vpc-access-connector>
<name>name</name>
<egress-setting>private-ranges-only</egress-setting>
</vpc-access-connector>
any ideas what might be wrong?
Related
I am working on Windows and tried the tutorial at https://cloud.google.com/appengine/docs/java/
That worked fine when I tested locally but when uploading it using
"mvn appengine:update" I get the following
"Either the access code is invalid or the OAuth token is revoked.Details: invalid
_grant
.'cmd' is not recognized as an internal or external command,
operable program or batch file."
The appengine-web.xml file looks like this
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>spline-1270</application>
<version>1</version>
<threadsafe>true</threadsafe>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
Any ideas on what is wrong here?
I want to mention that there was no browser opened to be invited to enter the credentials for Google account.
Thanks,
Sorin
I just found the solution: Delete the C:/Users/yourUser/.appcfg_oauth2_tokens_java". Then re-run mvn appengine:update. It will ask again for credentials.
How can I specify both module and version in GAE/J cron?
I read this page.
The target string is prepended to your app's hostname.
It is usually the name of a module.
The cron job will be routed to the default version of the named module.
Note that if the default version of the module changes,
the job will run in the new default version.
If there is no module with the name assigend to target,
the name is assumed to be an app version, and App Engine will attempt to
route the job to that version. See About appengine-web.xml
My understanding is that either module name or version can be specified in <target>, but I want to specify both module name and version.
How can I do that?
For achieving your goal, you will need to look for two files (appengine-web.xml, cron.xml), As you already said the target tag of your cron.xml will allow you to set the module or version name, So to be able to do what you need, you can set the app name and module version in appengine-web.xml, Then you can define the module name in the target tag of your cron.xml.
An App Engine Java app must have a file named appengine-web.xml in its WAR, in the directory WEB-INF. This is an XML file whose root element is <appengine-web-app>. A minimal file that specifies the application ID, a version identifier, and no static files or resource files looks like this:
<?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>
A cron.xml file in the WEB-INF directory of your application (alongside appengine-web.xml) controls cron for your Java application. The following is an example cron.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/weeklyreport</url>
<description>Mail out a weekly report</description>
<schedule>every monday 08:30</schedule>
<timezone>America/New_York</timezone>
<target>version-2</target>
</cron>
</cronentries>
Hope it helps
You will achive your goal if you specify target in such format: "version-dot-module"
this is worked for me:
<cron>
<url>/cron/test-cron</url>
<description>test-cron</description>
<schedule>every 1 minutes synchronized</schedule>
<target>v-5-1-dot-my-module-name</target>
</cron>
v-5-1 - version of my module
my-module-name - name of my module
My tomcat deployment is failing every time with the following error:
403 Access Denied
You are not authorized to view this page.
This is my tomacat-users.xml:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-gui"/>
<user username="bhaskar" password="bhaskar007" roles="manager-gui"/>
</tomcat-users>
I don't know what am I doing wrong in this case. Tomcat manager is allowing me to login but not to deploy. Please help as I am prestty sure that my deployment path is correct.
I am a google app engine newbie.
I have an encoding issue with a wicket application in GAE.
(see http://ristorante-lastoria.appspot.com/wicket/home )
My IDE is configured to save the HTML template files in UTF-8.
I ve printed out the default file.encoding used by GAE JVM and it's ASCII.
I 've tried to set the following parameters in the appengine-web.xml.
<system-properties>
<property name="file.encoding" value="UTF-8" />
</system-properties>
<env-variables>
<env-var name="DEFAULT_ENCODING" value="UTF-8" />
<env-var name="APP_ENCODING" value="UTF-8" />
</env-variables>
I ve tried to set the flag --compile-encoding=UTF-8 when uploading the war content to the server.
At the build level(using maven), I tried to escape the unicode characters in the build using the native2ascii tool.
No luck so far :-(
Wicket version: 1.4.17
TIA
Add a xml declaration wirh encoding to all your templates:
<?xml version="1.0" encoding="UTF-8" ?>
I developed a Java web application in Netbeans 6.5 using a MySQL database and Hibernate. Both the development database server and development application server (Tomcat 6) reside on my development machine. Everything works; the application pulls data from the database correctly.
Now, I'm ready to move it to the production server. Again, the DB server and app server are on the same machine. I deploy the WAR file and try to access the application; I can access the static pages but the Servlets that use the database error out with the exception:
org.hibernate.exception.JDBCConnectionException: Cannot open connection
I'm pretty sure the problem relates to Tomcat not knowing about the data source. It seems as if Netbeans handles this for me. I've read that I might need to add a RESOURCE entry so I took some advice from this site which gave me a context.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/EmployeeDirectory">
<Resource
name="jdbc/employeedirectory" auth="Container"
type="javax.sql.DataSource" username="EmployeeDir"
password="EmployeeDirectory" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/EmployeeDirectory?autoReconnect=true"
maxActive="15" maxIdle="7"
validationQuery="Select 1" />
</Context>
a web.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Omit Servlet Info -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/employeedirectory</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
and a hibernate.cfg.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/employeedirectory</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Omit other Mappings -->
<mapping class="EmployeeDirectory.data.PhoneNumber" resource="EmployeeDirectory/data/PhoneNumber.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Now, I get a org.hibernate.HibernateException: Could not find datasource error.
Am I on the right path for moving from development to production? What am I missing?
I think you are on the right track. I would first set up the datasource and verify it out side of hibernate. Here is a good article on that: http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.htm and some examples here: http://www.mbaworld.com/docs/jndi-datasource-examples-howto.html
Then, I would configure hibernate to use the datsource. From looking at your hibernate.cfg.xml file I think you should try changing hibernate.connection.datasource to jdbc/employeedirectory
the jndi datasource should be defined in /tomcat/server.xml see Tomcat JNDI Datasource how-to and not in webapp/context.xml
Tomcat 6 requires that you add the resource tag to the context.xml, not the server.xml. You could in Tomcat 5.x. I have it working fine in a separate install of Tomcat, but I'm still trying to use connection pooling inside NB 6.5.
That same Apache site has a link to the Tomcat 6 version of JNDI and it tells you to add the resource tag to the context.xml.