Guestbook app deployment error cloud SQL - google-app-engine

app engine log says
java.sql.SQLException: No suitable driver found for jdbc:mysql://173.194.111.127:3306/Guestbook
Help says make sure appengine-web.xml includes true which is the last line before in my file. I could use some help getting this connection to work.

A couple of things that you should check:
Please make sure that the MySQL JAR file is present in your WEB-INF\lib directory.
Once that is done, you can ensure that you enable the MySQL/ConnectorJ (https://developers.google.com/appengine/docs/java/cloud-sql/#enable_connector_j). As mentioned in the document, go to war\WEB-INF folder. You will find the appengine-web.xml file. Inside this file, enable the JAR file as given below:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
...
<use-google-connector-j>true</use-google-connector-j>
...
</appengine-web-app>

According to the documentation you should only be using the "jdbc:mysql" connection string for local development. For running on appengine you should use jdbc:google:mysql.

Related

can data-import-handler use HikariCP?

I'm using solr4.5.1 in work.
The trouble is that a lot of getConnection occurred, when I execute data-import(full-import). So I thought if HikariCP could be used in data-import, but I haven't found similar problem.
Is it possible? If so please advice.
Solr 4.5.1 with Tomcat
data-config.xml
<dataSource driver="oracle.jdbc.driver.OracleDriver"
name="jdbc"
url="jdbc:oracle:thin:#address/mydb"
user="user" password="pass"/>
Heavily borrowed from David H Nebinger's post: Tomcat and HikariCP.
Install HikariCP
To make use of JNDI, you need to declare the JNDI datasource with all its' settings, password and cache options within the JNDI declaration. This has nothing to do with Solr at this point. This is a Tomcat mechanism. How you do this is described in this tutorial that also makes use of HikariCP.
First is to download the .zip or .tar.gz file from http://brettwooldridge.github.io/HikariCP/. This is actually a source release that you'll need to build yourself.
Second option is to download the built jar from a source like Maven Central, https://mvnrepository.com/artifact/com.zaxxer/HikariCP
Once you have the jar, copy to the Tomcat lib/ext directory. Note that Hikari CP does have a dependency on SLF4J, so you'll need to put that jar into lib/ext too.
Do not forget to place your datasource's JDBC driver in the lib/ext folder.
Configure the JNDI datasource
Location of your JNDI datasource <Resource /> definitions depends upon the scope for the connections. You can define them globally by specifying them in Tomcat's conf/server.xml and conf/context.xml, or you can scope them to individual applications by defining them in conf/Catalina/localhost/WebAppContext.xml (where WebAppContext is the web application context for the app, basically the directory name from Tomcat's webapps directory).
Create the file conf/Catalina/localhost/ROOT.xml if it doesn't already exist. Use the table from https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names to find your data source class name, we'll need it when we define the element.
<Resource name="jdbc/SolrPool" auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
minimumIdle="5"
maximumPoolSize="10"
connectionTimeout="300000"
dataSourceClassName="oracle.jdbc.pool.OracleDataSource"
dataSource.url="jdbc:oracle:thin:#address/mydb"
dataSource.implicitCachingEnabled="true"
dataSource.user="user"
dataSource.password="pass" />
Make use of the JNDI datasource in Solr
After you have followed this tutorial, you will need to use the declared JNDI datasource, this would be like described in the Solr Wiki:
<dataSource
jndiName="java:jdbc/SolrPool"
type="JdbcDataSource"
user="" password=""/> <!-- leave out user/password here -->

How to install solr-4.6.1 on ubuntu using tomcat7?

I want step by step instructions for installation of solr search engine using tomcat7 on ubuntu. I searched on google but I am not getting proper reference. Please help me to install it.
1- Download Solr dist: here. Unzip it anywhere.
2- find $EXTRACTEDDIR/solr/dist/solr-4.6.1.war and copy it to the location you want to configure solr.
3- configure the solr.xml as explained here. You will need to change your hostport to 8080(or what ever port tomcat7 is configured) and put it where you put solr-4.6.1.war
4- create /etc/tomcat7/Catalina/localhost/solr.xml and put
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="$SOLRBASE/solr-4.6.1.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="$SOLRBASE" override="true" />
</Context>
replace SOLRBASE with the loacation you put solr.war and solr.xml.
5- copy $EXTRACTEDDIR/example/lib/ext/* . * to /usr/share/tomcat7/lib(for loging libs)
6- give permissions of the folder where you put solr.war and solr.xml to "tomcat7" user.
7- restart tomcat and you are done.
copy the solr files to ubuntu.
copy the file "solr.war" into "%tomcat_home%/webapps/" and add the solr service's context to the "%tomcat_home%/server.xml"
set the environment value "solr/home" int server.xml or web.xml
visit here for detail:https://wiki.apache.org/solr/SolrTomcat
it's a piece of cake, may you succeed!

Why tomcat7 can't read my context.xml?

I'm trying to integrate apache solr4.5 with tomcat7.0.
Here is my prob, I make a directory named "solr" under $CATALINA_BASE/webapps, and create an context.xml under the path, which the directory structure looks like.
$CATALINA_BASE/webapps/solr/META-INF/context.xml
The context.xml looks like as follow:
<?xml version="1.0" encoding="utf-8" ?>
<Context docBase="/solr/home/root/solr.war">
<Environment name="solr/home" type="java.lang.String" value="/solr/home/root" />
</Context>
I was expecting when I visit "localhost:8080/solr/", the solr webapp should work fine, but what I got is some errors like this:
HTTP Status 404 - /solr/
type Status report
message /solr/
description The requested resource (/solr/) is not available.
Apache Tomcat/7.0.26
But according to the apache tomcat7.0 document,
Individual Context elements may be explicitly defined:
In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML
attribute) this may be copied to
$CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to
application's base file name plus a ".xml" extension.
In individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context
path and version will be derived from the base name of the file (the
file name less the .xml extension). This file will always take
precedence over any context.xml file packaged in the web
application's META-INF directory.
Inside a Host element in the main conf/server.xml.
So, please anyone give me some clues, thanks.
If you check the catalina log file located in /logs, you will probably see some errors from Solr, one of which will be:
SEVERE: Error filterStart
This is due to a change in the way that logging in general is now implemented within Solr as of version 4.3. Please refer to SolrLogging - Using the example logging setup in containers other than Jetty for the necessary steps to setup logging within Tomcat.
This should resolve your issue.
Try placing your context.xml (for all webapps) or solr.xml (solr only) file in Catalina/localhost folder instead.
For instance:
<Context docBase="webapps/solr.war" allowLinking="true" reloadable="true">
<Environment name="solr/home" type="java.lang.String" value="/opt/solr" override="true" />
</Context>
Troubleshooting:
check your logs, e.g.:
cd /var/log/tomcat? && tail -f *.log *.out *.txt

Jdeveloper war deployment to tomcat

I am a newbie.
I am trying to publish procedures which return refcursor as webservice.
As webservices do not support ref cursor return type so I chnaged the return type to pl/sql table.
I created the jax rpc in Jdeveloper studio 11.1.2.4.0 and tested it. This runs ok. I need to deploy it on tomcat server and am failing completely.
I copied the war file generated by Jdeveloper to the webapps directory in Tomcat and started Tomcat but this didn't work, as the following exception was thrown:
java.lang.ClassCastException: omsdevconn.MyWebServicetomcatUser cannot be cast to javax.servlet.Servlet
If someone has done it then can I get the steps for the process to deploy it on Tomcat 6.0.37?
Thanks in advance
Download jaxws-rt-2.0-SNAPSHOT.jar and jaxws-2_0.jar
Copy into $CATALINA_HOME/lib folder
Add the following in web.xml under web-app
<web-app>
**<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>**
............<!--your other servlet definations-->
</web-app>
create sun-jaxws.xml under your applications web-inf folder and configure endpoints.You can have a look at jdeveloper generated xml file to get all the information
sample sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"version="2.0">
<endpoint name="fromwsdl"
interface="com.foo.yourserviceInterface"
implementation="com.foo.yourserviceClass"
wsdl="WEB-INF/wsdl/youservice.wsdl"
service="YourService"
port="YourServicePort"
url-pattern="/serviceAccessUrl" />
</endpoints>
create war for your application and deploy you application under tomcat/webapps
start tomcat
After starting tomcat you can access the service as
http:/host:port/yourservicename/methodInService
As you are calling oracle plsql code and IF you are using any oracle specific calls like OracleCallabelStatement then on run time you will get class cast exceptions from tomcat datasource when trying to cast callabelstatement to oraclecallabelstatement for that you need to configure oracledatasource in tomcat
http://www.oracle.com/technetwork/articles/oem/ucp-jdbc-tomcat-355431.html
More information on Java API for XML Web Services (JAX-WS)
https://jax-ws.java.net/nonav/2.2.1/docs/UsersGuide.html#1.0_Introduction
Another way to deploy service generated by Jdeveloper when exposing a plsql procedure as webservice
I am not allowed to post more that 2 links so please add and extra "/" after http: to correct the links
This solution uses Apache Axis which allows you to call your web service(which is not exposed as restful) directly from browser by creating a SOAP request behind the scenes and involke the service method giving it soap message.
1)Generate a webservice in Jdeveloper .It will create java files and corresponding ".class" file , "wsdl file" in web-inf and some other xml files. Make a note of LOCATION of .class file and wsdl file.
2)Download eclipse and extract it on your hard drive (It needs java to run So you must have java installed on system .You can download eclipse from
http:/www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/junosr1
3)Download Axis plugin for eclipse from here :
http:/www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.6.2/axis2-eclipse-service-plugin-1.6.2.zip
and install it in eclipse. Installation Instructions :
http:/axis.apache.org/axis2/java/core/tools/eclipse/plugin-installation.html
4)Generate the aar file via eclipse axis plugin. Instructions :
http:/axis.apache.org/axis2/java/core/tools/eclipse/servicearchiver-plugin.html#Operation
5)Make following changes in tomcat-user.xml file
<role rolename="tomcat"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="manager-jmx"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui,admin-gui,manager-jmx"/>
6)IF YOU ARE USING ORACLE SPECIFIC CLASSES IN CODE (Which most probably Jdeveloper will produce) : Configure a oracle data source in tomcat (server.xml or context.xml). Instructions :
http:/www.oracle.com/technetwork/articles/oem/ucp-jdbc-tomcat-355431.html
Make sure you have ojdbc6.jar and ucp.jar in Tomcat/lib folder.
7)Download axis war file to deploy in tomcat from here :
http:/www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.6.2/axis2-eclipse-service-plugin-1.6.2.zip
Unzip the zip , it will have a axis2.war file in it. Put this war file under “\Tomcat\webapps” directory
8)Start tomcat. On tomcat console see if there are any errors in deploying axis. If everything is fine you should be able to see axis page on http:/yourhost:yourport/axis2/
9)Click on Administration link . Enter user id “admin” and password “Axis2” and login
10)Click upload and browse to the location of aar file you generate in step 4 and upload. After it shows you success click on Available service. It takes a bit of time but you should be able to see you service.Click on service to see wsdl to verify
11)Call your service method from browser and cross your fingers and toes.
Note that the link to hit will be something Like
http:/yourhost:yourport/axis2/services/YourServiceName/serviceMethod?arg1=blah&
Make sure your got the arg names right.you should be able to see the correct names from wsdl

Google App Engine Bulkloader “Authentication Failed”

I'm trying to use the bulkloader to load my data to the App-Engine server. I run the following command using Python 2.5:-
appcfg.py upload_data --application=myappname --kind=mykind
--filename=data_archive.csv --url=http://myappname.appspot.com/remote_api
But its failing with this Authentication error:-
[INFO ] Connecting to myappname.appspot.com/remote_api
[ERROR ] Exception during authentication
URLError: <urlopen error [Errno 10061] No connection could
be made because the target machine actively refused it>
[INFO ] Authentication Failed
My idea is to do a bulk download from my development server and then use this dump to do a upload to the app-engine server. The bulk download worked fine. I used this format for this:-
appcfg.py download_data --application=myappname --kind=mykind
--url=http://localhost:8888/remote_api --filename=data_archive.csv
But the bulk upoad fails. A couple of things: the bulk download asked me for a userid and password, but the bulk upload does not. Also, I don't currently have a app.yaml file which I see mentioned a lot - do I need one to do this ?
Thanks in advance for any help.
M.
EDIT
For anyone else struggling with this, the problem was indeed being behind the proxy server, but there was another 'error' with what is above. The app-id needs the "s~" bit added to it.
appcfg.py upload_data --application=s~myappname --kind=mykind
--filename=data_archive.csv --url=http://myappname.appspot.com/remote_api
This isn't an authentication issue - that message is a red-herring - your machine is unable to contact the App Engine app at all. Do you have a proxy you need to transit through in order to make external connections?
You do not need --application=s~myappname when using bulkloader - Google have mentioned before:
Warning! Do not use the --application= flag to get the application ID
when using the bulk loader. Instead, use --url=.
For more detail take a look here:
https://developers.google.com/appengine/docs/python/tools/uploadingdata
app.yaml is how it finds your server. I am not sure how you can try and upload without one.
In addition to having an app.yaml that points to the production server, the production server also needs to have remote_api turned on (in it's app.yaml and in the version you are trying to reach):
builtins:
- remote_api: on

Resources