i have tomcat project the directory structure is
previously i was using tomcat server, whenever i modified .java files i used to build the project and restarted the server in eclipse through plugin than the changes would have taken effect.
Now in my company they changed from tomcat to weblogic since i am new to it, i used to build war file every time and deploy manually to check the changes.
Can any one tell me how to do hot deployment in web logic. i googled it but it says i need to change project type to dynamic project, that i cant do since it already in development.
is their better way just make changes to java file build and no need to restart the server through eclipse in weblogic 12c.
Eclipse IDE luna
weblogic 12c server
project type : tomcat project structure
I think how you doing that is a little old fashioned. With eclipse luna, tomcat 5.0 - tomcat 8.0 is well supported. And take some effort to turn your project into a 'Dynamic Web Project', in that way you will benifit a lot from the experience of other people.
For hot redeploying, you can try JRebel, it reload your changed java class without reloading the whole applcaition.But it's a commercial software, and I don't know a good and free alternative yet.
Related
I started my journey into web applications about three years ago and I'm happy to say that I've finally deployed a working website. My concern is that to deploy the website I use the Eclipse IDE and a Tomcat webserver. So basically I right click the project in Eclipse and then choose "Run As > Run on Server" and then select the Tomcat server I downloaded - from that point on the console spits out some startup messages and my website is online and ready for use. What are are some of the drawbacks of deploying a project this way. I've read just briefly about WAR files and adding them to Tomcats Webapps folder but I could neither get that working nor did I understand completely the process...so is it acceptable to just deploy the project the way I have been doing thus far by running it in Eclipse?
Generally Development machine and deployment server is different.
On Deployment server one may not have eclipse always.
WAR file is just a webarchive which includes all the necessary files. WAR makes your project portable.
Export WAR from eclipse place it in tomcat webapps in any machine and restart tomcat.
You should have your webapp successfully running on that machine.
That's a fine way for deploying a server when you're learning, or always have the server (the only server!) running on your development machine.
If you need to push to a remote machine, it won't work, and you'll need to learn other methods then, but for now, what you're doing is fine.
Sorry if this is the wrong kind of question but currently I have an Apache server which is configured for Pyjamas. All I used to have to do was: pyjsbuild example.py and the GUI would appear in my browser.
I decided to switch to Java, so I picked Vaadin as my framework. How do I do the equivalent for Vaadin? All I want to do is compile the java and have Apache recognise it.
I'm using linux and I'm very new to building web applications, previously I only ever built the GUI side of things, I never had to touch the server.
You need Apache Tomcat to serve java pages. Install it separatly or see http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html for information on how to hook them together.
Vaadin projects work just as any web project. You have to crate a WAR file.
For example, if you are using Eclipse, right-click on the project, choose "Export..." and under "Web" choose "WAR file".
If you are using Netbeans or something else, google "create war in netbeans/intellij/..." to find out how to do this step.
This will generate a file with the extension .war, which you will have to copy in the "webbaps" folder of your Tomcat installation. Restart Tomcat and the application will be automatically deployed.
If you do not have access to the webapps folder, go to Tocatmcat's "Manager App" in the browser and
under the section "Fichier WAR à déployer"(WAR file to depploy) choose the generated file and click Deploy.
To start with, make sure that go through Getting Started chapter in Book of Vaadin. In this chapter you will find overview of the required toolchain and step-by-step installation instructions. Your Linux distribution might have more documentation about installing JDK (For example, see Ubuntu wiki for Oracle JDK installation).
It will be convenient for you to connect Tomcat to Eclipse IDE. This makes starting Tomcat and updating your application easy. For example, see this [blog] for some videos about connecting Eclipse to Tomcat.
Please note that using Eclipse is just one approach and later you might want to see if IntelliJ IDEA or command line works better for you.
I have downloaded a sample extjs+mysql+spring web project (link) with a java backend that I'd like to set up locally on my machine. I have installed Tomcat server, and MySQL DB but it's my first time ever with a java-based web application and I have troubles setting it up. Does it require any modifications ? I thought that .jsp files should be included there, but I can only see .java sources. Do I need to build it before it's ready for deployment ? Any help appreciated.
This is an Eclipse project so you'd need to run it from within Eclipse.
Download Eclipse
Open the project in it
Define a Tomcat container in your Servers tab
Drag and drop the project onto the newly defined Tomcat
Run it
if your are using eclipse IDE for development, create a project in eclipse,
run as "run on server" , and set the running server (eg TOMCAT 7).
and thats it,,
make sure, you correctly setup spring project in IDE with all needed jar files .
I use tomcat with eclipse in 'Use tomcat installation' mode. My problem is, that eclipse overwrites tomcats server.xml every time, and deletes my crossContext="true" elements.
Should I use custom location? Or the eclipse setup is wrong?
Thanks!
You can edit the equivalent configuration files inside your "Server" project/folder in the eclipse workspace. Those are the configuration files with which eclipse is overwriting the ones found under your Tomcat installation.
I have experienced a lot of pain getting Eclipse to interact nicely with Tomcat. I recently switched over to Jetty and I will never go back! It's especially easy to use if you use Maven as your build manager. If you use Jetty for development, you can still use Tomcat for deployment.
If you want to preserve Tomcat artifacts then you can choose "Use Workspace Metadata" option. This option will copy all configuration files to "{workspace}/.metadata/.plugins/org.eclipse.wst.server.core" directory but still use the installed Tomcat Binaries for starting and stopping server. This is a neat way to have multiple server configs using a single tomcat.
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.