Google App Engine ThreadSafe - java

I have a Java project which is hosted through Google App Engine. I mistakenly changed ThreadSafe to false in the appengine-web.xml file, and since have changed it back to true. My application is now acting much slower and is throwing time out errors, which did not occur before I altered the appengine-web.xml file. Could it be the switching of ThreadSafe to false that is causing this behavior? Here is the configuration file:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>my_application_id</application>
<version>1</version>
<threadsafe>true</threadsafe>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<sessions-enabled>true</sessions-enabled>
</appengine-web-app>

You can try to shutdown all existing instances and restarting the app. This will ensure that the latest version is running.

Related

What's the right way to use Wildfly 10 with Hibernate and MongoDB?

I'm new to this, did a lot of research now and still I'm not able to develop a working Wildfly / Hibernate / MongoDB Environment.
Here is basically did so far:
Read this Guide
Download Wildfly 10
Download Hibernate OGM 5.1.0.Final and ORM 5.1.4 Modules Archive
Extract Modules into wildfly/modules
Download/Install MongoDB (i tried 2 Versions)
via Brew on Mac
via Ubuntu in an VM
Create new Maven Web Project in Netbeans
Next Step is to edit pom.xml, jboss-deployment-structure.xml, persistence.xml. And that's the Point where the trouble begins. I tried different entries and get different errors. Right now my configuration looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate.ogm" slot="5.1" services="export" />
<module name="org.hibernate.ogm.mongodb" slot="5.1" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
I saw different Versions of this file, sometimes with slot="main", sometimes with services="import".
Persitence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="comic-PU" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.1"/>
<property name="hibernate.ogm.datastore.provider" value="mongodb"/>
<property name="hibernate.ogm.datastore.database" value="comicDB"/>
<property name="hibernate.ogm.datastore.host" value="localhost"/>
<property name="hibernate.ogm.datastore.port" value="27017"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
I'am pretty sure here is something wrong. When deploying the Project, Wildfly tries to read persistence.xml, then stuck for a moment and:
20:58:33,255 INFO [org.jboss.as.jpa] (MSC service thread 1-6) WFLYJPA0002: Read persistence.xml for comic-PU
21:03:32,767 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'deploy' at address '[("deployment" => "MYAPP.war")]'
21:03:32,772 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0022: Deploy of deployment "ComicFeeder-1.0.war" was rolled back with no failure message
Pom.xml is mostly auto-generated, i added
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-core</artifactId>
<version>5.1.0.Final</version>
</dependency>
<archive>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<Dependencies>org.hibernate.ogm:5.1 services, org.hibernate.ogm.mongodb:5.1 services</Dependencies>
</manifestEntries>
</archive>
Is the manifest entry necessary?
An Errors I got:
Wildfly: org.hibernate.search.engine 5.6.1.Final not found
in wildfly/modules/org/hibernate/search/engine the modules name is "5.6.1.Final-orm51" -> renamed it to 5.6.1.Final, edit the Entry in 5.6.1.Final/modules.xml
Wildfly then starts without that error
This looks like a bug to me
Where is my mistake? What's your "workflow" when you start a new project with hibernate, wildfly and mongodb?
Would it be easier to use Glassfish or any other Server?
Some Tutorials I found are outdated or just did not work (for me).

Managed VM not running Cloud SQL Proxy

Launching a Managed VM with a Java application, the following appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>thmadmin-ben</application>
<version>master</version>
<threadsafe>true</threadsafe>
<vm>true</vm>
<manual-scaling>
<instances>1</instances>
</manual-scaling>
</appengine-web-app>
I don't appear to have a Cloud SQL proxy running on the managed VM. Do I need to add an app.yaml file or define something else in appengine-web.xml?
Per the documentation, you need to specify the instances which you will be connecting to as follows and redeploy your application.
When using appengine-web.xml, the syntax would be:
<beta-settings>
<setting name="cloud_sql_instances" value="<PROJECT-ID>:<REGION-NAME>:<SQL-INSTANCE-NAME>[, ...]" />
</beta-settings>
If this setting is not present, the Cloud SQL Proxy won't start.

Google App Engine 409 Conflict

I've had issues with the Google App Engine 409 conflict when trying to deploy my java application. I've looked at various other questions and had no success as of yet.
This is my appengine-web.xml file. As far as I can tell, there are no modules causing it to give me this error.
I have attempted to rollback the WEB-INF as well as the project itself, but none of it works for me.
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>app-id</application>
<version>${appengine.app.version}</version>
<threadsafe>true</threadsafe>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
If you need any other information let me know. I'm not very familiar with GAE yet, and so I don't know if some of those XML properties could cause it.
I've been looking around and on my console, the app engine version is 1.9.3, but my sdk is 1.9.1. That wouldn't have anything to do with it, would it?

Change Max http thread count jboss AS6.1.0.Final

I want to know where can I increase the Max thread count in Jboss AS 6.1.0.Final.
I surf through google but can not find exact answer and the files and locations mentioned there is not correct.
This is done with the Tomcat Executor. You can read the details in Thread Pool Configuration in AS 6.x.
A standalone descriptor may be written, whose name is, or ends with, "jboss-threads.xml". The format of such a descriptor will look like this:
<?xml version="1.0" encoding="UTF-8"?>
<threads xmlns="urn:jboss:threads:2.0">
<thread-factory name="MyThreadFactory" thread-name-pattern="My Thread %t">
<thread-group name="MyThreadGroup"/>
</thread-factory>
<!-- This is the Executor instance -->
<thread-factory-executor name="MyExecutor">
<thread-factory name="MyThreadFactory"/>
<max-threads count="100" per-cpu="100"/>
</thread-factory-executor>
</threads>
ALTERNATIVELY: You can include it in a Microcontainer Deployment.
Due to the way that the Microcontainer processes XML deployments, it is possible to include your threads descriptor in the midst of a regular POJO deployment, like this:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- JBossMC elements here -->
<threads xmlns="urn:jboss:threads:2.0">
<thread-factory name="MyThreadFactory" thread-name-pattern="My Thread %t">
<thread-group name="MyThreadGroup"/>
</thread-factory>
<!-- This is the Executor instance -->
<thread-factory-executor name="MyExecutor">
<thread-factory name="MyThreadFactory"/>
<max-threads count="100" per-cpu="100"/>
</thread-factory-executor>
</threads>
</deployment>

multiple DBs with Jboss 4.2.3

We are using Jboss 4.2.3 with EJBs and hibernate.
Currently we defined 3 db connections in our persistence.xml file (one for reads (tx-local), one for writes (no-tx) and one for statistics (no-tx)), and when we add a forth db connection which is also (no-tx) and map a couple of entities to it, the machine starts to show an unusual load.
If we remove this connection (no one is using it still) the load get back to normal.
I guess it is some sort of configuration problem with JBoss, but I'm not sure.
any assistance will be appreciated.
thanks.
this is the ds.xml file content:
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: feedback-ds.xml 71535 2008-04-01 07:05:03Z adrian#jboss.org $ -->
<!-- Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->
<datasources>
<no-tx-datasource>
<jndi-name>FeedbackDS</jndi-name>
<connection-url>jdbc:mysql://m6sdb:3306/m6sFeedbacks?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>password</password>
<min-pool-size>10</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>1000</max-pool-size>
<property name="hibernate.show.sql" value="true"></property>
<idle-timeout-minutes>10</idle-timeout-minutes>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- should only be used on drivers after 3.22.1 with "ping" support -->
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</no-tx-datasource>
</datasources>

Categories