How do you setup JNDI for GWT (2.0) Hosted Mode? - gwt

How do you setup a JNDI server on GWT's hosted mode (they seem to use an embedded Jetty server)?

You can switch to any external Java server and use it without problems with GWT (I'm assuming here that you already have a working configuration and you don't want to migrate it to GWT's embedded Jetty, which may or may not prove to be difficult). For more details see the good docs.

Related

make a standalone independent application out of a dynamic web project in eclipse

So, I've made a dynamic web project in Eclipse.It uses Jsp and servlets. Now I am told to make a standalone independent application for the same. I tried to google as to how it can be done. Most of them pointed me to use Export->Runnable jar file. But on doing so I can't find my dynamic web project in the Launch Configuration. Now how to make the standalone independent application ?
I've done a similar thing using embedded Jetty which means the application jar provides the web service without having to rely on a web server.

how to integrate Spring and GWT from 2 different projects

I am tying to integrate a gwt project with my already running spring project.
i am using eclispe, and i have a Spring MVC application that receives JSON requests.
i am using the built in Tomcat to run my MVC application.
now i would like to create a new GWT project and have it communicate with my spring project with JSON.
i understand that they need to run on the same ip and port so i would not have to make cross site communication.
if i try to run my GWT application as run-as->Web application (which is the normal way for the project) on the same port as the Tomcat server i get an error that the address is already in use (which makes sense)
i tried creating a new dynamic web project and make it look the same as the GWT project. even though i am able to run the application, nothing happens, and the "entry point" is not run (i am not getting any errors or anything) it just runs the default HTML welcome file and thats it. with out any GWT.
what am i doing wrong, i am surly misunderstanding something about how all this should work.
can anyone help me out please.
You need to select that you are running on an external server:
That is a question that can't just be answered with yes or no. It all depends on your overall architecture and what you are trying to achieve.
As I said, if it is both the same application I'd recommend to integrate the Spring project into the web project. (and if that's the case, the spring project does not need to be a web project)
If the spring project is its own application and maybe running on a different server, keep them separated. Extend the spring project so it offers the functionality (via ejb or webservice) the gwt-web project needs.
Nevertheless, I recommend you do some reading about how Java EE applications should be designed and what the different tiers (client, server/service, business, etc) are for. Oracle/Sun offers some good articles. For example: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/ or http://docs.oracle.com/javaee/5/tutorial/doc/bnaay.html#bnabb.

Debugging GWT server side code using a TomCat instance

I'm setting up a project to use MySQL as the datasource and I'm running into a couple problems.
It appears the MySQL drivers for the Java side are incompatible with the built in GWT Jetty instance. Really?
I can configure a TomCat instance and get MySQL Driver working, but I can't debug inline (Client & server together) like I normally would be able to do using the Jetty instance in dev mode, according to Google Docs.
I spent quite a while deciding between a PHP or Java backend, and one of the main advantages besides the GWT RPC mechanism was the fact that GWT provides a nice Development environment if you use Java.
Has anyone encountered the need to use a data source other than appEngine? How did you setup dev environment?
I do believe the MySQL JDBC driver is "compatible" with the embedded Jetty; but maybe you were in an AppEngine project, in which case the embedded Jetty server forbids the use of classes that are not compatible with AppEngine (so you have at dev time a behavior as similar as possible with the production environment on Google's servers).
To debug your server code running in Tomcat, you either need to launch it (the server code) using Eclipse WTP (or equivalent if you don't use Eclipse), or launch your Tomcat instance with the appropriate debug arguments e.g. -agentlib:jdwp=transport=dt_socket,address=8788,server=y,suspend=y, and then debug it as a "Remote Java Application" (in Eclipse, I don't now how they name it in other IDEs).
You can then launch your DevMode in -noserver mode (and in debug) to debug your server and client at the same time (yes, you'll actually have 2 debug sessions).
Note that the doc you refer to (whose latest version can be found here) doesn't deal with debugging the server-side code, as it's highly dependent on the server you use, how and where it's deployed, etc. GWT code on the server side is just a standard servlet, so there's nothing specific to GWT re. how to debug the server-side code.
FYI, we do use a standalone Jetty instance (not the embedded Jetty server) for more than a year using the above setup.
You can use GWT and Tomcat and still be able to debug both client and server side. Look at the jetty startup parameters in Eclipse.
I have been in a similar position few years ago and decided to use Jetty for development and tomcat for testing.

Embedding Felix in Tomcat

I am a newbie to OSGi, started using felix. I am at present well versed with the concept of bundles, service etc. I have a requirement where I can embed Felix into Tomcat, I tried googling the same but was unable to find a relevant solution for my purpose.
What I exactly need is..
Till now I used to deploy my web app bundles into embedded http jetty service/PAX web.. installed inside Felix, but now I want to put Felix into Apache Tomcat/any other application server, so that whenever my tomcat starts up I need my felix instance up and running, and at the same time should be able to deploy/install/start my bundles through felix.
Any kind of help would be greatly appreciated.
You might want to consider the Apache Sling Launchpad subproject. This creates a WAR file which can be deployed into any servlet container and which launches the Apache Felix framework as the OSGi framework.
See also the Sling Launchpad and Embedding Sling for more information.

Consuming Web Services in Netbeans

I've setup a project in Netbeans 6.5 with some web services that I've created myself and some web services that I've imported from WSDL files. I've setup a couple of desktop application through Netbeans in order to consume these web services. I'm not too sure where to go from here.
I have the GUI setup but not sure how to reference the web services so they can be consumed. I was wondering would anybody be able to guide me through this process or point me in the direction of a relevant tutorial. I'd also like to learn how to consume a web service through a JSP (also created in Netbeans) if possible.
Thanks.
You may find this tutorial useful:
http://netbeans.org/kb/docs/websvc/client.html, but since you are using Netbean 6.5 this may be the correct version:
http://netbeans.org/kb/61/websvc/client.html. As the steps show, it isn't difficult to build a jax-ws client using Netbeans.
But, it depends on what version of Java you are using also, most likely. You may want to download the latest version of jax-ws, if you get errors with your wsdl.
For a JSP, just create a custom tag to call the client.