I wrote web application using JSF, xhtml, CSS and Apache Tomcat in Eclipse and I want to start it on Windows Azure emulator. I installed "Windows Azure plugin for eclipse" (here is instruction).
When I choose option "Package for Windows Azure" and I want to run application on WA emulator everything is ok - I see information on console "BUILD SUCCESSFUL", server started etc. But when I type application url adress on web browser, it displays
HTTP status 404 The requested resource (/ChatAzure/) is not available.
How is this caused and how can I solve it?
sounds like your app might not be getting into Tomcat's webapps. One way to troubleshoot is AFTER you try to run it in the emulator, go into your Azure project's "deploy" folder, navigate the folder hierarchy until you get to the specific role folder (like WorkerRole1 if using default names) go inside approot, find the tomcat folder in there, and look into its webapps folder. You can see the effects of your deployment logic this way. If your app isn't inside webapps, there may be an app deployment problem.
(The actual directories may be different depending on how you've customized the deployment logic)
Related
I integrated Tomcat 6 into Eclipse Indigo. When I start the server in Eclipse, it shows that Tomcat is up and running, but when I go to localhost:8080 in my browser, it does not respond at all.
I have Tomcat server entry in the Servers tab with "Use Tomcat Installation" and it didnt help me.
I have removed my entire projects from eclipse and started importing it again to set it up from the beginning and it didnt help either.
Could you please some help me out?
It is most probable that you are running Tomcat from eclipse as Use workspace metadata (does not modify Tomcat installation). While running under metadata, tomcat's default welcome page is not deployed. So you wont be able to view the welcome page under localhost:8080/ but you can access your application with the application context in the url ( something like localhost:8080/yourApplicationContext/hello.jsp)
See below the image where you can set the server location. If you change it to Use Tomcat Installation, eclipse will use the actual installation of tomcat. You can even see this by deploying the application and then open up your file browser, navigate to tomcat directory and you will see your application deployed there in the webapps folder. But if you use use workspace metadata option, eclipse makes a stripped copy of your tomcat's installation and places it in the .metadata folder of the workspace. Something like eclipse_workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\
The question as to which technique is better totally depends on your use.
I have a requirement in my application ,Running the javafx application in browser from web-server. how can i achieve this thing.
Thanks in advance.
Solution
Place a copy of the jar, jnlp and html file output by the NetBeans build into a directory of your webserver, then access the html file in your browser.
For example, let's say you called your application MyPowerApp and netbeans output MyPowerApp.html and you wanted to deploy that to a local Tomcat server.
Download and install a copy of Tomcat (http://tomcat.apache.org/download-70.cgi)
Copy the jar, jnlp and html file into tomcat's webapps/ROOT directory.
Start tomcat.
Access your application via http://localhost:8080/MyPowerApp.html
The applet will start automatically and you can click on the link to launch the application via WebStart.
To update the application just rebuild it in NetBeans, copy it over into the tomcat webapps/ROOT directory and refresh your browser link (no need to restart Tomcat).
In practice you will want to modify the html rather than use the generated html to embed either the applet or WebStart link somewhere on your website (you won't need both execution modes in a single page like the Netbeans generated sample).
Background
JavaFX applications do not run in Tomcat.
Tomcat can be used to host a html page embedding a JavaFX application jar. A browser with the JavaFX plugin installed and activated can download the the JavaFX application from Tomcat and execute the application in the browser window using a Java runtime environment installed on the client browser machine. See the JavaFX Deployment Guide for more details and the JavaFX deployment quick start for short info on getting started.
Note that getting JavaFX to work correctly in a browser across a wide range of client machines may prove a difficult task for you, so you may want to investigate alternate deployment methods as outlined in the JavaFX deployment guide (such as WebStart, Standalone or Self-contained application deployment modes).
As you all probably know, when you create a GWT project (I use Eclipse..not that it matters), and you run it as a web application, you get the application URL, for instance:
http://127.0.0.1:8888/StockWatcher.html?gwt.codesvr=127.0.0.1:9997
My question is, I would like to let my friend, which is on a different computer, this URL so he can also check the application, so I changed the 127.0.0.1's to my own IP, but it doesnt do the trick, what am I missing here?
Thanks,
If you want to share your app with rest of the world, you need to deploy it on some sort of web server. You can pick many of them, f.e. Apache Tomcat, Jetty, JBoss, GlassFish ... Basically, your application needs some sort of container to run in.
I will now briefly describe deploying GWT app to Tomcat:
You must have globaly accessible IP (and also domain name)
Install Apache Tomcat, see the documentation
Eclipse with Google plugin created for you folder structure containg /war folder
Copy /war folder to to Tomcat webapps (by default /Apache Tomcat X/webapps. You might want to rename your war folder, say to "StockWatcher"
Add necessary libraries to /lib folder (but Tomcat will complain about missing classes, not difficult to find out what's wrong here)
Restart tomcat and type URL like: http://your_url:your_port/YourApp/YourApp.html
I see that you did StockWatcher tutorial, these steps should cover basics. Try it on localhost first. Maybe getting globaly accessible IP is what you were originaly looking for.
The URL you pasted is the "development mode" (or "hosted mode") URL for debugging your app. For deployment, you need to compile your project (in Eclipse there's a red-colored button, and see the GWT website for more details).
If all you want is for your friend to access your debugging development run, see GWT's docs about that
pass the parameter -bindAddress 0.0.0.0 to bind the embedded server from eclipse to all network cards. compile your app with the red icon in eclipse and paste the url from the dev console without gwt.codesrv at the end
In Eclipse,
Run > Debug Configurations...
Select your project on the left panelunder Web Applications > Project Name
Select the Arguments Tab on the right panel
Under "Program Arguments:" append the argument "-bindAddress a.b.c.d" where a.b.c.d is the IP of your machine.
Restart/Run jetty
Now the URL can be accessed from a different machine on the network
I am relatively new Java developer that's been thrown in the deep end, my usual skillset lies in Microsoft products and C#.
However I have managed to write a nice web service using Restlet and incorporating Toplink and doing some database CRUD stuff, etc etc.
I developed this in Eclipse against Tomcat 5.5. I followed tutorials and examples and managed to throw something together that works.
I had all my jar files in WebContent/WEB-INF/lib directory of my project - I soon realised that when I export this as a WAR file and deploy in Tomcat, it takes these jar files with it and stores them local to the application.
Fine, but then when you try to undeploy the app, it only does it partially as Tomcat "holds on" to some of the jars it was using i.e. the Oracle JDBC, and Toplink ones. This makes sense as the web service was using these jars as there was a live Oracle connnection going on.
So then I thought I should have all these jars in a common place where all deployed apps can access them, that folder I believe is:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib
(in my case). This made total sense, it's logical as you don't want loads of apps on Tomcat all referencing the same jars. So I removed all the jars out of my projects lib folder and put them in the common\lib directory.
Now my app will not work properly - it can't find my source code in src, the custom bespoke code that I have programmed against these jars. It will only work if I jar up my source code and put in the directory stated above. Odd.
I am obviously very confused with class paths and build paths and all of that stuff, and must have got this sort of stuff all wrong as I am no Java expert, as I readily admit I have pretty much hacked this together - so can anyone explain to me in laymans terms how I should structure my project to get it working with jars held in a common folder in Tomcat. Or are there any good resoureces on the web to help explain to me what I should do.
Hope this all makes sense...
Here is a pic of my current project:
Sounds like you are not using WTP web project.
If you've installed 'Eclipse IDE for Java EE Developers' flavor of Eclipse, the WTP is already bundled in there. Otherwise here its update site -> http://download.eclipse.org/webtools/updates
Once you've installed WTP you should create 'Dynamic Web Project'.
In general I would recomment to put only your presentation layer here ( JSPs, CSS, HTML ) and put all pure java projects into standard 'Java' project that you later add as a dependency to 'Dynamic Web Project'.
WTP can run your web application under a number of containers, fortunately Tomcat is supported.
You will need to configure it through Window->Preferences->Server->Runtime Environments.
Once runtime envirnonment is configured, you can create your server runtime:
Right click in 'Servers' view.
Choose New->Server
Select server type: 'Tomcat v.5.5 Server'
(Optional) Change server name to whatever makes sense for you
Select server runtime environment: This is the Runtime Environemtn that you have configured previously
Hit 'Next' button
Add your 'Dynamic Web Project' project to 'Configured projects:' panel
Hit 'Finish' button
After the server is configured you can just run it, or you can put it in Debug mode. All source code referenced by dependent projects will be available for debugging.
NOTE:
From personal experience, I would not recommend using common/lib. Put all the jars that your web application relies upon into its WAR file. If you are worried about dependency tracking then start looking into Maven and m2eclipse.
Usually I put my jars in $CATALINA_BASE/shared/lib/
Please read this documentation for more clarification and specially Class Loader Definitions section.
Also restart the server after you copied the jars.
Go to Window > Show View > Other > Server > Servers, a servers tab will appear below with console tab. Click on your server and then F3, this will open server configuration.
Check Server Locations, and make sure you checked Use tomcat installation(takes control of tomcat installation) then click Modules tab below and it will show your installed modules, make sure the module is present or add it.
I am trying to use tomcat with eclipse. I have installed it all and got the tomcat plugin installed. I have put a .war file in the webapps folder of tomcat and have made sure autodeploy is set to true. The problem I am having is that I can't get tomcat to run this .war file. The tomcat server is started and running as it tells me under the servers tab at the bottom of eclipse. It also shows the name of my .war file under it and says synchronized meaning it at least knows its there. But I can't get it to work at all. Even when I go to the local host page it shows the title of apache tomcat but does not show the file. I want it to show me the .war file. It has the correct xml files and everything in it. Any help is much appreciated.
You may try to check whether the application is deployed or not. You can directly go to the Tomcat directory to see this.
Another possible thing could be, you might be typing the incorrect url.
http://localhost:8080/[your_application]
where 8080 is the port you have specified for tomcat.
You need to let Eclipse publish your web project for you when using the Eclipse Tomcat plugin instead of trying to manually deploy it youself.
The Tomcat plugin for Eclipe supports hot deployment whereby you can change jsp's etc without having to manually redeploy your web application.
If you have a valid web project in eclipse then you can check that it is being deployed by looking at the Server View.
Window, Show View, Other, Server
This window should contain details of your Apache server. (If no server is listed then you'll need to right click on the list and set one up.)
To check that your application is being deployed right click on your server and select Add/Remove projects. Check that your web project is listed. If it is not listed under Configured Project then add it.
If your project does not appear in the list then it probably wasn't setup as a Dynamic Web Project. You can fix this by by right clicking on the project to bring up project properties and then clicking on facets and then enabling Dynamic Web Project.
It is also worth having the Console view visible when starting/stopping Tomcat so that you can see the server output.
Start tomcat from the command line (not eclipse) and see if your webapp shows up. It should if you have indeed created a valid war file. If it doesn't work, check the logs.
You shouldn't be manually deploying the war file if you are using eclipse to launch tomcat. Running tomcat from eclipse does not necessarily use the same default workspace as the standalone tomcat. Check the configurations for the 'server': it may be that the eclipse launched server's webapp folder is empty.
If for some reason your webapp failed to initialize properly (error in the descriptor, an uncaught exception in a context listener, ...) tomcat will unload it and you won't see anything at http://localhost:8080/yourwebapp.
Is it there in the list of applications in tomcat manager?
if you havent done this...then follow the steps...
Go to http://localhost:8080/
Go to Tomcat manager and check if your application is there in the list of deployed applications. Try redeploying or starting the application if running=false. It usually tells you what is wrong when you do that.