So I have a regular Intellij java project, now I was asked to create a .war from this so it can be deployed on a tomcat server. However, when I google this, every link assumes I have a web application but I don't. If anyone could help me out with this, it'd be greatly appreciated.
Either deploy the project as a jar, referenced from a web application, or else convert it to a web application. Tomcat doesn't have a lot of use for java code that isn't called anywhere.
Related
I am learning about servlets and JSP files and following the tutorial in link to have at least a basic understanding. But I am stuck at the beginning of the tutorial when servlet has to be run on Tomcat. I am getting the following error:
Can anyone please tell if there is something I need to do to run Tomcat without this error?
I think you have not set up your environment correctly. I would suggest to use NetBeans IDE (with required services). While installing the IDE you will find option to install tomcat or glassfish server. After installing create a Java Web->Java Web Application project. All things should go perfect if you just run the project.
How can I create and run a JAX-WS web service in a Dynamic Web Project using Eclipse? I'll be using Tomcat 7 as my server. Can you provide a step by step tutorial on how to do it? A hello world web service will do.
I followed this tutorial but I wasn't able to make it run. I did not follow the tutorial's step 4 - 6 because I'm already using Eclipse and the directories are already properly structured on a Dynamic Web Project. Also, my Tomcat is running under JDK 6. Since JAX-WS is already part of JDK 6, there's no need for me to copy it inside Tomcat. When I run the URL indicated in the tutorial, I get a resource not found error.
I think the jax-ws is not part of the JDK. You have to copy the jax-ws implementation into the Tomcat.
Did you find the jax-ws.jar in your JDK folder?
Ok, JDK6+JAXWS often gives problems.
You need to create an endorsed-Folder.
Try to run Tomcat from Eclipse. using these additional VM-Arguments:
-Djava.endorsed.dirs="<your-server>\endorsed" -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.MessageFactoryImpl
-Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.SOAPFactoryImpl
-Djavax.xml.soap.MetaFactory=com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
now, place the latest saaj-impl and saaj-api to the endorsed folder.
This should work.
I am wondering how I can quickly deploy the java dynamic web project that I built using eclipse on my mac to my Linode linux server? I already have a wordpress website running on the server and have also downloaded tomcat V6 and eclipse. Would I be able to manually copy the source, build and WebContent file contents? I would like to learn best practices for application deployment in the future but this project is very simple and I would like to be able to make it live as soon as possible. If you could also recommend any step by step tutorials I would really appreciate it.
thanks so much
Timnit
You should consider to build a WAR. Eclipse is just an IDE, it helps to develop, not to deploy.
Build your war (you can use maven/ant/build it from eclipse) - whatever you chose.
Once its ready your "deployment task" becomes a matter of moving a single file from MAC to linux server.
Use Cargo. See how easily it can be integrated with Maven build. Here is an excellent blog post.
I started a new job recently. I've been a Java & XML web developer for two years. The new place I'm at has several large web applications, but none of them deploy to my local JBOSS server because some genius decided to create a Java Project instead of a Dynamic Web Project. I tried following the steps to convert the project but that creates a bunch of errors which I cannot resolve.
The people I work with are all consultants and never give me a straight answer on how I can develop/test my changes locally.
Has anyone had to program in a similar situation? If so... got any advice?
I've worked on projects like that, but with Tomcat as the server instead of JBoss. I develop in Eclipse using a normal Java project, and I follow these steps:
Run an Ant script to build the project into a new WAR in a temp workspace directory.
Use an Eclipse plugin to stop the local test server.
Run an Ant script to copy the WAR to the proper directory for Tomcat to pick it up and deploy it.
Use an Eclipse plugin to start the local test server.
Tomcat's fast and the project isn't huge, so this whole process takes 12-15 seconds. With JBoss being a full enterprise app server, I'd think it might take more time.
I haven't been using Java extensively hence forget a lot fundamental things. Basically, I am working with a web-dynamic project (using Eclipse IDE with jdk 1.6), and during the build, I get errors that Cookie class and other web related classes cannot be found. What am I missing?
What Jars files do I need to add (and how)?
thanks
Think you need servlet-api.jar
Try here for any jar files you need http://www.java2s.com/Code/Jar/CatalogJar.htm
Sounds like you are missing servlet-api.jar
You can download it from the Maven repository.
Servlets are only part of the Enterprise Edition, not of the Standard Edition of Java. So you need the Java Enterprise Edition, AKA Java EE.
http://java.sun.com/javaee/
As others have said, you're missing the server api jar.
Having said that, downloading just the servlet api jar and not the server that goes with it means that you can't actually test your code.
In Eclipse, once you're installed a servlet container, such as Sun's Glassfish, Apache Tomcat, or Jetty, you can create a server instance of it so that Eclipse will compile against your server's servlet implementation. Creating a server instance also means that Eclipse's Run on Server command works.
IBM has a slightly outdated guide on Developing Web applications with Tomcat and Eclipse. The entire "Install the Web tools" section can be skipped if you have the Eclipse EE version, as Web Tools are already installed.