War file deployment on tomcat - java

I developed a Java EE app under eclipse with server runtime as Tomcat 6.0 . All the things are working just fine , but when i uploaded war file to my hosting server it didn't work.
Support says : "create your war with tomcat 5.5"
what does that mean ? do eclipse creates war according to the server runtime installed (in my case its tomcat 6.0) ?
EDIT:
I tried running same app under tomcat 5.5 - locally...but eclipse says :
The server does not support version 2.5 of the J2EE Web module specification
so how can i make the Java EE app to work with tomcat 5.5 ..

You need to compile your project for Servlet API 2.4 (and not 2.5).
In Eclipse you need to change the version of the "Dynamic Web Module" (see here).

they use Tomcat 5.5
Your hosting provider is many years out of date. Tomcat 7 is now up to about as many point releases as Tomcat 6, which came out in 2006, and Tomcat 5.5 goes to End of Life on 30 September. Get them to upgrade their antique offering, or find someone better.

Either when you create your project or when you export your WAR file you are able to to choose which version of Tomcat to use(pull down menu). You need to export your WAR file using the same version of Tomcat as the Tomcat your server is running.

Related

Convert a .war file into a right version

I have to compile a Java EE project with JBoss 7. When I run with JBoss 7, Netbeans creates a .war file. Due to problems with my environnment, I have to deploy this .war file with Tomcat6 on a virtual machine.
The problem is that the .war created is not compatible with tomcat6.
I tried to install tomcat7 on the virtual machine, but I have other problems like "NoClassDefFoundError".
So I'm looking for a way to convert the .war in the right version. How should I do please ?
There is no standard way to achieve this goal ("convert a .war file"), as Tomcat6 (out of the box) isn't a JEE certified application server - just a web container:
Apache Tomcat, a Servlet and Java Server Pages container
Thus, certain libraries that are part of a true JEE-application server are not bundled and present in the /lib folder of a plain Tomcat installation, for instance implementations for JTA, JPA, CDI, JAX-RS, JAX-WS...
However, you could try and download an enhanced Tomcat, namely TomEE, as it is - in it's latest release - JEE6 certified (and has several variants):
Apache TomEE, pronounced "Tommy", is an all-Apache Java EE 6 Web Profile certified stack where Apache Tomcat is top dog.
This might be a good solution to your migration approach as JBoss7 is also compliant to JEE6 level.
After you have downloaded TomEE you could then try to deploy your application in there. Nevertheless, you should have provided the full stacktrace or at least the Class (incl. fully qualified package) that is not found, as there might be certain third-party libraries in JBoss 7 that are not present in TomEE or other application servers.
Hope it helps.
War Files itself don't have a Version.
The Java Classes them selfs have a Java-Version (e.g. if they using Java 7 or Java 8).
If your Tomcat runs on Java 6 and you compiled with Java 7 you'd get a UnsupportedClassVersionError. If thats the case, you have to either update the Java-Version of Tomcat or compile your Code with Java 6 (and remove Java7 Features).
Other than that, it might be possible, that you're using Features from JBoss 7 that aren't available in Tomcat 6 (e.g you referring to Servlet 3.0 in your App, but Tomcat doesn't support that version). To make it work in this case, you'd have to remove all the Features, that Tomcat doesn't support.

Selecting Apache Tomcat Server Causes Java EE Dropdown Menu Failure, NetBeans 7.4

So here's where I'm at:
I've installed the Apache Tomcat Server successfully.
I've configured the JAVA_HOME path successfully, and created a /common/lib directory (as opposed to plain /lib) to get around an issue with NetBeans recognising recent versions of Tomcat.
If I select GlassFish 4.0 as my server, instead of Tomcat, everything's fine -- but I don't want GlassFish 4.0 as my server, as I'm working through a book on Java WebApps and don't want to run into intractable problems further down the line.
When I select Tomcat as my server, I run into the problem that the dropdown menu to select my "Java EE Version" decides it doesn't want to give me any options at all.
Has anyone experienced this problem before, or can anyone offer a rough guess as to what my problem might be?
Thanks in advance!
EDIT: Update - it's not a problem with the JDK classpath of Tomcat. Tomcat works fine on the .jsp files it came bundled with.
I had the similar problem with Tomcat 8. But after downloading Tomcat 7.0.47 I can now choose from Java EE 5 and 6. Hope that helps.

Use wildfly (Jboss 8) with Intellij Idea

I just needed to upgrade my Jboss Server to 8 (http://www.wildfly.org/) and I'd like to know if there is any way to use it like Jboss6-7 in Intellij ?
When i try to add a Jboss server I get the message : "The selected directory is not a valid
Jboss home" (I select the folder up to all subfolders, like I do for any other jboss server).
The server configuration seems to be the same as Jboss 7 (folders, files)
ANSWER : Works nicely with Intellij Idea 132.425 (Cardea) preview
This is fixed in recently released WildFly 8 Beta1
get it at http://www.wildfly.org/download/
For now we have workaround in WildFly to make Idea believe it is still "jboss as"

The Tomcat installation directory is not valid. It is missing expected file or folder lib/jasper-el.jar

I have downloaded the Liferay Portal 6.1
Community Edition bundled with tomcat. Then i have downloaded the SDK for liferay. Following the steps given in this site to configure eclipse with liferay when i reach at the step 4 i got the following error.
All the related threads are specific to ubuntu. But i am using windows 7 64 bit. I am not getting how to solve this problem. All the files are present then why its showing me this error.
Any help would be appreciated.
You appear to be trying to create a Liferay v6.0 Tomcat Runtime and then pointing the directory to a Liferay v6.1 Tomcat runtime (notice the 6.1.1 in the install path). So go back to the previous screen and choose Liferay v6.1 Tomcat Runtime instead. If you don't have v6.1 then you need to make sure you have the latest version of Liferay IDE installed (lastest version is 1.6.1).

Context failed to start when deploy web-service in netbeans to tomcat-apache

I try to follow the Getting Started with JAX-WS Web Services tutorial on the netbeans site. I create the web-service-app (Java EE 6 Web, Tomcat 7.0), when I add a web-service class netbeans asks for me if I want to use METRO (because the server does't JSR-109), so I say yes and it adds some metro libraries.
Now the webservice is using the javax.ejb.Stateless as I selected the "Implement Web Service as a Stateless Session Bean" checkbox, but no Library containing this class is added and I get an error in Netbeans:
import javax.ejb.Stateless;
...
#WebService(serviceName = "WebServiceTest")
#Stateless()
public class WebServiceTest {...}
"cannot find symbol: class Stateless"
ofcourse it can't. When I add the "Java EE Web 6 API Library - javaee-web-api-6.0.jar" the error is solved, but when I deploy the project I get an error thats a whole lot more difficult, and that error is the actual problem...
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Ftjen%2FAppData%2FLocal%2FTemp%2Fcontext6376466830057976095.xml&path=/CalculatorWSApplication
FAIL - Deployed application at context path /CalculatorWSApplication but context failed to start
[here a direction to the line of error]
The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187)
[...a whole lot of red-collored stack-trace stuff]
BUILD FAILED (total time: 1 second)
at the following line:
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
I put the arguments over different lines like this:
<nbdeploy
clientUrlPart="${client.urlPart}"
debugmode="false"
forceRedeploy="${forceRedeploy}"
/>
Which didn't help me at all(but maybe it does help you), because the eror was at the line:
/>
Now if I comment out the Stateless usage, and remove the "Java EE Web 6 API Library - javaee-web-api-6.0.jar" library, there is no problem and it all works like a charm. (after a 'clean and build' otherwise it keeps going errored)
It doesn't matter which library i add, if I do, i get that same error. I can get the example working, but I would like to be able to add libraries without it crashing...
Hope to solve this mystery, Tjen
PS: some specs
Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_21; Java HotSpot(TM) 64-Bit Server VM 17.0-b17
System: Windows 7 version 6.1 running on amd64;
Tomcat 7.0.11
I do have jaxb-api.jar and jaxws-api.jar endorsed in the JDK 1.6 platform
This can be achieved by adding metro libraries to tomcat.
GlassFish has metro library inbuilt. In order to run web service on tomcat, Metro libraries have to be included.
please google how would you add library. best of luck
This is because you did not chose glassfish as web server, in creating the project you must chose glassfish as the web server and jdk 1.7 at least.
In my case I used glassfish from the start with jdk 1.7. I got the same error but then i changed my glassfish version to 3 instead of 3.1.2 in netbeans and it was fine.
It seems like it's a common issue between NetBeans and Tomcat.
To get around it, you need to log into Manager GUI through http://localhost/manager
Once you login, you will be able to deploy it using WAR file to deploy section where you can select it after you browse to it.

Categories

Resources