I've made a Google Web Application Project in Eclipse and am now running into problems as I need to use from a server side point of view, with Hibernate with MySQL. I've just been told that Google Web Application projects can't run Hibernate connections to MySQL as they're deployed projects.
What's the best way for me to migrate this project somehow so it runs on say Glassfish and just uses GWT for the client side technologies that can then use Hibernate and MySQL, rather than actually being deployed?
Thanks,
David
You cannot access database from client-side directly.
GWT translates your client-side java code into Javascript which runs in browser; there is no way to directly access JDBC.
You will have to employ server-side which will handle your DB persistence. Your client can communicate via GWT-RPC, JSON, XML, or any other protocol - but the database connection part will always reside on server.
Note that the server part does not need to be in Java - it can use PHP or any other technology, as long as it understands the javascript generated out of your app.
Related
I am new to neo4j and based on the reading I have done so far it seem there are two ways to interact with neo4j using Neo4j REST and Embedded. Where I am a little confused is does the Embedded option only give you the ability use the native Neo4j API to manipulate the datastore or can you also embed Neo4j and package it with your java application and if so how would I go about doing it?
As far as I know, Embedded term coined out to integrate neo4j with your application. In embedded mode, your db is locked and your application is solely authorized to access it. You can not access your db from any where else as far as your application is running and accessing it.
Where as in Neo4j Rest or Say Neo4j Server support REST API through which you can perform all the data store related operation via API call. In Rest API mode, you can handle your db externally using Neo4j GUI console along with your application.
Performance wise, I found embedded mode is much faster than Server mode.
does the Embedded option only give you the ability use the native Neo4j API to manipulate the datastore
You can use either of mode (Server REST API mode or embedded mode) to manipulate datastore.
Package with Java Application
it depends on your application configuration, in embedded mode you generally don't need external neo4j server running. You just need to explicitly mention your db path along with other configuration (I have used Spring data neo4j). Where as in Neo4j Server mode, you will require neo4j server running.
You can have look on this thread as well.
Hi I'm sorry for the naivety of this problem but I need some guidance as I have confused myself greatly.
I have been tasked with creating a database(mysql) and creating a web interface for i to be interacted with. I have experience with web design and database development. Previously I have used java to interact with a DB and was hoping I could use JSP for the web interface. This is where my problem is, how I would I deploy/host this website?
I have 2 theories which are misguided:
(A). Use a cms which has a web server for me to place the jsps in?
or
(B). Use a domian/web hosting site that has a server for me to place the jsps in?
I'm totally lost and any guidance would be greatly appreciated.
Simple answer is you will require a Java Application Server to host your JSPs.
You can use Apache Tomcat, GlassFish, or some other application server to do this.
You will also need a database e.g MySQL running on your host or some other host accessible by the machine running the Java application server.
You can choose to host all of this locally or farm it out to a web host provider depending on your resources.
A CMS seems like overkill. See this link for a description of CMS and its functionality. I don't believe this is what you are looking.
I don't know exactly what you're looking for, but I think you need (B)
You need a MySQL instance running your database and a servlet container (e.g. Tomcat) to host your JSPs.
Running a CMS which is just used to use the DB that it works with is a little bit heavy for that usecase.
As suggested by Mr #cmd , yes there is no need to go for an outsourced server just to host your website, unless you need it to be visible to the world.
Else for your testing purpose, you can use Any of the Apache Tomcat, Glassfish servers for hosting the applications designed in JSP or in other web interface language.
And Inside of the JSP coding itself you may write the interaction coding with your database.
your database also can be installed in the same server.
And actually instead of a server, you may even use your PC to install the Apache Tomcat and the database and start using it.
I've read some articles on the Internet that this is not possible. To communicate own SQL database that is located on other server from GWT application. Jetty doesn't allow it.
I found a way how to perform it but it's not very cosy. I have client and server part inside GWT. The server has to communicate with MySQL database on localhost. So I've written an ant script to build a war that I can launch on Apache Tomcat server. It works perfectly there but I'm not able to debug the code effectively.
Do you have some advices how to perform this task? I was thinking of writing the clienty only in GWT and find some waz how to communicate my own server written outside the GWT. I've found Apache Thrift for GWT but this edited library of thrift seem not to work properly.
Thank you very much for your answers:)
It is possible to communicate with a database from a GWT application. The client side has to call the methods of the server via GWT-RPC, which can communicate with any database.
Maybe Jetty does not support it (have not tested it personally) but you can develop your web application using Apache too. There you can access the database the same way as from any web application:
You will need the mysql-connector-java-5.1.20-bin.jar file (downloadable from: http://dev.mysql.com/downloads/connector/j/ ), and restart the server added to the $CATALINA_HOME/common/lib directory.
OR added to the WEB-INF/lib folder of your web application.
You can find tutorials online of how to develop an application using Tomcat instead of Jetty. For example: https://wiki.auckland.ac.nz/display/BeSTGRID/Deploying+GWT+to+Tomcat+in+Eclipse
Reshi, stop and think about how applications really work. Nobody provides web pages with javascript to read/write databases, that would be crazy and unsecure. Servers are always in themiddle of all communication in this case. You need to create services that run inside your server, one of these services will be a database layer.
Javascript cant create network connections and read/write binary data, thus it would be insane to attempt to get the gwt compiler to compile any jdbc drvier and more.
Jetty does NOT stop us from connecting to a database. All you have to do is to follow the MVP model way. Although MVP is better bet against all hurdles, at a minimal point, you would have to try not having SQL code on the client package.
I want to run a standalone java application on a remote server. It would not be accessible to clients, but would do background calculations and interact with a database and Secure Socket connection to a third party site. It would also interact with a php site.
Do I have to deploy this with JSP, or can I write a standalone application? If so, how would I deploy a standalone java application (jar file) on a remote server? I understand that I must have them install a jvm on the server (not a problem) but then how would I deploy it (if possible). Would I start it with a command line?
I know I have much to learn, but I am not sure how I would access the command line on a remote server. Through the cPanel?
Thanks.
First of all, you'll want to set up some firewall rules to allow access to that server. I'm hoping that you don't expose that server naked to the Internet.
If all you need is database access exposed on the Internet, I don't see why it can't be a secured web app deployed on a servlet/JSP engine and accessed via a web server. You can leverage basic auth for security, JDBC access to the database from the server, and servlets as controllers to accept requests in a nice REST API.
It'll save you the complications of sockets and inventing your own protocol (use HTTP), starting and stopping the application (now it's just a web server/servlet engine), and deployment (send a WAR file).
Does it really must be a 'standalone' application? I think that in your case the best match would be to use Spring container to load your application within some server (tomcat?) and expose services via standard controllers - with Spring you only have to add some annotations on services methods actually.
Then, your php site can interact with these controllers using for example ajax requests.
If your application is written already, you can easily transform it to run within Spring container. It's very non-invasive and promotes usage of POJOs.
My web application is made with Java, specifically with the Google Web Toolkit (GWT). The back-end used
GWT RPC RemoteServiceServlet
Hibernate/Java
MongoDB (via Morphia)
and other Java libraries
I really did not use any Spring framework at all, will my web application be able to be deployed in a CloudFoundry MicroCloud and in CloudFoundry.com hosting?
Will I be needing to reconfiguring my web application that has been tested and deployed in a Tomcat Server with MySQL and MongoDB database?
GWT should not be an issue.
If you want to deploy a java web app not using Spring, you can deploy it as a java web app, then parse the VCAP_SERVICES manually to configure your data sources from the application.
See http://blog.springsource.org/2011/10/13/using-cloud-foundry-services-with-spring-part-1-the-basics/ for details
https://github.com/SpringSource/cloudfoundry-samples/tree/master/hello-java
Why wouldn't it work?
In the event it wouldn't, that wouldn't be because of GWT at least: GWT-RPC runs in AppEngine, so there's no reason it wouldn't work in CloudFoundry.