RE: deploying a war file and starting the application
Hello everyone, hope all is well with you this Monday... I am trying to figure out why my web services do not work in Tomcat. I have not found useful information on the web as most searches bring back information from much older versions of Tomcat. The following shows my web service code in eclipse package com.surecomp.allMATCH.client.webservices; import javax.jws.*; import com.surecomp.allMATCH.client.IReasonCode; import com.surecomp.allMATCH.client.businesslogic.ReasonCode; @WebService(serviceName=ReasonCodeService) public class ReasonCodeService implements IReasonCode { @WebMethod public String getReasonCodeData(String sSession, int iSiteId) { IReasonCode obj = (IReasonCode)ReasonCode.newInstance(); return obj.getReasonCodeData(sSession,iSiteId); } @WebMethod public String saveReasonCode(String sSession, int iSiteId, String sCode, String sDescription, String sUser) { IReasonCode obj = (IReasonCode)ReasonCode.newInstance(); return obj.saveReasonCode(sSession, iSiteId, sCode, sDescription, sUser); } @WebMethod public String deleteReasonCode(String sSession, int iSiteId, int iExceptionId, String sCode, String sDesc, String sUser) { IReasonCode obj = (IReasonCode)ReasonCode.newInstance(); return obj.deleteReasonCode(sSession, iSiteId, iExceptionId, sCode, sDesc, sUser); } @WebMethod public String approveReasonCode(String sSession, int iSiteId, int iExceptionId, String sCode, String sDesc, String sUser) { IReasonCode obj = (IReasonCode)ReasonCode.newInstance(); return obj.approveReasonCode(sSession, iSiteId, iExceptionId, sCode, sDesc, sUser); } } Eclipse makes the war file I am using. The first item is found by help via this group is that url-pattern must start with a slash. Not sure why Eclipse would not include the Slash as its required. So I added them and the system initially appears to be working until I call a web service. The following is my web xml. ?xml version='1.0' encoding='UTF-8'? web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.5 id=web-app_1 display-nameallMATCHWeb/display-name servlet servlet-nameInitServlet/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class load-on-startup1/load-on-startup /servlet servlet servlet-namedataextract.csv/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class /servlet servlet servlet-nameLearnedExceptionServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.LearnedExceptionService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameDataExtractServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.DataExtractService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameReportServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.ReportService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameBranchesServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.BranchesService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameContactServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.ContactService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameArchiveServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.ArchiveService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameCLSStatusServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.CLSStatusService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameLanguageServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.LanguageService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameTradeLocksServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.TradeLocksService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-namePasswordSettingsServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.PasswordSettingsService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameBICServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.BICService/servlet-class load-on-startup0/load-on-startup /servlet servlet servlet-nameLoginServiceServlethttp/servlet-name
Re: deploying a war file and starting the application
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/31/2011 9:09 AM, robert.jen...@surecomp.com wrote: I am trying to figure out why my web services do not work in Tomcat. The following shows my web service code in eclipse package com.surecomp.allMATCH.client.webservices; import javax.jws.*; import com.surecomp.allMATCH.client.IReasonCode; import com.surecomp.allMATCH.client.businesslogic.ReasonCode; @WebService(serviceName=ReasonCodeService) public class ReasonCodeService implements IReasonCode { [snip] servlet servlet-nameReasonCodeServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.ReasonCodeService/servlet-class load-on-startup0/load-on-startup /servlet You are trying to deploy a class that is not a servlet. A servlet must inherit from javax.servlet.Servlet. Are these supposed to be web services that are deployed into some kind of web services container? If so, you don't want to configure them in web.xml. Instead, you have to configure them according to the web service container you are trying to use. What web service container are you trying to use? You mentioned earlier in the thread that WebSphere and WebLogic servers were working well. Perhaps that's because they provide their own web service containers while Tomcat does not? When Tomcat starts each web service throws the following error. I understand that loadonstart value of zero is default and not needed. Again, the war/web.xml is generated by eclipse. INFO: Marking servlet ReasonCodeServiceServlethttp as unavailable Jan 31, 2011 8:53:13 AM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /allMATCHWeb threw load() exception java.lang.ClassCastException: com.surecomp.allMATCH.client.webservices.ReasonCodeService cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048) That's because ReasonCodeService (and presumably all your other services) do not inherit from javax.servlet.Servlet. Is it a requirement for tomcat that a web service implements Servlet? Tomcat does not provide any kind of web service container. For that, you'll need Apache Axis or any number of other fine web service containers. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1HMWwACgkQ9CaO5/Lv0PCaagCglQvsqA/7dA+7tuuZe8f2BKDI d+UAn1gDeUruhgCcVjfdY07dxXDLsi48 =EzXN -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: deploying a war file and starting the application
Christopher I got everthing working Sent from my iPhone On Jan 31, 2011, at 5:03 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/31/2011 9:09 AM, robert.jen...@surecomp.com wrote: I am trying to figure out why my web services do not work in Tomcat. The following shows my web service code in eclipse package com.surecomp.allMATCH.client.webservices; import javax.jws.*; import com.surecomp.allMATCH.client.IReasonCode; import com.surecomp.allMATCH.client.businesslogic.ReasonCode; @WebService(serviceName=ReasonCodeService) public class ReasonCodeService implements IReasonCode { [snip] servlet servlet-nameReasonCodeServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.ReasonCodeService/servlet-class load-on-startup0/load-on-startup /servlet You are trying to deploy a class that is not a servlet. A servlet must inherit from javax.servlet.Servlet. Are these supposed to be web services that are deployed into some kind of web services container? If so, you don't want to configure them in web.xml. Instead, you have to configure them according to the web service container you are trying to use. What web service container are you trying to use? You mentioned earlier in the thread that WebSphere and WebLogic servers were working well. Perhaps that's because they provide their own web service containers while Tomcat does not? When Tomcat starts each web service throws the following error. I understand that loadonstart value of zero is default and not needed. Again, the war/web.xml is generated by eclipse. INFO: Marking servlet ReasonCodeServiceServlethttp as unavailable Jan 31, 2011 8:53:13 AM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /allMATCHWeb threw load() exception java.lang.ClassCastException: com.surecomp.allMATCH.client.webservices.ReasonCodeService cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048) That's because ReasonCodeService (and presumably all your other services) do not inherit from javax.servlet.Servlet. Is it a requirement for tomcat that a web service implements Servlet? Tomcat does not provide any kind of web service container. For that, you'll need Apache Axis or any number of other fine web service containers. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1HMWwACgkQ9CaO5/Lv0PCaagCglQvsqA/7dA+7tuuZe8f2BKDI d+UAn1gDeUruhgCcVjfdY07dxXDLsi48 =EzXN -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This mail was sent via Mail-SeCure System. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: deploying a war file and starting the application
binLmJ2Fr2lkQ.bin Description: PGP/MIME version identification
Re: deploying a war file and starting the application
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/28/2011 4:24 PM, robert.jen...@surecomp.com wrote: webapps allMATCHWeb documents images lib logs META-INFO Is that application-specific? The standard metadata directory for JAR and WAR files is META-INF, not META-INFO. It shouldn't affect anything, here, unless you are trying to use a META-INF/context.xml file to configure your webapp (which obviously won't work if it's META-INFO/context.xml because that's not the right path). This is the content of the web.xml web.xml looks good to me. A request to http://host/allMATCHWeb/ should be redirected (or at least internally forwarded) to http://host/allMATCHWeb/login.html (due to your welcome-file-list setting). The log files produced by Tomcat contain the following catalina.2011-01-28.log contains [snip] INFO: Deploying web application archive allMATCHWeb.war [snip] INFO: Server startup in 18243 ms Good. This indicates that the server did start, and your webapp did deploy. If you've set the swallowOutput=true in your Context, your stdout log messages will go to a different logger. Are those all the log files created in the logs/ directory? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1FurcACgkQ9CaO5/Lv0PCkOgCfYlrMpitans7w7QL81s/Pt80T ZQEAoKBBZa4wPtdbkJMTJzlzjfWKgbYd =4RoJ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: deploying a war file and starting the application
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/28/2011 6:05 PM, robert.jen...@surecomp.com wrote: Well after playing with web.xml I got my app up and partly working in Tomcat 7. Good that it's working... sorry only partly. When I go to http://localhost:7080/allMATCHWeb the default page is loaded. My properties file is loaded and language based webpages generated, etc. Good. What about your log statements? Where did you eventually find them? Also, what did you have to do to get your InitServlet to run? Now my issue seems to be with web services. Again the web.xml contains the following for each webservice. servlet servlet-nameMessageServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.MessageService/servlet-class load-on-startup0/load-on-startup Note that load-on-startup0/load-on-startup is the default, so you don't actually need that. /servlet servlet-mapping servlet-nameMessageServiceServlethttp/servlet-name url-patternMessageService/url-pattern URL patterns are required to start with /. Didn't we cover this? /servlet-mapping Now, these work for webshpere and weblogic, so I am assuming (bad thing I know) that the same would work for Tomcat. Anything that is written and deployed to specification should work in all containers. If you are having a problem with a spec-compliant webapp I assure you it will be fixed ASAP. The log file is producing the following when deploying the services. INFO: Marking servlet MessageServiceServlethttp as unavailable Jan 28, 2011 5:59:40 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /allMATCHWeb threw load() exception java.lang.ClassCastException: com.surecomp.allMATCH.client.webservices.MessageService cannot be cast to javax.servlet.Servlet I'll bet you have all kinds of inappropriate libraries deployed in various places. What libraries have you added to CATALINA_BASE/lib? What changes (if any) have you made to CATALINA_BASE/catalina.properties What libraries do you have in WEB-INF/lib? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1FvAUACgkQ9CaO5/Lv0PDJ4ACeJTgnaCkk3Sw6OVUGgJiDHsyA R6EAni/4kB4tAxa7/PAPHSCX+65u3bJd =cOMp -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: deploying a war file and starting the application
On 30 Jan 2011, at 19:29, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/28/2011 6:05 PM, robert.jen...@surecomp.com wrote: Well after playing with web.xml I got my app up and partly working in Tomcat 7. Good that it's working... sorry only partly. When I go to http://localhost:7080/allMATCHWeb the default page is loaded. My properties file is loaded and language based webpages generated, etc. Good. What about your log statements? Where did you eventually find them? Also, what did you have to do to get your InitServlet to run? Now my issue seems to be with web services. Again the web.xml contains the following for each webservice. servlet servlet-nameMessageServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.MessageService/servlet-class load-on-startup0/load-on-startup Note that load-on-startup0/load-on-startup is the default, so you don't actually need that. /servlet servlet-mapping servlet-nameMessageServiceServlethttp/servlet-name url-patternMessageService/url-pattern URL patterns are required to start with /. Didn't we cover this? /servlet-mapping Now, these work for webshpere and weblogic, so I am assuming (bad thing I know) that the same would work for Tomcat. Anything that is written and deployed to specification should work in all containers. If you are having a problem with a spec-compliant webapp I assure you it will be fixed ASAP. The log file is producing the following when deploying the services. INFO: Marking servlet MessageServiceServlethttp as unavailable Jan 28, 2011 5:59:40 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /allMATCHWeb threw load() exception java.lang.ClassCastException: com.surecomp.allMATCH.client.webservices.MessageService cannot be cast to javax.servlet.Servlet I'll bet you have all kinds of inappropriate libraries deployed in various places. What libraries have you added to CATALINA_BASE/lib? What changes (if any) have you made to CATALINA_BASE/catalina.properties What libraries do you have in WEB-INF/lib? Also, there was talk of a ServletContextListener - which won't work unless defined as such in web.xml. Unless I've missed this? p - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1FvAUACgkQ9CaO5/Lv0PDJ4ACeJTgnaCkk3Sw6OVUGgJiDHsyA R6EAni/4kB4tAxa7/PAPHSCX+65u3bJd =cOMp -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: deploying a war file and starting the application
From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application servlet-mapping servlet-nameMessageServiceServlethttp/servlet-name url-patternMessageService/url-pattern /servlet-mapping Now, these work for webshpere and weblogic, so I am assuming (bad thing I know) that the same would work for Tomcat. You already answered your own question in your first query, and Chris S explained why WebSphere and WebLogic are cheating: The first issue I had was with url-pattern. It appears that Tomcat requires they start with a slash (/). I made the change and I no longer receive any errors while starting Tomcat. This is a spec requirement, not a Tomcat requirement. Other containers may be more lenient. You should read the servlet spec. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: deploying a war file and starting the application
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/28/2011 1:09 PM, robert.jen...@surecomp.com wrote: I have downloaded and configured Tomcat 7. All appears to be working. Glad to hear it! I have deployed a war file that currently works with WebSphere 7 and WebLogic 11g. The first issue I had was with url-pattern. It appears that Tomcat requires they start with a slash (/). I made the change and I no longer receive any errors while starting Tomcat. This is a spec requirement, not a Tomcat requirement. Other containers may be more lenient. The following image shows the startup window and that my war is being deployed. Within the webapps directory a directory containing my webapp is created. Images are stripped from posts to the list. Can you post it somewhere online and give us a link? Or, just copy/paste any relevant content from your screen? My initial servlet is called InitServlet and it is marked as load-on-startup (please see following image) . Ditto. I have two questions 1) If I type http://localhost:7080/allMATCHWeb in to a browser shouldn’t see this login.html page? I don’t… however I can access it by http://localhost:7080/allMATCHWeb/login.html You'll have to provide your web.xml for us to know when you need authentication challenges. Are you using container-managed authentication? 2) The load-on-start InitServlet class is not being executed as I have no logs generated or any other startup items handled, any ideas? Again, including web.xml should help. Note that using an InitServlet hasn't been recommended since the addition of the ServletContextListener interface a long time ago. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1DHsYACgkQ9CaO5/Lv0PBhSQCeNtR93FGfQecpwJ/n02ioUhpP x2MAn2WmpQ0vzJ3YAbrMQrE9SnMmOq++ =WYyb -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: deploying a war file and starting the application
Christopher, Thanks for your assistance. Here is my web.xml ?xml version='1.0' encoding='UTF-8'? web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.5 id=web-app_1 display-nameallMATCHWeb/display-name servlet servlet-nameInitServlet/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameInitServlet/servlet-name url-pattern/InitServlet/url-pattern /servlet-mapping welcome-file-list welcome-file/login.html/welcome-file /welcome-file-list /web-app This is the InitServlet class declaration public class InitServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet, Internationalizable This is the start of init() method public void init() throws ServletException { synchronized (this) { if (initialized || initializing) return; initializing = true; } logger = new Logging(); contextPath = getServletContext().getRealPath(/); contextPath = getPathWithSeparator(contextPath); oLoaderStatic = new LoaderStatic(); try { String sLogging = Configuration.getLogging(); Date date = new Date(); SimpleDateFormat formatter = new SimpleDateFormat(MMdd); logger.setapplicationSegment(allMATCHWeb); logger.setSite(Logging.Client); logger.LogSetup(Configuration.getLoggingLocation().concat(//allMATCHWeb_ + formatter.format(date) + .log),sLogging); logger.log(Configuration loaded from the file: [+Configuration.getPropertiesLocation()+]); } catch (Throwable th) { th.printStackTrace(); System.out.println(Error initializing logger.); try { logger.log(Error initializing logger.,th); logger.close(); } catch (Throwable t) {} return; } Again, thanks for any insight or assistance... Sincerely, Robert Jenkin Surecomp Services, Inc. 2 Hudson Place, 4th Floor Hoboken, NJ 07030 Skype: robert.jenkin Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537 http://www.Surecomp.com -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Friday, January 28, 2011 2:54 PM To: Tomcat Users List Subject: Re: deploying a war file and starting the application -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/28/2011 1:09 PM, robert.jen...@surecomp.com wrote: I have downloaded and configured Tomcat 7. All appears to be working. Glad to hear it! I have deployed a war file that currently works with WebSphere 7 and WebLogic 11g. The first issue I had was with url-pattern. It appears that Tomcat requires they start with a slash (/). I made the change and I no longer receive any errors while starting Tomcat. This is a spec requirement, not a Tomcat requirement. Other containers may be more lenient. The following image shows the startup window and that my war is being deployed. Within the webapps directory a directory containing my webapp is created. Images are stripped from posts to the list. Can you post it somewhere online and give us a link? Or, just copy/paste any relevant content from your screen? My initial servlet is called InitServlet and it is marked as load-on-startup (please see following image) . Ditto. I have two questions 1) If I type http://localhost:7080/allMATCHWeb in to a browser shouldn’t see this login.html page? I don’t… however I can access it by http://localhost:7080/allMATCHWeb/login.html You'll have to provide your web.xml for us to know when you need authentication challenges. Are you using container-managed authentication? 2) The load-on-start InitServlet class is not being executed as I have no logs generated or any other startup items handled, any ideas? Again, including web.xml should help. Note that using an InitServlet hasn't been recommended since the addition of the ServletContextListener interface a long time ago. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1DHsYACgkQ9CaO5/Lv0PBhSQCeNtR93FGfQecpwJ/n02ioUhpP x2MAn2WmpQ0vzJ3YAbrMQrE9SnMmOq++ =WYyb -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This mail was sent via Mail-SeCure System.
Re: deploying a war file and starting the application
On 28/01/2011 20:03, robert.jen...@surecomp.com wrote: Christopher, Thanks for your assistance. Here is my web.xml ?xml version='1.0' encoding='UTF-8'? web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.5 id=web-app_1 That does not look quite right to me. I'd normally expect to see the following: web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 Tomcat is usually pretty tolerant of that sort of thing but worth checking anyway. display-nameallMATCHWeb/display-name servlet servlet-nameInitServlet/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameInitServlet/servlet-name url-pattern/InitServlet/url-pattern /servlet-mapping That looks OK. Not the recommended way to do things, but it should work. welcome-file-list welcome-file/login.html/welcome-file As per the Servlet specification, welcome files should not have leading '/' characters. /welcome-file-list /web-app This is the InitServlet class declaration public class InitServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet, Internationalizable This is the start of init() method public void init() throws ServletException { synchronized (this) { if (initialized || initializing) return; initializing = true; } logger = new Logging(); contextPath = getServletContext().getRealPath(/); getRealPath() is not guaranteed to return a file system path. Also writing log files inside the web app is usually a bad idea since you lose the logs when the app is undeployed. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: deploying a war file and starting the application
Mark, That’s for input.. the initservlet is just a means to initialize the application. The writing of a log file is not to a directory within tomcat. It is a directory outside of the environment. This information (the directory location) is supplied via property file. Which I doubt is being loaded. Sincerely, Robert Jenkin Surecomp Services, Inc. 2 Hudson Place, 4th Floor Hoboken, NJ 07030 Skype: robert.jenkin Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537 http://www.Surecomp.com -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Friday, January 28, 2011 3:13 PM To: Tomcat Users List Subject: Re: deploying a war file and starting the application On 28/01/2011 20:03, robert.jen...@surecomp.com wrote: Christopher, Thanks for your assistance. Here is my web.xml ?xml version='1.0' encoding='UTF-8'? web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.5 id=web-app_1 That does not look quite right to me. I'd normally expect to see the following: web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 Tomcat is usually pretty tolerant of that sort of thing but worth checking anyway. display-nameallMATCHWeb/display-name servlet servlet-nameInitServlet/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameInitServlet/servlet-name url-pattern/InitServlet/url-pattern /servlet-mapping That looks OK. Not the recommended way to do things, but it should work. welcome-file-list welcome-file/login.html/welcome-file As per the Servlet specification, welcome files should not have leading '/' characters. /welcome-file-list /web-app This is the InitServlet class declaration public class InitServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet, Internationalizable This is the start of init() method public void init() throws ServletException { synchronized (this) { if (initialized || initializing) return; initializing = true; } logger = new Logging(); contextPath = getServletContext().getRealPath(/); getRealPath() is not guaranteed to return a file system path. Also writing log files inside the web app is usually a bad idea since you lose the logs when the app is undeployed. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This mail was sent via Mail-SeCure System.
RE: deploying a war file and starting the application
Mark, I made the change regarding web-app in the web.xml and same results. The piece I find most interesting is the lack of information. If tomcat is not able to load my class (initservlet) or an error has occurred in the class I would expect some type of logging indicating an error. Sincerely, Robert Jenkin Surecomp Services, Inc. 2 Hudson Place, 4th Floor Hoboken, NJ 07030 Skype: robert.jenkin Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537 http://www.Surecomp.com -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Friday, January 28, 2011 3:13 PM To: Tomcat Users List Subject: Re: deploying a war file and starting the application On 28/01/2011 20:03, robert.jen...@surecomp.com wrote: Christopher, Thanks for your assistance. Here is my web.xml ?xml version='1.0' encoding='UTF-8'? web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.5 id=web-app_1 That does not look quite right to me. I'd normally expect to see the following: web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 Tomcat is usually pretty tolerant of that sort of thing but worth checking anyway. display-nameallMATCHWeb/display-name servlet servlet-nameInitServlet/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameInitServlet/servlet-name url-pattern/InitServlet/url-pattern /servlet-mapping That looks OK. Not the recommended way to do things, but it should work. welcome-file-list welcome-file/login.html/welcome-file As per the Servlet specification, welcome files should not have leading '/' characters. /welcome-file-list /web-app This is the InitServlet class declaration public class InitServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet, Internationalizable This is the start of init() method public void init() throws ServletException { synchronized (this) { if (initialized || initializing) return; initializing = true; } logger = new Logging(); contextPath = getServletContext().getRealPath(/); getRealPath() is not guaranteed to return a file system path. Also writing log files inside the web app is usually a bad idea since you lose the logs when the app is undeployed. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This mail was sent via Mail-SeCure System.
RE: deploying a war file and starting the application
From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application the initservlet is just a means to initialize the application. Which, as Chris S noted earlier, should be done by a ServletContextListener, not a servlet. The writing of a log file is not to a directory within tomcat. That's good. Why do you have a reference to ServletContext#getRealPath()? That's very, very risky. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
RE: deploying a war file and starting the application
From: Caldarale, Charles R Subject: RE: deploying a war file and starting the application The writing of a log file is not to a directory within tomcat. On rereading your original message, the above statement does not appear to be operative: During startup of my servlet I generate log files and these logs files should appear in C:\Downloads\tomcat-7\apache-tomcat-7.0.6\webapps\allMATCHWeb\logs on my local disk. Which should we believe? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
RE: deploying a war file and starting the application
From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application If tomcat is not able to load my class (initservlet) or an error has occurred in the class I would expect some type of logging indicating an error. Make sure you look in _all_ the of the Tomcat-generated log files, not where you think you're writing logs for the webapp of interest. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
RE: deploying a war file and starting the application
Chuck, I understand the ServletConextListener and will investigate the recommendation to see if ServletConextListener is compatible with WebSphere 7 and WebLogic 11g as well and if it is I will make the change. I make reference to getRealPath to load a property file. I have not had issue with this in other environments, not to say this is not a bad thing to do. Sincerely, Robert Jenkin Surecomp Services, Inc. 2 Hudson Place, 4th Floor Hoboken, NJ 07030 Skype: robert.jenkin Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537 http://www.Surecomp.com -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: Friday, January 28, 2011 3:36 PM To: Tomcat Users List Subject: RE: deploying a war file and starting the application From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application the initservlet is just a means to initialize the application. Which, as Chris S noted earlier, should be done by a ServletContextListener, not a servlet. The writing of a log file is not to a directory within tomcat. That's good. Why do you have a reference to ServletContext#getRealPath()? That's very, very risky. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. This mail was sent via Mail-SeCure System.
RE: deploying a war file and starting the application
From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application I make reference to getRealPath to load a property file. It's definitely a bad thing to do. You should be using ServletContext#getResourceAsStream(). That will let your code avoid the assumption that there even is an underlying file system (nothing in the servlet spec requires it), or, if it exists, that the container will allow you to access the file system (the servlet spec only requires that the container provide access to a temporary work area). - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: deploying a war file and starting the application
On 28/01/2011 20:54, Caldarale, Charles R wrote: From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application I make reference to getRealPath to load a property file. It's definitely a bad thing to do. You should be using ServletContext#getResourceAsStream(). +1. That will also mean you app will work (well, that part of it at least) as an exploded directory or as a WAR file. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: deploying a war file and starting the application
I understand the issues and recommendations being made. But, possibly a little more detail in the app is needed. The web pages provided with the app are static and created in English. Upon starting the web app new pages are created that are language based. When deployed the war is always exploded so that access to the scripts, styles, pages, etc. is available to the web app to make new ones and or modify existing ones. Data for the web pages is provided by means of web services where the client browser IE/Firefox makes calls to web services for data (loading/saving) and business logic. Currently the same WAR produced by Ant build script is used in Websphere 7 and WebLogic 11g without issue or modifications needed. We have a customer that has asked me to support Tomcat (assume the cost of Webshere/Weblogic is an issue). Having provide a brief description of system. I have tried the following. I have modified the InitServlet class (removed everything). The following is the complete code of InitServlet package com.surecomp.allMATCH.client; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class InitServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { public void destroy() { } public void init() throws ServletException { System.out.println(Loaded); } } I have compiled it and placed the class file into C:\Downloads\tomcat-7\apache-tomcat-7.0.6\webapps\allMATCHWeb\WEB-INF\classes\com\surecomp\allMATCH\client and I expected to see the System.out.println either on the screen or in some log file. I do not see it anywhere. Sincerely, Robert Jenkin Surecomp Services, Inc. 2 Hudson Place, 4th Floor Hoboken, NJ 07030 Skype: robert.jenkin Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537 http://www.Surecomp.com -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Friday, January 28, 2011 4:00 PM To: Tomcat Users List Subject: Re: deploying a war file and starting the application On 28/01/2011 20:54, Caldarale, Charles R wrote: From: robert.jen...@surecomp.com [mailto:robert.jen...@surecomp.com] Subject: RE: deploying a war file and starting the application I make reference to getRealPath to load a property file. It's definitely a bad thing to do. You should be using ServletContext#getResourceAsStream(). +1. That will also mean you app will work (well, that part of it at least) as an exploded directory or as a WAR file. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This mail was sent via Mail-SeCure System.
Re: deploying a war file and starting the application
On 28/01/2011 21:12, robert.jen...@surecomp.com wrote: I have modified the InitServlet class (removed everything). The following is the complete code of InitServlet package com.surecomp.allMATCH.client; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class InitServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { public void destroy() { } public void init() throws ServletException { System.out.println(Loaded); } } I have compiled it and placed the class file into C:\Downloads\tomcat-7\apache-tomcat-7.0.6\webapps\allMATCHWeb\WEB-INF\classes\com\surecomp\allMATCH\client and I expected to see the System.out.println either on the screen or in some log file. I do not see it anywhere. web.xml is located where? What is in the Tomcat log files? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: deploying a war file and starting the application
The following is the directory layout C:\Downloads\tomcat-7\apache-tomcat-7.0.6 - root bin conf lib logs temp webapps allMATCHWeb documents images lib logs META-INFO output pages scripts WEB-INF classes lib web.xml xsl login.html docs examples host-manager ROOT Work This is the content of the web.xml ?xml version='1.0' encoding='UTF-8'? web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 display-nameallMATCHWeb/display-name servlet servlet-nameInitServlet/servlet-name servlet-classcom.surecomp.allMATCH.client.InitServlet/servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameInitServlet/servlet-name url-pattern/InitServlet/url-pattern /servlet-mapping welcome-file-list welcome-filelogin.html/welcome-file /welcome-file-list /web-app The log files produced by Tomcat contain the following catalina.2011-01-28.log contains Jan 28, 2011 4:22:35 PM org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.1.20. Jan 28, 2011 4:22:35 PM org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. Jan 28, 2011 4:22:36 PM org.apache.coyote.AbstractProtocolHandler init INFO: Initializing ProtocolHandler [http-apr-7080] Jan 28, 2011 4:22:36 PM org.apache.coyote.AbstractProtocolHandler init INFO: Initializing ProtocolHandler [ajp-apr-7009] Jan 28, 2011 4:22:36 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1413 ms Jan 28, 2011 4:22:36 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jan 28, 2011 4:22:36 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.6 Jan 28, 2011 4:22:36 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive allMATCHWeb.war Jan 28, 2011 4:22:53 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://www.businessobjects.com/jsf/crystalreportsviewers is already defined Jan 28, 2011 4:22:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory docs Jan 28, 2011 4:22:54 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory examples Jan 28, 2011 4:22:54 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory host-manager Jan 28, 2011 4:22:54 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory manager Jan 28, 2011 4:22:54 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory ROOT Jan 28, 2011 4:22:54 PM org.apache.coyote.AbstractProtocolHandler start INFO: Starting ProtocolHandler [http-apr-7080] Jan 28, 2011 4:22:54 PM org.apache.coyote.AbstractProtocolHandler start INFO: Starting ProtocolHandler [ajp-apr-7009] Jan 28, 2011 4:22:54 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 18243 ms Host-manager.2011-01-28.log contains Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext listenerStart FINE: Sending application start events Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext filterStart FINE: Starting filters Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext filterStart FINE: Starting filter 'CSRF' Localhost.2011-01-28.log contains Jan 28, 2011 4:22:53 PM org.apache.catalina.core.StandardContext listenerStart FINE: Sending application start events Jan 28, 2011 4:22:53 PM org.apache.catalina.core.StandardContext filterStart FINE: Starting filters Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext listenerStart FINE: Sending application start events Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext filterStart FINE: Starting filters Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext listenerStart FINE: Configuring event listener class 'listeners.ContextListener' Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext listenerStart FINE: Configuring event listener class 'listeners.SessionListener' Jan 28, 2011 4:22:54 PM org.apache.catalina.core.StandardContext listenerStart
RE: deploying a war file and starting the application
Well after playing with web.xml I got my app up and partly working in Tomcat 7. When I go to http://localhost:7080/allMATCHWeb the default page is loaded. My properties file is loaded and language based webpages generated, etc. Now my issue seems to be with web services. Again the web.xml contains the following for each webservice. servlet servlet-nameMessageServiceServlethttp/servlet-name servlet-classcom.surecomp.allMATCH.client.webservices.MessageService/servlet-class load-on-startup0/load-on-startup /servlet servlet-mapping servlet-nameMessageServiceServlethttp/servlet-name url-patternMessageService/url-pattern /servlet-mapping Now, these work for webshpere and weblogic, so I am assuming (bad thing I know) that the same would work for Tomcat. The log file is producing the following when deploying the services. INFO: Marking servlet MessageServiceServlethttp as unavailable Jan 28, 2011 5:59:40 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /allMATCHWeb threw load() exception java.lang.ClassCastException: com.surecomp.allMATCH.client.webservices.MessageService cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:996) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4741) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5062) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5057) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Jan 28, 2011 5:59:40 PM org.apache.catalina.core.ApplicationContext log Sincerely, Robert Jenkin Surecomp Services, Inc. 2 Hudson Place, 4th Floor Hoboken, NJ 07030 Skype: robert.jenkin Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537 http://www.Surecomp.com -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Friday, January 28, 2011 2:54 PM To: Tomcat Users List Subject: Re: deploying a war file and starting the application -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 1/28/2011 1:09 PM, robert.jen...@surecomp.com wrote: I have downloaded and configured Tomcat 7. All appears to be working. Glad to hear it! I have deployed a war file that currently works with WebSphere 7 and WebLogic 11g. The first issue I had was with url-pattern. It appears that Tomcat requires they start with a slash (/). I made the change and I no longer receive any errors while starting Tomcat. This is a spec requirement, not a Tomcat requirement. Other containers may be more lenient. The following image shows the startup window and that my war is being deployed. Within the webapps directory a directory containing my webapp is created. Images are stripped from posts to the list. Can you post it somewhere online and give us a link? Or, just copy/paste any relevant content from your screen? My initial servlet is called InitServlet and it is marked as load-on-startup (please see following image) . Ditto. I have two questions 1) If I type http://localhost:7080/allMATCHWeb in to a browser shouldn’t see this login.html page? I don’t… however I can access it by http://localhost:7080/allMATCHWeb/login.html You'll have to provide your web.xml for us to know when you need authentication challenges. Are you using container-managed authentication? 2) The load-on-start InitServlet class is not being executed as I have no logs generated or any other startup items handled, any ideas? Again, including web.xml should help. Note that using an InitServlet hasn't been recommended since the addition of the ServletContextListener interface a long time ago. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1DHsYACgkQ9CaO5/Lv0PBhSQCeNtR93FGfQecpwJ/n02ioUhpP x2MAn2WmpQ0vzJ3YAbrMQrE9SnMmOq++ =WYyb -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This mail was sent via Mail-SeCure System.