So I was given a WAR 'file', but upon downloading it I noticed that it is actually a folder, not a WAR file. Trying to open this folder in Netbeans is not working, because it is expecting a war file, not a folder.
I attempted "War-ing" the folder, which worked. Netbeans can now open the file, however none of the files can be edited.
This was tested using apache's ode.war in NetBeans 8.0:
Unzip the war file
In the unzipped folder, you will see WEB-INF/, META-INF/, etc., create a sub-folder named web in the unzipped folder.
Put everything else into web (now they will be web/WEB-INF/, web/js/, ...)
Go to netbeans, new project -> java web -> web application with existing sources
Pretty much just press next all the way through. voilĂ , it's done.
If you don't have eclipse handy, just place the war file into the webapps folder of Tomcat, go to the bin folder of Tomcat and run startup. Tomcat will automatically extract the war file for you. Now go to the webapps folder and you'll find another folder there, with the same name as your war.
I couldn't find an option to import a war directly into Netbeans (strange. Perhaps someone could create this feature and submit it as a patch to Netbeans). The folder which gets extracted into the Tomcat folder can be used as the Netbeans project. It's advisable to copy it to some other folder first. Import by File > New Project > Web application with existing sources.
Eclipse has an option to export a war and include the sources with it too, so there's a chance that the source files are in the war too.
Related
I'm stuck into the process of deploying created .jar files in Eclipse.
Eclipse is at location: E:\eclipse
Web project is at: E:\Runtime_Testing\src\study_to_night
Tomcat is at location: C:\apache-tomcat-7.0.54-windows-x64
Meanwhile, steps followed for creating jar files in Eclipse:
Right click on your Java Project and select Export.
Expand the Java node and select JAR file.
In the JAR File Specification page, checked the option which says "Export Java source files and resources"
Selected the export destination as: E:OneForAll.jar; OneForAll being the name of my .jar file
Checked the option` "Compress the contents of the JAR Files"
Next ---> Finish.
On following the above steps, an executable JAR file is created at the specified location. Just to check if all the files have been extracted in the .jar component, when I chose "Extract files" option, all source files were traceable. However, on double-click it throws Error: Invalid or corrupt jarfile 'E:OneForAll.jar'.
I feel I'm lost. Is there something I missed out? What went wrong?
Could someone walk me through the steps to do this manually ?
So you have it running successfully within eclipse? But now you want to deploy this tested web app?
Then
Right click on your Java Project and select Export.
Expand the Web node and select WAR file.
This exports the WEB-INF and related files that tomcat needs.
This question answers what to do next How to deploy a war file in Tomcat 7
Apache tomcat is a web container you cannot deploy a jar in tomcat server.
If you created a web application then export your application as war file and put it in tomcat webapp directory, start the server and your war will be deployed.
if you have lots of jars then still you need to bundle them as war
I have developed a dynamic web application in Eclipse. I am using Tomcat as a server. In my lib folder I have placed one non-jar files( addressing.mar ). This file is necessary other wise I get an error in my application.
Now I export my project as war file and then deploy the project on Tomcat server. When I run the project I get an exception because addressing.mar cannot be found in the lib folder of the project. I don't know why addressing.mar isn't exported. If I manually place file in it, it is working, but I need a better solution.
Right click the project, open properties.
Under the Deployment Assembly page, you can configure what resources to include during export and their path in the WAR file. Just include your jar there and it will show up next time you export.
I am working on weblogic 12c and i deploy .ear file which inside contains .jars and project stuff.
After ANT Build all java classes goes as jar inside 'project/bin' folder. This bin folder will be part of .ear file.
I then deploy .ear on weblogic. But apart from doing this, it is also
forcing me to copy 'project/bin' folder stuff into 'Weblogic/domain/lib' folder and restart the weblogic server. If i dont do this, i am getting ClassNotFoundException for all java classes.
Why should i copy 'project/bin' folder into 'Weblogic/domain/lib' ?
Is this a ideal way of doing deployment ?
If not, How to avoid doing this every time ?
Please help.
Actually I use MyEclise to develop and deploy a enterprise project(EAR file).
I use Java Build Path to add some other projects and link sources, and added several jar files (as external jar and user library) to my project. (I used J2EE technology and there are some default jar of course )
By myeclise deploying manager I deployed my project on weblogic base_domain and then by weblogic console I deploy it on weblogic.
All is set and there is no problem in all steps.
Now I wanna to create EAR file manually, first I created WAR file which included some jsf files and web-inf directory contains classes, lib directories and some important file like web.xml , facec-config.xml and etc.
In classes folder I have .class files which build correctly from .java files, and on lib directory**I copied all jar file from web-inf/lib directory** which created automatically by myeclipse deploying manager on weblogic base domain folder.
I added this War file into EAR file along APP-INF directory which contains all jar files from APP-INF/lib directory on weblogic base domain folder and META-INF directorywhat contains application.xml file.
When I deploy this ear file on weblogic there is so many error and problems.
Could you tell me what is the correct way to create that EAR file.
Thanks in advance
If you have an enterprise project, just export the EAR file. Right click the enterprise project, select Export, then select MyEclipse JEE->Ear File and follow instructions on the wizard (basically, specify a destination for the EAR file, on the file system). This should give you an EAR file that contains the same as what was deployed on Weblogic.
I have create a simple program using Eclipse 4.1.. I wanted to build or deploy my project into a .jar. I also added external libraries in my project. I wanted the output same as in Netbeans with the .jar file and lib folder in the dist folder, but there should be also a folder named help and lang.. How can I do this with eclipse?!
Follow the steps provided here.
Or if you don't want to complex things up, select Runnable JAR file instead of JAR file set the directory where the .jar is to be written then click Finish.
Eclipse will create the [Project Name]_lib directory for the external libraries included in the project.