Getting Error when deploying on Tomcat - gwt

I have already compiled my application, when I am running it in web
mode from Eclipse everything is working perfectly fine, no error at
all. In my project, i'm using several libraries such as hibernate. All
libraries have been correctly been placed on the classpath as well as
in the lib folder in web-inf.
however when i'm deploying it on tomcat, i'm getting several problem,
first no data is being loaded from database. I was using a lib for
capcha at http://www.javacodegeeks.com/2010/06/add-captcha-gwt-application.html. That also is not working well
I am also trying it on Jetty with the same problem
Can someone please help, i've got to deploy this system??

Be sure to include all required libraries in your /war/WEB-INF/lib folder

Yes, it was a problem of lib, whenever deploying your app on the server, make sure that u have the required libs that r on your classpath in the folder webinf/lib.

Related

Running jersey 2 server using jetty 9

I have been struggling for many hours on trying to deploy a simple HelloWorld webservice written in java on a windows 7 (later ill need on linux) pc.
Most of the examples I found (from general places, and others questetions on stackoverflow) didn't work or used deprecated versions of jersey and other librarys.
My goal, is to write a webservice in java, where coding it should be easy and so does deploying it. It doesn't need to suuport anything special regarding the amount of request running and performance (my requirements are minimum)
Frommy research, I have come to believe the use of jersey with embeded netty web service should anser what I was looking for (if someone knows better, I would also like to hear about it, tough it isn't my main problem in this questetion but might just be an alternative solution)
I have came across this eaxmple:
jersey2-jetty-example
It gives you a working project with the dependencies needed from maven to run jersey and jetty embedded server (which can be run as a standalone jar which is exactly the kind of easy deploy im looking for)
I cloned the example and got everything running. I had problems importing it to eclipse, so I used the following command on the example folder:
mvn -DoutputDirectory=./lib dependency:copy-dependencies
which will give you a copy of the lib folder of the deps from maven needed,
then I created a java project with this lib folder in the build path and same source code as the sample, and all worked good.
The problem occurs when I try to take this java project and export it as an runnable jar (with the source files included option !).
I can then use java -jar to run the service, but when I try to access it from the browser (same as used in when I run it from eclipse), it never works, im always getting error 404 for the same routes that worked a second ago when running from eclipse. I couldn't figure out whats the source of the problem or what eclipse does differently that makes it behave in a different fashion.
I have found the reason the jar didn't work while in eclipse it did work, it was because of a duplicate jar that I was importing the caused the problem. The jars I got from maven in the git sample had 2 duplicate jars called hamcrest-all and hamcrest-core. removing one of them from the project build path fixed the problem.
If someone can answer the other open ended questetion that I asked, which is if using jersey and jetty like this is the best solution for my requirments I will be happy to hear about it

Issue with deploying GWT app to tomcat in eclipse

Following this tutorial, I could execute GWT app using eclipse. I could access the app at http://127.0.0.1:8888/De_vogella_gwt_helloworld.html?gwt.codesvr=127.0.0.1:9997.
Then, I googled to find a way to deploy the app to tomcat, and I found this site. It has two step way to exporting GWT app to tomcat.
Exporting the src directory into jar file.
Using ant create a war file.
I copied the hello.war file into /Library/Tomcat/webapps, and open the browser with localhost:8080/hello to get this error.
When I click the HTML file in webapps directory, so I think something's wrong with the packaging.
What might be wrong?
You need to compile your GWT app to run in production mode. See this section of the GWT doc for detailed steps (for GWT 2.4).
From David's answer, I could get it working.
I had to compile the application again.
to get it working.

How do you import a Java Class Library into a Java Web project (using NetBeans)?

I've already tried the options "Add folder...", "Add Library...", and "Add JAR/Folder...", but it's not working this time -- I've done this several times before without any problems.
I've also tried to add the folder / JAR file (.war-file) manually to the projects properties in every thinkable way, but still no success.
And so far, Google hasn't helped either..
Any help would really be appreciated.
(This is for a Java Web project with JavaServer Faces, using NetBeans 7.1)
Solved: I never found out what caused the problem. I ended up re-installing entire NetBeans, and re-created (a thousand times) the project I was trying to import. And in the end, I got it working.
Put the JAR file in the WEB-INF/lib directory of your web project. All JARs in the WEB-INF/lib and all packages in WEB-INF/classes are automatically in the CLASSPATH.
Can you make "Hello, servlet" work? If not, why bother with JSF? Do a simple web app successfully and build up from there.
I had this problem with netbeans, but it seems like all the answers I found are for Eclipse (I guess am wrong) as I dont see any WEB-INF/lib directoryin NetBeans, though I have a WEB-INF directory.
so here what I did.
I remove the tomcat server on NetBeans, go to C:\apache-tomcat-7.0.30\lib , put the jstl-1.2.jar file their, restart NetBeans and add a new (Tomcat) server, create a new web app, and their, I could find the jstl-1.2.jar file in the Libraries > Apache tomcat.
and for unknown reason, it worked.!

JBoss 5.x and Axis2

What libraries are required to run a Web Service Client that has been generated from Axis 2 on JBoss. So far I have not found anything in my searches.
I assume that the following error:
org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
Is due to the fact that I have place every jar file from Axis lib folder into my projects
My Solution
Did it the hard way - added and subtracted jars from my lib directory until I got it to deploy and run with no exceptions
Is what you have pasted the root cause of the stack trace? In case it is not, the problem is that probably your app is deployed with xerces related jar files in it (ex: xercesImpl-x.x.x.jar). JBoss is shipped with the xerces jars in its JBOSS_HOME/lib/endorsed folder. If the same classes are deployed with your web app this may result in class loading issues.
You can try to remove the xerces libs from your app and then test the web service client again.
Cheers!

Tomcat reporting IncompatibleClassChangeError - classpath problem?

I'm trying to deploy an application to Tomcat 7 on a Windows server. I have a local copy set up and have tested with Eclipse without any trouble, but on the production server I get IncompatibleClassChangeError messages.
This had been a problem on the local server when there were problems with the classpath, but I configured the correct classpath in the server properties inside Eclipse and everything ran fine.
I'm new to Tomcat and from what I understand it should be reading jar files from my my WEB_INFO/classes directory, but when my jars are there the app doesn't want to load at all. When I move them to the $CATALINA_HOME/lib (I realize that's not where they should go) the app loads fine but reports the IncompatibleClassChangeError.
Why aren't my jars being read from WEB-INF/classes? Is there some configuration I should look at to fix this?
Webapp-specific JAR files should go in Webapp/WEB-INF/lib, not in Webapp/WEB-INF/classes. The Tomcat/lib should only be used for appserver specific libraries and optionally also JAR files which should be shared among the deployed webapplications.
There might be more into the IncompatibleClassChangeError, this can have an entirely different cause. But first try getting the JAR's in the right place. If in vain, then please update your question to include the detail message. This at least smells that you're putting JAR files of a different appserver make/version in the classpath.