Using Oracle and Hibernate in Google Web Toolkit's Hosted Mode.

203 views
Skip to first unread message

keyboard_samurai

unread,
Apr 19, 2010, 8:29:04 AM4/19/10
to Google Web Toolkit
Hello,

I need to know if anyone is able to query the database for fetching
data. This is a common requirement for most of the applications to use
database.If Hosted Mode doesnt support it then how are the users of
GWT developing ?

Do let me know !!

I get an exception while connecting to database using JDBC below is
the trace of it.

java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory
is a restricted class. Please see the Google App Engine developer's
guide for more details.
at
com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:
51)
at
oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:270)
at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213)
at java.security.AccessController.doPrivileged(Native Method)

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Sripathi Krishnan

unread,
Apr 19, 2010, 8:32:41 AM4/19/10
to google-we...@googlegroups.com
Disable Google App Engine in your eclipse settings. GAE does not allow you to use databases or open network connections.

--Sri

keyboard_samurai

unread,
Apr 19, 2010, 10:55:00 AM4/19/10
to Google Web Toolkit
Then do you replace tomcat with GAE ? i want to have the benefits of
Hosted mode i.e auto compile and debug ???



On Apr 19, 5:32 pm, Sripathi Krishnan <sripathikrish...@gmail.com>
wrote:
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/google-web-toolkit?hl=en.

Jason Hatton

unread,
Apr 19, 2010, 11:45:39 AM4/19/10
to google-we...@googlegroups.com
You will get that with just GWT.

keyboard_samurai

unread,
Apr 19, 2010, 11:53:37 AM4/19/10
to Google Web Toolkit
awesome do we have a article how to get this done ???

and also does it gets integrated with eclipse ?

Regards,
-Yogesh
> > <google-web-toolkit%2Bunsu...@googlegroups.com<google-web-toolkit%252Buns...@googlegroups.com>

Jason Hatton

unread,
Apr 19, 2010, 12:10:56 PM4/19/10
to google-we...@googlegroups.com
keyboard-samurai I would highly recommend you check out the Google I/O GWT Best Practices video.  It talks about gwt-dispatch and MVP.

You will want to implement your connections to Oracle/Hibernate in the GWT-RPC servlets.  The project I am on we are using our own extension of the gwt-dispatch project's servlet to initialize a Spring context.

Our web.xml looks like this:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
 
<!-- Servlets -->
<servlet>
<servlet-name>dispatchServlet</servlet-name>
<servlet-class>com.own.custom.extended.server.StandardDispatchServiceServlet</servlet-class>
</servlet>
 
<servlet-mapping>
<servlet-name>dispatchServlet</servlet-name>
<url-pattern>/client/dispatch</url-pattern>
</servlet-mapping>

Our applicationContext.xml sits in the WEB-INF/classes directory.  Nothing but standard Spring stuff there including the necessary things to get Hibernate working.   If you want to skip Spring I am not going to be of much help there but, I am sure it can be done.

Jas

keyboard_samurai

unread,
Apr 20, 2010, 11:14:44 AM4/20/10
to Google Web Toolkit
Hi Jason Thanks for the quick reply .. About GWT-Dispatch i will
surely look into it from my project point of view i dont want to have
one more framework over and above GWT now on server side ... But yes
we are using spring.

As i understand this issue.. we cannot connect to database using
Hosted Mode. Then in projects where you need database support is
everyone developing just the client part using the GWT Plugin and
enable the database support when they deploy it on to tomcat ?

This seems too long a process to follow.

Please let me know

Thanks

On Apr 19, 9:10 pm, Jason Hatton <jashat...@gmail.com> wrote:
> keyboard-samurai I would highly recommend you check out the Google I/O GWT
> Best Practices <http://www.youtube.com/watch?v=PDuhR18-EdM> video.  It talks
> > > > <google-web-toolkit%2Bunsu...@googlegroups.com<google-web-toolkit%252Buns...@googlegroups.com>
> > <google-web-toolkit%252Buns...@googlegroups.com<google-web-toolkit%25252Bun...@googlegroups.com>
>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Google Web Toolkit" group.
> > > > > To post to this group, send email to
> > google-we...@googlegroups.com
> > > > .
> > > > > To unsubscribe from this group, send email to
> > > > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > <google-web-toolkit%2Bunsu...@googlegroups.com<google-web-toolkit%252Buns...@googlegroups.com>
>
> > > > .

kozura

unread,
Apr 20, 2010, 11:37:15 AM4/20/10
to Google Web Toolkit
Not at all, you can do anything you want in Java on the server side,
including connecting to databases etc, and have it work in hosted
(development) mode.

The only restriction pointed out above is if you have GAE turned on,
you cannot use databases or other things that cannot work in a
deployed App Engine.

On Apr 20, 9:14 am, keyboard_samurai <yog...@gmail.com> wrote:
> Hi Jason Thanks for the quick reply .. About GWT-Dispatch i will
> surely look into it from my project point of view i dont want to have
> one more framework over and above GWT now on server side ... But yes
> we are using spring.
>
> As i understand this issue.. we cannot connect to database using
> Hosted Mode. Then in projects where you need database support is
> everyone developing just the client part using the GWT Plugin and
> enable the database support when they deploy it on to tomcat ?
>
> This seems too long a process to follow.
>
> Please let me know
>
> Thanks

keyboard_samurai

unread,
Apr 20, 2010, 12:45:17 PM4/20/10
to Google Web Toolkit
"Not at all, you can do anything you want in Java on the server side,
including connecting to databases etc, and have it work in hosted
(development) mode. "

Can you tell me how ???

Thanks !!

kozura

unread,
Apr 20, 2010, 1:05:22 PM4/20/10
to Google Web Toolkit
Not sure where your trouble spot is, but the easiest way is just to
use GWT-RPC, as described here with an example:

http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html

Create a Synchronous and matching Asynchronous interface, then in the
server code implement the Synchronous interface to do all your server-
side stuff, access databases, whatever. When you start Hosted/Dev
mode, GWT will start a Jetty (or tomcat in older GWT versions) server
which runs your server code concurrently with your client code so that
you can debug them together.

On Apr 20, 10:45 am, keyboard_samurai <yog...@gmail.com> wrote:
> "Not at all, you can do anything you want in Java on the server side,
> including connecting to databases etc, and have it work in hosted
> (development) mode. "
>
> Can you tell me how ???
>
> Thanks !!

keyboard_samurai

unread,
Apr 20, 2010, 1:31:49 PM4/20/10
to Google Web Toolkit
The Jetty Environment does not let me create database connections as
it has restricted the API usage.:)

and hence i am getting an exception which has been described in the
first post.

Thanks!


On Apr 20, 10:05 pm, kozura <koz...@gmail.com> wrote:
> Not sure where your trouble spot is, but the easiest way is just to
> use GWT-RPC, as described here with an example:
>
> http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunicat...

keyboard_samurai

unread,
Apr 20, 2010, 2:45:51 PM4/20/10
to Google Web Toolkit
BTW i am on GWT 1.7.

kozura

unread,
Apr 20, 2010, 2:44:01 PM4/20/10
to Google Web Toolkit
Prev reply didn't go through..

As mentioned before, this is because you have Google App Engine
enabled, not a Jetty or other GWT restriction. You need to remove it
from your run configuration. Open up the Project's properties, click
Google->App Engine, and uncheck "Use App Engine".

On Apr 20, 11:31 am, keyboard_samurai <yog...@gmail.com> wrote:
> The Jetty Environment does not let me create database connections as
> it has restricted the API usage.:)
>
> and hence i am getting an exception which has been described in the
> first post.
>
> Thanks!
>

kozura

unread,
Apr 20, 2010, 2:06:15 PM4/20/10
to Google Web Toolkit
As mentioned before, this is because you appear to have Google App
Engine enabled, not from Jetty itself. You need to remove GAE from
your project. If you see something like:

-server com.google.appengine.tools.development.gwt.AppEngineLauncher

in the arguments, you are running with GAE. To remove this, open
Properties under the project, click on Google->App Engine and uncheck
"Use Google App Engine".

On Apr 20, 11:31 am, keyboard_samurai <yog...@gmail.com> wrote:

keyboard_samurai

unread,
Apr 21, 2010, 6:05:18 AM4/21/10
to Google Web Toolkit
After i remove the dependency on Google App Engine i.e after
unchecking "Use Google App Engine" How do i configure the GWT plugin
to use tomcat ? is that possible ? or should i be building a war and
deploy the code on tomcat and then check ?

Thanks for your patience ...

kozura

unread,
Apr 21, 2010, 9:43:12 AM4/21/10
to Google Web Toolkit
Do you have a properly configured web.xml? You can check through the
documentation of everything you need to have at:

http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html

I would also strongly recommend you create and try running a brand new
project using the plugin or webAppCreator, as these have a simple RPC
client-server already fully working. You can then ensure that both
the client and server are running under hosted mode, maybe add some of
your server Oracle access code to that to verify that it works there,
and then compare with what you have to help get your app running.
Reply all
Reply to author
Forward
0 new messages