• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Saving a file under my GWT project's '/war' path - Security Exception

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am designing a web application using GWT. I use an OWL ontology, stored under the 'war/WEB-INF/Ontology' path in my war folder.
I can access this ontology through my UI on the clientside wihtout any problems.

When a user modifies the details of an ontology entry through my UI and clicks on 'Save', I want the server side to save the updated ontologyto the same path ('war/WEB-INF/Ontology').
However, when I try to do this, I get the error below:

I am badly stuck.

Any help would be greatly appreciated!

Thanks,
berkan

---------




---------
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Looks like you got a GWT+GAE project. You cannot open sockets or write files on GAE.
http://code.google.com/appengine/docs/whatisgoogleappengine.html Check out the Sandbox section
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Maneesh! Yes, I use GAE and after reading the link you've sent, I believe that is the reason I get the security exception.

Would it be possible for me to deploy a GWT applciation outsde the GAE then? Would that mean I have to set up my own server?

Do you know of any tutorials on this maybe?

I am a newbie in web applications so I will appreciate any pointers on this.

Best,
Berkan
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Berkan Sesen wrote:Would it be possible for me to deploy a GWT applciation outsde the GAE then? Would that mean I have to set up my own server?


Yes it is definitely possible. One important point to remember is if you are using any GAE features, you will of course need to code that part yourself.

For development mode, you need not set up any server. Presuming you are using Eclipse
1) I am not sure it will work, if you edit your existing project and uncheck the box. I haven't tried it so no idea. If not, create a GWT only project (uncheck the user GAE box).
2) Write code, test, fix bugs, test etc.
3) Once done, follow the steps mentioned here to package your war
4) Once packaged, you can deploy it on any server just like any other web application. Depending on your server, deployment steps might vary. In case you are using Tomcat, check out this page.
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again Maneesh,

I believe I am close to the solution now. I am applying what you've said to a trial Eclipse-GWT project called GWTSimple, which was created with "Use Google App Engine" option checked.

1 - I have unchecked it under Project Properties -> Google -> App Engine.

2- I have completed until step 3 and have created my GWTSimple.war file

3- Futhermore, I believe I have managed to setup a tomcat server to run in Eclipse. I have attached a screenshot of how it looks in my Eclipse environment.
I can click and Start this Tomcat v7.0 server .



Now, I have never deployed a web application before, what would be my next step? Do I have to right click my GWTSimple Project -> Run As -> 4 Web Application (Running on External Server)?
I have looked at a few web pages that explain setting up and running TomCat on Eclipse, such as: http://greatwebguy.com/programming/eclipse/make-eclipse-and-tomcat-play-nice-together/ . However, I don't believe what they explain on this page is applicable to a GWT project.

Best,
Berkan
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Berkan Sesen wrote:Futhermore, I believe I have managed to setup a tomcat server to run in Eclipse. I have attached a screenshot of how it looks in my Eclipse environment.
I can click and Start this Tomcat v7.0 server .


You don't really need this because the GWT plugin will run it on Jetty for you (Jetty is installed along with the plugin)
Just right click->Debug as web application. The eclipse console view will tell if when it's up.
Open your favorite browser and point it to http://localhost:8888

For running on external server, please refer http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT's
I never bother with it. Jetty suits me just fine.
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I right click on my Project (GWTSimple), which also contains the GWTSimple.war and click Debug As -> Web Application, I get this error below:
( Of course, when I re-check the "Use GAE" option of the project, Debug As Web Applciation works fina as usual, but under the GAE.)


 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you are missing some jars.
Project->RIght Click->Properties->Java Build Path->Libraries tab
Do you see the GWT SDK Lib entry? Any others?
buildPath.png
[Thumbnail for buildPath.png]
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Maneesh,

Yes, I see the GWT SDK Lib. I have attached the screenshot. I thought the reason I was getting the error was because I uncheck the "Use GAE" tickbox. The moment I check it, the project runs and debugs fine - albeit in GAE .

Berkan

 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove all the jars except the GWT SDK and JRE libraries and try again
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneesh,

OK, I think it almost worked. I cleaned the jars and when I 'Debugged as Web Application', I got the URL displayed at the Development Mode view (see below).



Instead of double clicking on the URL in the development view, I typed http://localhost:8888 in my browser and got this error pop-up window: "GWT module 'gwtsimple' may need to be (re)compiled". I think this means that the server actually worked but there was some other problem with the project.

So, I searched and found this warning (quote - below) on http://blog.elitecoderz.net/gwt-and-tomcat-create-war-using-eclipse-to-deploy-war-on-tomcat/2009/12/ about this 'recompilation' error message.

It is important to note, that prior to performing any of the jar / war creation steps, you need to (in Eclipse):
1- perform a clean on the project making sure the “Start a build automatically ” checkbox is NOT checked;
2- right click on the project and select Google, followed by GWT Compile
3- Then build the jar and war file as described above.
Otherwise, after you deploy the war to Apache Tomcat the error “gwt module may need to be (re)compiled” will appear, when you click on the application to bring it up in a browser.



Now, I have indeed repeated the .war creation process with recompiling the project (as in Step 2 above). However, it did not work.

I am hoping it is because I skipped the first step. Do you know how I can 'perform a clean on the project' and how I can deactivate 'Start a build automatically' for a single project ? I got a bit confused about the Step 1.

Thank you very much,
Berkan
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For dev mode, you do not need a clean build. Just double click the link on the console. If you are running the GWT in dev mode from your browser, it will prompt you to install the browser plugin. Follow on screen instructions and you should be ready to go.
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Maneesh,

Thank you so very much! I am really grateful, it is finally resolved. When I create the .war file (as described in the link you've given) and uncheck 'Run with GAE' under project properties, I can now Run or Debug through Jetty (without GAE) under Development Mode, just by clicking on the URL. Also as you said, when I run thorugh Jetty (without GAE), I can actually write files to my war/Web-INF folder!

The good thing is when I re-check 'Run with GAE', I can run the application in GAE without having to change anything.

I have a quick question though, regarding 'debugging'. When I am running through Jetty (without GAE), I thought Jetty runs the application through the <projectname>.war file I have created. Therefore, I did not expect the changes I make to my code (classes) under the /src folder to be reflected on the applciation before I recreate another <projectname>.war file. In other words, I thought real-time debugging was not going to be possible. However, whatever change I make to my /src classes, I can see their effect immediately, without having to recreate the .jar or .war files. Could you explain why this is possible?

Best,
Berkan
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats what I meant when I was referring to the dev mode.
When you run your application in the IDE, it by default uses Jetty. Like you have already noticed, it hot deploys the changes, provided you are using the browser plugin (ULR with the codesvr part)
In general, you should follow this pattern

1) Create project
2) Code
3) Run/Debug as web application
4) Use the browser plugin (double clicking the URL in the console)
5) Test/Debug etc.
6) Confirm you are done with all development
This is the end of development phase. Note you never needed to build the war. The eclipse plugin handles everything for you.

When you want to deploy it on some production server like Tomcat, only then you need to create the war. Build the war and deploy the war on the production server.
 
Berkan Sesen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneesh,

Brilliant. It is all clear now. Again, can't thank you enough for your kind and persistent help.
I do have some other questions but now they are related to server deployment, etc. So will not post them under the GWT forum.

Best wishes,
Berkan
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome. Glad I could help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic