Okay, so here is what will drive me insane if i didn't get a solution in a matter of minutes..
the situation is
I'm using Netbeans 6.1 to create a web application. Now i need to deploy this web application in weblogic 9.2(not bundled with netbeans), for this I need to have a war file(which i suppose I should get when i build the project, dont know if i have it when i built it, tell me where to find this war file) and also, when another requirement is that i want to create the war file on command line, so i used the command jar -cvf webapp1.war* but it doesnt seem to be working. I would also like to know how to export a war file from netbeans (if we can).
I've never used weblogic before.. can you please help me with this war file thing and also explain why i should choose weblogic over apache tomcat. And some info about weblogic 9.2 specifically will also be helpful including how to deploy an application(i.e. war file) on weblogic using/without using weblogic console.
OK, firstly, have you looked at the Netbeans Help on how to create a WAR file directly from Netbeans? I'm not sure if this is possible.
Creating a WAR file from the command line is usually done using some sort of tool like ANT. But at a pinch you can use jar/zip utilities to create your WAR, you just need to have everything in the right structure, see this old article for guidance.
As for Weblogic cs Tomcat, what features do you need? If you're deploying a 'bare bones' web application without the need for many resources then I'd instinctively go with Tomcat. Weblogic is a much larger more heavyweight application server.
I'd recommend reading hte WEblogic documentation on how to deploy a War, it's quite easy to find if you start from www.bea.com
I don't think its possible to export a war file from netbeans( I asked coz I know that it is possible in eclipse). I could now create the war file using the command line
jar -cvf mywarfile.war * ( It didn't work earlier coz I missed the space before * .. foolish me)
Now on the weblogic console, the process completes till the installation but fails when i try to activate changes (or start the deployment). It gives me the following error:
weblogic.management.DeploymentException: [J2EE:160177]The application at "C:\Documents and Settings\smonga\Desktop\javaprojects\xyz\xyz.war" was not recognized as a valid application type. If this is an EAR file, please ensure the META-INF/application.xml exists. EJB-JARs should have a META-INF/ejb-jar.xml. WAR files require a WEB-INF/web.xml, and RARs require a META-INF/ra.xml. A JMS deployment should be an XML file whose name ends with "-jms.xml". A JDBC deployment should be an XML file whose name ends with "-jdbc.xml". For other application types, please consult the WebLogic Server documentation.
looks like there's a glitch somewhere..
Joined: Dec 16, 2008
Finally I was able to deploy my webb application on weblogic server. Here's what I did:
1. Created a Web Project in Netbeans. 2. Built the project (note that if you want a war file to be created when you build the project, go to properties of the project and under 'packaging', check 'compress war file' or 'create war file' and then clean and build the project. 3. On the weblogic console, select the path to your web application(its not mandatory to copy your project directory into the weblogic server directory) 4. Step 2 had created a valid war file. (Don't know the reason but earlier when i created a war file using the jar utility, it gave me a war file but WL would consider it as invalid.. still trying to figure it out..will keep updated) 5. Activate changes, start the deployment and run the web application from the browser.