I'm trying to upgrade a perfectly running embedded Tomcat 5.5 to Tomcat 6.0. I understand that all I need to do is replace Tomcat 5.5 jars with 6.0.
That's what I did.
So I replaced the following jars:
catalina-5.0.28.jar catalina-5.5.9.jar catalina-optional-5.5.9.jar
commons-el.jar commons-modeler-1.1.0.jar jasper-compiler-jdt.jar
jasper-compiler.jar jasper-runtime.jar jmx-5.0.28.jar jsp-api-2.0.jar
naming-factory.jar naming-resources.jar servlet-api-2.4.jar
servlets-default.jar tomcat-coyote.jar tomcat-http.jar tomcat-util.jar
with:
annotations-api.jar catalina.jar jasper.jar tomcat-dbcp.jar
catalina-ant.jar el-api.jar jsp-api.jar tomcat-i18n-es.jar
catalina-ha.jar jasper-el.jar servlet-api.jar tomcat-i18n-fr.jar
catalina-tribes.jar jasper-jdt.jar tomcat-coyote.jar tomcat-i18n-ja.jar
tomcat-juli.jar
As soon as I start the server, I get the following message in the logs at INFO level:
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Dec 31, 2010 6:04:18 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/blah/blue/./WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Based on the this explanation, I need to remove a jar file which has a conflicting Servlet.class. I swear to God, there is no other conflicting jar file, I grepped system wide for Servlet.class, it matched only servlet-api.jar.
I also downloaded javaee.jar and replaced it by servlet-api.jar, to same avail.
Having tried lot of these stuff, I did not have much to look upto, so set the tomcat logging level to ALL. In the log I could see that it is trying to check for Servlet.class in each and every jar it is loading until it finds servlet-api.jar and throws "jar not loaded" message as soon as it finds servlet-api.jar. See below:
FINE: Checking for javax/servlet/Servlet.class
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappLoader setRepositories
FINE: Deploy JAR /WEB-INF/lib/servlet-api.jar to /usr/local/blah/blue/./WEB-INF/lib/servlet-api.jar
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappClassLoader addJar
FINE: addJar(/WEB-INF/lib/servlet-api.jar)
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
FINE: Checking for javax/servlet/Servlet.class
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/blah/blue/./WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappLoader setRepositories
UPDATE
I'm able to remove the above "jar not added" error by placing servlet-api.jar in a separate folder(like $CATALINA_HOME/common/lib). However the GUI still shows blank(Error 404) when I hit an URL :(. The log message when the URL is hit is described below.
UPDATE ends
Please note however, that Tomcat starts successfully!
And as soon as I hit the URL on the browser, I get blank page(this may be in my case only, I guess 'cuz of my web.xml, sorta different from most. Other people on the internet have got Error 404 instead.) with following log statements(at finest level)
Jan 2, 2011 9:40:01 AM org.apache.catalina.connector.CoyoteAdapter parseSessionCookiesId
FINE: Requested cookie session id is 0FBA716E3F9B0147C3AF7ABAE3B1C27B
Jan 2, 2011 9:40:01 AM org.apache.catalina.authenticator.AuthenticatorBase invoke
FINE: Security checking request GET /login.jsp
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: No applicable constraint located
Jan 2, 2011 9:40:01 AM org.apache.catalina.authenticator.AuthenticatorBase invoke
FINE: Not subject to any constraint
Jan 2, 2011 9:40:01 AM org.apache.catalina.core.StandardWrapper allocate
FINEST: Returning non-STM instance
I'm not sure if the above log message is important, but I'm for all-out disclosure here.
One interesting thing though, I manually created a dummy jsp file containing only "helloooo" just outside WEB-INF folder(no security constraints for this file). This file was accessible and could be displayed. But, all my jsp's and classes are inside WEB-INF(ofcourse).
Sick and tired of this issue, please help me solve it. I've already spent 20-24 hours on this unsuccessfully.
Any pointers directions hints leads?
The servlet-api.jar is definitely needed for running tomcat embedded. However, is seems to be a classloader issue here. The Classloader for the webapp must not have "direct" access to the servlet.jar, only through its parent class loader.
If you only replaced jars, then there must be a subtle difference in the ClassLoaders of 6.0 vs. 5.5, but I cannot say where.
Tomcat 5.5 and Tomcat 6.0 have some significant differences. My suggestion is to move the WAR files to the new Tomcat instead of trying to gut the old one. One particular difference that comes to mind is that the JAR files are all organized differently.
Since Tomcat 6.0 obviously comes with all of the Tomcat 6.0 JAR files, it stands to reason that you won't have any conflicts if you just use a fresh Tomcat 6.0 install and then move your WAR file applications to the new Tomcat 6.
You will probably still have conflicts, but you'll at least have one variable knocked out, you'll know you're working with a fresh, solid, Tomcat installation instead of one that might be broken or might not be broken.
Good call setting the logging level to ALL, just make sure you get all of the logging.properties files as sometimes there may be more than one.
http://tomcat.apache.org/tomcat-6.0-doc/logging.html
Good luck!
This seems strange - if you didn't change your own web app this issue must exit in 5.5, too.
As #daniel said, your web app is not allowed to have a jar file containing servlet stuff. If i interpret the log correctly, there is a servlet-api in the web app directory. Delete servlet-api completely there.
EDIT
What is the directory layout of your application, where do the jars (especially the tomcat jars) live.
What is the log output when tomcat starts without the servlet-api in your web app
How do you "embedd" tomcat
What's the classpath when you start your app
EDIT
You MUST separate the environment lets say in
\yourapp
|
+ lib
|
+ webapp
|
+ lib (this is where your webapp lives, WITHOUT servlet-api)
If this has similiarity to standard JavaEE container structure - it is NOT by pure hazard :-)
yourapp\lib hosts your application and tomcat libraries. This forms the classpath for starting.
The yourapp\webapp\lib jars are never referenced by the classpath, only by the webapp classloader. You must take the correct path to them into account when you configure your builtin tomcat to point to this webapp, otherwise the web app loader may not find them.
EDIT
Maybe start with something less ambitioned than a JSP. Do you have a simple test servlet deployed?
You must take care to which web application context you have deployed your application. In the log i see you use the root context. Is this really true? If for example you said
tomcat.addWebapp("foo", appBase);
in your embedding, you must request /foo/servlet, not /servlet in your browser.
So the issue really was: not compiling the source code with latest jars. The classes present on the machine were pre-existent and compiled using Tomcat 5.5 jars and not Tomcat 6.0. Transferring fresh classes solved my problem.
Big thanks to mtraut for showing interest on this question. I wish I could up-vote you more than once. :)
Related
I want to create a basic Google Web Application project and i get an 404 Page not found error.
I followed several tutorials and what i do is this:
Open eclipse - File - New - Other - Web Application Project (under Google) - name it - (it doesn't matter if i check "Use GWT" or not the result is the same - Finish.
Right now i have a newly created web application project, so i can test it in localhost. I right click it, run as - web application project (with google icon). After it finishes in my console i have this:
Mar 22, 2017 10:13:58 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector#0.0.0.0:8888
Mar 22, 2017 10:13:58 AM com.google.appengine.tools.development.AbstractModule startup
INFO: Module instance default is running at http://localhost:8888/
Mar 22, 2017 10:13:58 AM com.google.appengine.tools.development.AbstractModule startup
INFO: The admin console is running at http://localhost:8888/_ah/admin
Mar 22, 2017 12:13:58 PM com.google.appengine.tools.development.DevAppServerImpl doStart
INFO: Dev App Server is now running
I open Chrome and go to localhost and i get:
HTTP ERROR: 404
Problem accessing /.
Reason:
NOT_FOUND
Powered by Jetty://
I must specify that i am deploying behind a proxy server. I tried also to run it without proxy, same result. All my settings are correct, because if i create a Dynamic Web Project and i deploy it on a Tomcat server, that one works fine.
The solution that worked for me is this. Check your Java facet. It has to be 1.7. Mine was 1.8.
Thank you.
Summary
I've been tasked to write a Java web service to integrate two disparate systems in our enterprise environment. Since I'm actually an experienced C#.NET MVC developer and only consider myself intermediate at Java, I began by searching for "Java Web Service Tutorials". I am trying to run this common tutorial, but I'm unable to run the tutorial service due to an HTTP 404 error.
Process
I'm using the Java Web Application template in Netbeans 8.0.2. I used JDK 1.6.0.25 to compile the tutorial (since the eventual service I need to write will need this Java version to be compatible with some other JARs I'll be using). Everything compiles to a WAR file just fine.
I then deployed the WAR file by loading the server's Tomcat Manager GUI and using the WAR file to deploy feature. When I do so, the WAR file is copied, and the application starts. However, when I attempt to access the service via the link "http://localhost:8080/HelloWorld/hello" from the tutorial, the service returns a 404 error.
Server Environment
Oracle Enterprise Linux distro, version 3.8.13-44.1.1.el6uek.x86_64
Apache Tomcat 6.0.24
JVM 1.7.0_75-mockbuild_2015_01_20_16_42-b00
If the advice is that I need to change the Java or Tomcat versions or platforms, I need to know that as well since I have little experience with these technologies. However, I may not be able to change all the factors due to limitations with my Linux distro (per my server admin).
Things I've tried (in order):
Setup a Local Tomcat Server on Windows
I installed a local Tomcat Server on my Windows 7 laptop. Since the Linux server is running Java 1.7.0.75, I installed a matching Windows version of JRE 1.7.0.75 from Oracle's support page. I then downloaded Apache Tomcat 6.0.24 Windows Service from their archives and installed it successfully, using the JRE 1.7.0.75 and local port 1985 (to separate it from the GlassFish local server used within Netbeans).
Just as on the Linux server, my local Tomcat server couldn't start the tutorial. Manually clicking the start command link gives me the message "FAIL - Application at context path /com.mkyong.ws could not be started". My local server's logs don't show anything about that application failing to start either.
Adding JAX-WS RI JAR files to {$Tomcat}/lib
Per section 5 on the tutorial mentioned above, I then added the indicated JAR files to the server's {$Tomcat}/lib folder and restarted the server. This time, the application started, but I still couldn't access the service. The link "http://localhost:8080/HelloWorld/hello" from the tutorial returns a 404 error. I even tried copying the entire JAX-WS RI/lib folder to the {$Tomcat}/lib directory with no changes, so I backed out this change.
For reference, here's a list of the files I've copied:
gmbal-api-only.jar
ha-api.jar
jaxb-core.jar
jaxb-impl.jar
jaxws-api.jar
jaxws-rt.jar
management-api.jar
policy.jar
stax-ex.jar
streambuffer.jar
Enabling DEBUG mode in the local Tomcat Server
I un-deployed the WAR file. Using the Apache Tomcat Monitor, I stopped the service, deleted the existing logs, enabled the DEBUG logging level, and restarted the service. I then re-deployed the tutorial WAR file. I again saw it didn't start, and then I opened all the log files. There is not even a mention of the failure to access the service, but perhaps 404 errors aren't logged.
Running the service using the Netbeans-embedded Glassfish server
When I first created the Web Application, Netbeans offered to set me up with a local Glassfish server. I accepted, and I set everything up with defaults. When I try to run the tutorial against this server, I cannot access the service. The link "http://localhost:8080/HelloWorld/hello" from the tutorial still returns a 404 error.
Researching other posts and tutorials
Here are some other StackOverflow posts and websites I've reviewed without finding a resolution:
JAX-WS on Tomcat server (doesn't apply)
Deploying JAX-WS webservice as War in Apache Tomcat (similar to the tutorial in recommending to copy the extra JAR files)
JAX-RPC / JAX-WS runtime in Apache Tomcat (just informational)
how to deploy a jax-ws service to eclipse or tomcat? (similar to the tutorial in recommending to copy the extra JAR files)
https://myarch.com/create-jax-ws-service-in-5-minutes/ (similar to the tutorial but without deployment help)
Questions I'm Pondering
Is there something wrong with the code in the tutorial? (Doesn't seem likely since from the comments others have had success.)
Is there a significant difference in the versions of Java or Tomcat he's using in the tutorial? (He doesn't give an versions of Java or Tomcat.)
Should I run local Tomcat against a JDK instead of a JRE?
Should the tutorial be compiled against the same JDK as Tomcat is using? (I hope not as this would seem very limiting...)
Can I even run JAX-WS in Tomcat? (Based on pages like http://tomee.apache.org/apache-tomee.html, it seems like the base TOmcat might not even support JAX-WS? Again, just my limited experience.)
I'd appreciate any troubleshooting guidance anyone can offer. Thank you in advance for the help!
UPDATE #1
Per the request of #NIKETBHANDARY, I stopped the service, deleted the logs, restarted the service, and browsed in Chrome to localhost:1985/helloworld/hello - still getting the 404 error. I then opened the catalina.log file, but it's completely empty. Only jakarta_service.log has any log entries, and all are about the service starting. I also verified that the logging level is set to debug. What else can I change to get additional log messages?
I also ran a search for "com.mkyong" in the entire Tomcat directory. Only the webapp WAR file, webapps/../META-INF/context.xml, webapps/../WEB-INF/sun-jaxws.xml, and /conf/cataline/localhost/com.mkyong.we.xml files returned any hits. Nothing in any logs. Could that indicate that this is a configuration problem?
UPDATE #2
Apparently, Tomcat doesn't flush its log messages fully until the thread closes as the service shuts down (probably due to the logging configuration). As such, I stopped the service which flushed the log files. Here's the entire contents of the catalina.log file (which does contain a reference to com.mkyong):
Aug 17, 2015 9:51:17 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.19.
Aug 17, 2015 9:51:17 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Aug 17, 2015 9:51:19 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-1985
Aug 17, 2015 9:51:19 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
Aug 17, 2015 9:51:19 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2121 ms
Aug 17, 2015 9:51:19 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 17, 2015 9:51:19 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Aug 17, 2015 9:51:19 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor com.mkyong.ws.xml
Aug 17, 2015 9:51:20 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
Aug 17, 2015 9:51:22 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate <init>
INFO: WSSERVLET14: JAX-WS servlet initializing
Aug 17, 2015 9:51:22 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Aug 17, 2015 9:51:22 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Aug 17, 2015 9:51:22 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Aug 17, 2015 9:51:22 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Aug 17, 2015 9:51:22 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Aug 17, 2015 9:51:22 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-1985
Aug 17, 2015 9:51:22 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Aug 17, 2015 9:51:22 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3895 ms
UPDATE #3
I'm becoming more convinced there's a configuration problem somewhere. On a hunch, I studied and installed Apache TomEE 1.7.2 for Windows, pointing to the same JRE as the regular Tomcat. After studying the running.txt file and experimenting with the properties and settings, I was finally able launch a local version of TomEE. I deployed the same WAR file as before, and I found it would not load the WAR application due to the following error:
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
Googling that error led (again) to MKYong's blog for a fix (copy the jaxws-rt.jar file to the {$tomcat}/lib folder. I redeployed the WAR file, and the manager loaded the application. HOWEVER, just like on regular Tomcat, the URL "http://localhost:8080/HelloWorld/hello" from the tutorial still returns a 404 error. So, the results are exactly the same.
Short of compiling the tutorial against other versions of JDK, I'm running out of ideas quickly... :-)
UPDATE #4
Per another request below, here's a list of all JAR files in the {$Tomcat}\lib folder:
annotations-api.jar
catalina.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
el-api.jar
gmbal-api-only.jar
ha-api.jar
jasper.jar
jasper-el.jar
jasper-jdt.jar
jaxb-core.jar
jaxb-impl.jar
jaxws-api.jar
jaxws-rt.jar
jsp-api.jar
management-api.jar
policy.jar
servlet-api.jar
stax-ex.jar
streambuffer.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
The {$Tomcat}\webapps folder contains the following:
..\com.mkyong.ws
..\docs
..\examples
..\host-manager
..\manager
..\ROOT
..\com.mkyong.ws.war
Update #5
The {$Tomcat}\webapps\com.mkyong.ws directory contains the following:
Here's a screenshot of the Tomcat Manager GUI:
Here's a screenshot of the HTTP 404 error I'm receiving along with the URL:
I've also confirmed that the files in the WAR exactly match the tutorial.
There is problem in deployment of your ws module.
U have just copied the whole folder from the MKyoung sample.
I doesn't work that way around.
Not only that now display all the folders and files structure inside the ws module delete the rest of the modules from your post.I wanted only the structure of ws module.
The module name has to sample instead of com.mkyoung.ws
and the structure for it has to be
**sample**
------WEB-INF
------index.jsp
WEB-INF
----classes
----web.xml
----sun-jaxws.xml
classes
----com
--------mkyoung
-----------ws
ws
-----Helloworld.class
-----HeloworldIMPL.class
#NIKETBHANDARY helped me understand what was wrong and how to quickly correct it. I'd also like to post exactly what I did wrong and how I fixed it permanently so that future coders can benefit from my five-day experience. :-)
When I originally built the tutorial using Netbeans, I used the Java Web --> Web Application template (which is available after installing the Java EE Base plugin accessible through Netbeans --> Tools --> Plugins):
I built all the files exactly per the tutorial, but I failed to really read through step #5, especially this line:
<jar jarfile="${dist}/war/HelloWorld-${DSTAMP}.war" basedir="${dist}/war/build/"/>
After further review, I found that the build script was producing a WAR file called HelloWorld.war. Then, when that file was deployed to Tomcat, the web application was called HelloWorld in the Tomcat Manager. That's why the service endpoint was set to http://localhost:8080/HelloWorld/hello. The "HelloWorld" is literally the name of the Tomcat application, and the "/hello" part corresponds with the endpoint from the sun-jaxws.xml file. (Looking back, it makes total sense given typical web hosting organization. IIS pretty much works the same way.)
So, to fix the problem, I needed to modify the Netbeans project to produce a WAR file named HelloWorld.war. In the tutorial, he includes an actual Ant build script. In this case, I needed to take these steps:
Right-click on the project in the Netbeans Project Explorer.
Choose Properties.
Click on the Build --> Packaging category.
Set the WAR file field to HelloWorld.war.
Here is a screenshot:
Once that was done, I created a new build, deployed to my local Tomcat server, and everything worked as expected. I was also able to deploy the WAR file to my Linux server and test it successfully. Problem solved! :-)
I have a a GWT application and I want to create a war file using hudson .So I have created a job and in the configuration I have checked the build option i.e invoke ant. so it uses the build.xml from my application and creates the war file . And my ant file i.e build.xml contains following targets:
1.Java compilation
2.GWT compilation
3.Create a war
4.Deploy it into tomcat with JDK 1.7.0
Application is compiling using jdk 1.6 and deploy it into the tomcat with jdk 1.7 but its not working. Is tomcat with JDK 1.7.0 is compatible with 1.6. ?? or is there another problem because some gwt-dev,gwt-user jars are still in war folder. In my tomcat logs following info is there:
INFO: Deploying web application archive /usr/local/tomcat_lh/webapps/Nightly.war
Dec 19, 2012 10:13:41 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/tomcat_lh/webapps/Nightly/WEB-INF/lib/gwt-dev.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Dec 19, 2012 10:13:41 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/tomcat_lh/webapps/Nightly/WEB-INF/lib/gwt-user.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Dec 19, 2012 10:13:41 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/tomcat_lh/webapps/Nightly/WEB-INF/lib/javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Dec 19, 2012 10:13:41 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
It is far, far more likely that you are doing something wrong.
I suspect if you deploy to Java 6 you will see the same issues, if not exactly the same errors. The only difference might be you would see different line numbers in the stack traces.
FYI: The code base for Java 7 and recent versions of Java 6 is very similar and even shares many of the same bugs. e.g. the was a well known bug in Java 7 when it was released to do with loop optimisation and people suggested waiting for it to be fixed before migrating. The interesting thing was the bug was also in Java 6, the only difference was that the optimisation was on by default in Java 7 and off by default in Java 6.
BTW: Most of the performance improvements in Java 7 were back ported into Java 6 so the only good reason to use Java 7 is a) you want to use the new syntax b) you are concerned that Java 6 is EOL.
In your case, there might be no good reason to use Java 7, for now.
I'm was following http://googcloudlabs.appspot.com/ tutorial to create new Google App Engine project. It throws me an error as per below when I try to run the from my local host, but when I deployed it working fine. (http://mynewcloudcom.appspot.com/). Please help.
HTTP ERROR: 503
Problem accessing /. Reason:
SERVICE_UNAVAILABLE
Powered by Jetty://
Eclipse Console
Mar 05, 2012 10:42:46 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Mar 05, 2012 10:42:46 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\Smartag_Eclipse_Project\DontEditProject\war\WEB-INF/appengine-web.xml
Mar 05, 2012 10:42:46 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\Smartag_Eclipse_Project\DontEditProject\war\WEB-INF/web.xml
Mar 05, 2012 6:42:48 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8888/
Mar 05, 2012 6:42:48 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8888/_ah/admin
Found the answer. I need to run in JDK1.6. Once i changed the Java Compiler(right click project -> properties -> Java Compiler -> (Check) Enable project specific settings -> change the Compiler compliance level), its works fine now. Thanks.
I had the same problem. I justed changed the port from 8888 to 80 in the Debug Configuration and it worked for me.
I had the same issue.
for me the problem was one of my filters had an exception. specifically objectify - it was not loaded properly. you can delete the filter and see if that's it
When using Java 1.7, also check for the Execution Environment and set it to JavaSE-1.7.
You can look into the Execution Environment in:
Right Click -> Properties -> Java Compiler
And you have the option above Restore Defaults and Apply.
I faced the same issue and resolved it by selecting "Automatically select an unused port" in run configuration.
Sometimes it happens there is a "hanging" process that blocks the port. Therefore changing port in Run configuration helps, as well as checking "Automatically select an unused port" in run configuration.
It happened with me too. In my case, I had Run the project and due to some error in my code, the Project ran with errors. So, I debugged it and Run it again but without cancelling the earlier one in the console and it gave me that error. After cancelling or stopping the Project, it ran fine.
i had the same issue. Seems that Plugin is stocked on creating and opening the socket for the server. i don't really know why happens, I've resolved in this way.
Open Run Configurations.
Open Server tab. Change the Embedded server Port.
Open Arguments tab.
3.1 - VM arguments box. i've deleted all that stuff there and just let this
line and save changes and run it.
-Xmx512m -javaagent:/Applications/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.7.5/appengine-java-sdk-1.7.5/lib/agent/appengine-agent.jar
It has worked pretty good 4me.
If someone know which events or configuration change are the reason for . please let us know it
NOTE: "I'm not responsible for unexpected behave. I'm don't know if there is side effects ahead"
The solution working for me is to run appEngineServer from command line using Gradle, as comments in generated build.xml for endpoints module proposes. And gradle config includes option for Java 1.7 compatibility, so it's no reason to use Java 1.6 if You want 1.7:
gradlew modulename:appengineRun
Currently, the appengine gradle plugin's appengine devappserver
launch doesn't interact well with Intellij/AndroidStudio's
Gradle integration. As a temporary solution, please launch from the command
line. ./gradlew modulename:appengineRun
I had a condition where a servlet defined in the web.xml with non existent class name. I specified proper class name, worked!
Let me start with what I use:
- ubuntu 11.04
- apache-tomcat-6.0.33
some details on my java:
adam#adam-1215N:~$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
OpenJDK Server VM (build 20.0-b11, mixed mode)
adam#adam-1215N:~$ ll /usr/lib/jvm
total 84
drwxr-xr-x 3 root root 4096 2011-08-28 10:09 ./
drwxr-xr-x 229 root root 69632 2011-08-28 13:13 ../
lrwxrwxrwx 1 root root 14 2011-08-27 21:03 default-java -> java-6-openjdk/
lrwxrwxrwx 1 root root 14 2011-08-27 21:03 java-1.6.0-openjdk -> java-6-openjdk/
drwxr-xr-x 7 root root 4096 2011-08-27 21:11 java-6-openjdk/
-rw-r--r-- 1 root root 2164 2011-06-11 11:07 .java-6-openjdk.jinfo
How I deploy an application:
I build it using mvn clean install. Then I extract the content of created .war file and copy it to my directory in webapps in tomcat. It worked initially.
Now, the meritum:
Project that I try to deploy is quite simple. Everything worked until I wanted one method to return Set of objects. When building I got error that generics are not supported in java 1.3. I googled, and found that I need to add maven-compiler-plugin to my pom.xml pointing which java I want to use. So I added, pointing at 1.6. And here it comes:
Aug 28, 2011 6:25:50 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Reloading context [/myproject]
Aug 28, 2011 6:25:50 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Aug 28, 2011 6:25:50 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/myproject] startup failed due to previous errors
Now the bad news
I tried to return to initial maven configuration, deleted generics that made me use java 1.6 and problem still exists... I was messing with jdk, installing and removing different versions, that is why I gave you same details on what I have in the beginning.
Tomcat also gives one more warning, I thought it is irrelevant but I didn't see it before (or didn't notice) so I'm putting it here:
Aug 28, 2011 6:15:13 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386:/usr/java/packages/lib/i386:/usr/lib/i386-linux-gnu/jni:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/jni:/lib:/usr/lib
I'm confused and tired, after fighting with it almost 2 days. Any help appreciated.
Edit
I have found reason: I have changed name of class that was referenced in web.xml and "Refactor" tool in Eclipse didn't change it.
Leaving it here in case someone find it useful :)
I have looked up in logs/localhost.2011-08-28.log and found java.lang.ClassNotFoundException which led me to web.xml containing reference to class that I had renamed
I was getting this error when deploying a spring mvc app from eclipse. The maven build included all the dependent jars for spring under WEB-INF/lib and that worked fine when deployed to Tomcat. The eclipse Indigo export-war functionality was not exporting the dependent spring jars presumably because of the maven directory structure, even though it was in the build path and all the jars were displayed under the Libraries tag.