RE: n00b cannot get jar files to work.
Hi, No problem, glad to help -- those little things can be frustrating ;) Yoav Shapira Millennium Research Informatics >-Original Message- >From: Michael Labhard [mailto:[EMAIL PROTECTED] >Sent: Thursday, May 27, 2004 3:05 PM >To: Tomcat Users List >Subject: Re: n00b cannot get jar files to work. > >Yoav: > >As happens the realization of the solution came to me as a result of our >exchanges. I had improperly built the jar file. The servlet was in a >package "example" but the jar file did not contain a directory "example" >that >contained the class. It just contained the class. What I should have done >is created the jar file and then EXPANDED it in the tomcat webapps class >location. Then it would have been clear that the problem was the structure >of the jar. Once the jar had a valid structure everything worked. > >This is the JDK I'm using: blackdown-jdk-1.4.2_rc1. > >Thank you very much for helping me with this. > >-- Michael > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: n00b cannot get jar files to work.
Yoav: As happens the realization of the solution came to me as a result of our exchanges. I had improperly built the jar file. The servlet was in a package "example" but the jar file did not contain a directory "example" that contained the class. It just contained the class. What I should have done is created the jar file and then EXPANDED it in the tomcat webapps class location. Then it would have been clear that the problem was the structure of the jar. Once the jar had a valid structure everything worked. This is the JDK I'm using: blackdown-jdk-1.4.2_rc1. Thank you very much for helping me with this. -- Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: n00b cannot get jar files to work.
Hi, I have no more ideas, but I'm curious as to what JDK you're using. Yoav Shapira Millennium Research Informatics >-Original Message- >From: Michael Labhard [mailto:[EMAIL PROTECTED] >Sent: Thursday, May 27, 2004 2:27 PM >To: Tomcat Users List >Subject: Re: n00b cannot get jar files to work. > >On Thursday 27 May 2004 11:04 am, Parsons Technical Services wrote: >> Wonder if the manifest or index of the jar is not correct? That could >cause >> problems. > >The jar manifest is empty: > > Manifest-Version: 1.0 > Created-By: 1.4.2-rc1 (Blackdown Java-Linux Team) > >I think this is right. Only signed files should be listed. > >-- Michael > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: n00b cannot get jar files to work.
On Thursday 27 May 2004 11:04 am, Parsons Technical Services wrote: > Wonder if the manifest or index of the jar is not correct? That could cause > problems. The jar manifest is empty: Manifest-Version: 1.0 Created-By: 1.4.2-rc1 (Blackdown Java-Linux Team) I think this is right. Only signed files should be listed. -- Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: n00b cannot get jar files to work.
> Why do you doubt they'd work? I'd give them a shot if I were you -- > after all, that IS on of the main points of Java ;) Oh, I see. It didn't occur to me that Tomcat was itself written in java. But, of course! So I downloaded the binaries and used them for the same tests just as you recommended, however there was no difference at all in the results. The jar file still does not work. By the way, I have double and triple checked that the jar file does indeed contain the very same class. -- Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: n00b cannot get jar files to work.
Yoav, So use to doing imports that I didn't think (key words here) about Tomcat making the servlets available from a jar. Was thinking that it would have to be imported to be used. Learn something new each day. Thanks Wonder if the manifest or index of the jar is not correct? That could cause problems. Doug - Original Message - From: "Shapira, Yoav" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Thursday, May 27, 2004 1:51 PM Subject: RE: n00b cannot get jar files to work. Hi, >I would except the machine I am working on is an amd64 Opteron processor >and I >doubt that the binaries would work. Gentoo built tomcat from the 5.0.18 >source and that what I am working with. Why do you doubt they'd work? I'd give them a shot if I were you -- after all, that IS on of the main points of Java ;) >Any way to confirm that tomcat's classpath actually contains the jar file? Displaying the runtime classpath of a webapp can be a bit tricky. It's NOT System.getProperty("java.class.path"). The classloader how-to document that ships with tomcat descibres the classpath and loading order. You can configure the logging system to tell you what jars it's deploying on startup. >Trying to learn something here. From what I am reading, I can create >several servlets, place them in a jar and put this jar in WEB-INF/lib . >Then these servlets are available in my context? Just add mappings! > >That is what I am reading from this thread. > >My current understanding is different than this. Not just mappings, but also elements. But yes, of course, the rest is correct. What was your understanding?? Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: n00b cannot get jar files to work.
Hi, >I would except the machine I am working on is an amd64 Opteron processor >and I >doubt that the binaries would work. Gentoo built tomcat from the 5.0.18 >source and that what I am working with. Why do you doubt they'd work? I'd give them a shot if I were you -- after all, that IS on of the main points of Java ;) >Any way to confirm that tomcat's classpath actually contains the jar file? Displaying the runtime classpath of a webapp can be a bit tricky. It's NOT System.getProperty("java.class.path"). The classloader how-to document that ships with tomcat descibres the classpath and loading order. You can configure the logging system to tell you what jars it's deploying on startup. >Trying to learn something here. From what I am reading, I can create >several servlets, place them in a jar and put this jar in WEB-INF/lib . >Then these servlets are available in my context? Just add mappings! > >That is what I am reading from this thread. > >My current understanding is different than this. Not just mappings, but also elements. But yes, of course, the rest is correct. What was your understanding?? Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: n00b cannot get jar files to work.
Yoav: I would except the machine I am working on is an amd64 Opteron processor and I doubt that the binaries would work. Gentoo built tomcat from the 5.0.18 source and that what I am working with. Any way to confirm that tomcat's classpath actually contains the jar file? -- Michael > Hi, > Try installing it from the normal distribution at jakarta.apache.org, > not an RPM or another package specific to your system. The normal > distro installation is simple: download and unzip to a directory of your > choice. It doesn't created any new users or groups and doesn't require > special permissions setup. > > Yoav Shapira > Millennium Research Informatics - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: n00b cannot get jar files to work.
Yoav, Trying to learn something here. From what I am reading, I can create several servlets, place them in a jar and put this jar in WEB-INF/lib . Then these servlets are available in my context? Just add mappings! That is what I am reading from this thread. My current understanding is different than this. Doug - Original Message - From: "Shapira, Yoav" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Thursday, May 27, 2004 1:01 PM Subject: RE: n00b cannot get jar files to work. Hi, Try installing it from the normal distribution at jakarta.apache.org, not an RPM or another package specific to your system. The normal distro installation is simple: download and unzip to a directory of your choice. It doesn't created any new users or groups and doesn't require special permissions setup. Yoav Shapira Millennium Research Informatics >-Original Message- >From: Michael Labhard [mailto:[EMAIL PROTECTED] >Sent: Thursday, May 27, 2004 12:58 PM >To: Tomcat Users List >Subject: Re: n00b cannot get jar files to work. > >Thank you for the reply. > >I assume that you meant the opposite when you wrote, "There's no reason it >should work in a jar," and it SHOULD work in a jar. > >When tomcat was installed it inserted a user and a group both named >"tomcat" >on my machine (I'm using Gentoo Linux 2.6.4). However, I changed the >permissions to the jar file to my own permissions and group "users" but >that >did not help. Anything else I can investigate? I'm really stuck and have >been working for days on just this one problem of getting Tomcat to see >classes in jar files. Any help would be much appreciated. > >-- Michael > >On Thursday 27 May 2004 09:48 am, Shapira, Yoav wrote: >> Hi, >> The class itself and web.xml look fine (though we usually tell people to >> put servlet-name before url-pattern in the servlet-mapping element, for >> backwards compatibility and/or historical reasons). There's no reason >> it should work in a jar. Webapps/test/WEB-INF/lib is the right place to >> put that jar. What are tomcat:tomcat permissions? The permissions >> should be such that the server user can read the jar. >> >> Yoav Shapira >> Millennium Research Informatics >> >> >-Original Message- >> >From: Michael Labhard [mailto:[EMAIL PROTECTED] >> >Sent: Thursday, May 27, 2004 12:39 PM >> >To: [EMAIL PROTECTED] >> >Subject: n00b cannot get jar files to work. >> > >> >How do I get jar files to work? >> > >> >Learning Tomcat I have a simple "HelloServlet" class. When compiled >> >> and >> >> >the >> >class file is inserted into the directory >> > >> > /opt/tomcat/webapps/test/WEB-INF/classes/example >> > >> >and the web.xml file given below is placed in >> > >> > /opt/tomcat/webapps/test/WEB-INF/ >> > >> >and tomcat is restarted then the url >> > >> >http://localhost:8080/test/hello >> > >> >page reads: >> > >> > Hello, world! >> > >> >But if the same class is placed in a jar file and this jar file is >> >> inserted >> >> >into any of the following directories and given permissions >> >> tomcat:tomcat >> >> > /opt/tomcat/webapps/test/WEB-INF/lib >> > /opt/tomcat/common/lib >> > /opt/tomcat/shared/lib >> > >> >when tomcat is restarted and the same url is addressed first there is >> > >> > < Blank page > >> > >> >the second time the page is refreshed there is >> > >> > Status 500: >> > javax.servlet.ServletException: Wrapper cannot find servlet >> >> class >> >> > example.HelloServlet or a class it depends on >> > >> >and the third and all subsequent times the page is refreshed there is >> > >> > Status 400: >> > Servlet hello is not available >> > >> >How do I get jar files to work? Thank you. >> > >> >-- Michael >> > >> >Appendix: >> > >> >web.xml file: >> > >> > >> > >> >http://java.sun.com/xml/ns/j2ee"; >> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> >xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >> >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; >> >version="2.4"> >> > >> >hello >> >example.HelloServl
RE: n00b cannot get jar files to work.
Hi, Try installing it from the normal distribution at jakarta.apache.org, not an RPM or another package specific to your system. The normal distro installation is simple: download and unzip to a directory of your choice. It doesn't created any new users or groups and doesn't require special permissions setup. Yoav Shapira Millennium Research Informatics >-Original Message- >From: Michael Labhard [mailto:[EMAIL PROTECTED] >Sent: Thursday, May 27, 2004 12:58 PM >To: Tomcat Users List >Subject: Re: n00b cannot get jar files to work. > >Thank you for the reply. > >I assume that you meant the opposite when you wrote, "There's no reason it >should work in a jar," and it SHOULD work in a jar. > >When tomcat was installed it inserted a user and a group both named >"tomcat" >on my machine (I'm using Gentoo Linux 2.6.4). However, I changed the >permissions to the jar file to my own permissions and group "users" but >that >did not help. Anything else I can investigate? I'm really stuck and have >been working for days on just this one problem of getting Tomcat to see >classes in jar files. Any help would be much appreciated. > >-- Michael > >On Thursday 27 May 2004 09:48 am, Shapira, Yoav wrote: >> Hi, >> The class itself and web.xml look fine (though we usually tell people to >> put servlet-name before url-pattern in the servlet-mapping element, for >> backwards compatibility and/or historical reasons). There's no reason >> it should work in a jar. Webapps/test/WEB-INF/lib is the right place to >> put that jar. What are tomcat:tomcat permissions? The permissions >> should be such that the server user can read the jar. >> >> Yoav Shapira >> Millennium Research Informatics >> >> >-Original Message- >> >From: Michael Labhard [mailto:[EMAIL PROTECTED] >> >Sent: Thursday, May 27, 2004 12:39 PM >> >To: [EMAIL PROTECTED] >> >Subject: n00b cannot get jar files to work. >> > >> >How do I get jar files to work? >> > >> >Learning Tomcat I have a simple "HelloServlet" class. When compiled >> >> and >> >> >the >> >class file is inserted into the directory >> > >> >/opt/tomcat/webapps/test/WEB-INF/classes/example >> > >> >and the web.xml file given below is placed in >> > >> >/opt/tomcat/webapps/test/WEB-INF/ >> > >> >and tomcat is restarted then the url >> > >> >http://localhost:8080/test/hello >> > >> >page reads: >> > >> >Hello, world! >> > >> >But if the same class is placed in a jar file and this jar file is >> >> inserted >> >> >into any of the following directories and given permissions >> >> tomcat:tomcat >> >> >/opt/tomcat/webapps/test/WEB-INF/lib >> >/opt/tomcat/common/lib >> >/opt/tomcat/shared/lib >> > >> >when tomcat is restarted and the same url is addressed first there is >> > >> >< Blank page > >> > >> >the second time the page is refreshed there is >> > >> >Status 500: >> >javax.servlet.ServletException: Wrapper cannot find servlet >> >> class >> >> >example.HelloServlet or a class it depends on >> > >> >and the third and all subsequent times the page is refreshed there is >> > >> >Status 400: >> > Servlet hello is not available >> > >> >How do I get jar files to work? Thank you. >> > >> >-- Michael >> > >> >Appendix: >> > >> >web.xml file: >> > >> > >> > >> >http://java.sun.com/xml/ns/j2ee"; >> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> >xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >> >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; >> >version="2.4"> >> > >> >hello >> >example.HelloServlet >> > >> > >> > >> >/hello >> >hello >> > >> > >> > >> > >> >HelloServlet.java: >> > >> >package example; >> > >> >import java.io.*; >> >import java.util.*; >> > >> >import javax.servlet.http.*; >> >import javax.servlet.*; >> > >> >public class HelloServlet extends HttpServlet { >> > public void doGet ( >>
Re: n00b cannot get jar files to work.
Thank you for the reply. I assume that you meant the opposite when you wrote, "There's no reason it should work in a jar," and it SHOULD work in a jar. When tomcat was installed it inserted a user and a group both named "tomcat" on my machine (I'm using Gentoo Linux 2.6.4). However, I changed the permissions to the jar file to my own permissions and group "users" but that did not help. Anything else I can investigate? I'm really stuck and have been working for days on just this one problem of getting Tomcat to see classes in jar files. Any help would be much appreciated. -- Michael On Thursday 27 May 2004 09:48 am, Shapira, Yoav wrote: > Hi, > The class itself and web.xml look fine (though we usually tell people to > put servlet-name before url-pattern in the servlet-mapping element, for > backwards compatibility and/or historical reasons). There's no reason > it should work in a jar. Webapps/test/WEB-INF/lib is the right place to > put that jar. What are tomcat:tomcat permissions? The permissions > should be such that the server user can read the jar. > > Yoav Shapira > Millennium Research Informatics > > >-Original Message- > >From: Michael Labhard [mailto:[EMAIL PROTECTED] > >Sent: Thursday, May 27, 2004 12:39 PM > >To: [EMAIL PROTECTED] > >Subject: n00b cannot get jar files to work. > > > >How do I get jar files to work? > > > >Learning Tomcat I have a simple "HelloServlet" class. When compiled > > and > > >the > >class file is inserted into the directory > > > > /opt/tomcat/webapps/test/WEB-INF/classes/example > > > >and the web.xml file given below is placed in > > > > /opt/tomcat/webapps/test/WEB-INF/ > > > >and tomcat is restarted then the url > > > >http://localhost:8080/test/hello > > > >page reads: > > > > Hello, world! > > > >But if the same class is placed in a jar file and this jar file is > > inserted > > >into any of the following directories and given permissions > > tomcat:tomcat > > > /opt/tomcat/webapps/test/WEB-INF/lib > > /opt/tomcat/common/lib > > /opt/tomcat/shared/lib > > > >when tomcat is restarted and the same url is addressed first there is > > > > < Blank page > > > > >the second time the page is refreshed there is > > > > Status 500: > > javax.servlet.ServletException: Wrapper cannot find servlet > > class > > > example.HelloServlet or a class it depends on > > > >and the third and all subsequent times the page is refreshed there is > > > > Status 400: > > Servlet hello is not available > > > >How do I get jar files to work? Thank you. > > > >-- Michael > > > >Appendix: > > > >web.xml file: > > > > > > > >http://java.sun.com/xml/ns/j2ee"; > >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > >xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; > >version="2.4"> > > > >hello > >example.HelloServlet > > > > > > > >/hello > >hello > > > > > > > > > >HelloServlet.java: > > > >package example; > > > >import java.io.*; > >import java.util.*; > > > >import javax.servlet.http.*; > >import javax.servlet.*; > > > >public class HelloServlet extends HttpServlet { > > public void doGet ( > >HttpServletRequest req, > >HttpServletResponse res > >) throws ServletException, IOException > > { > >res.setContentType("text/html"); > >PrintWriter pw = res.getWriter(); > > > >pw.println(" >Transitional//EN\">"); > >pw.println(); > >pw.println(""); > >pw.println(" >charset=ISO-8859-1\">"); > >pw.println(); > >pw.println(""); > >pw.println(); > >pw.println("Hello, world!"); > >pw.println(""); > >pw.println(); > >pw.println(""); > >pw.println(); > >pw.println("Hello, world!"); > >pw.println(); > >pw.println(""); > >pw.close(); > > } > > > > public HelloServlet() {} > >} > > > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > This e-mail, including any attachments, is a confidential business > communication, and may contain information that is confidential, > proprietary and/or privileged. This e-mail is intended only for the > individual(s) to whom it is addressed, and may not be saved, copied, > printed, disclosed or used by anyone else. If you are not the(an) intended > recipient, please immediately delete this e-mail from your computer system > and notify the sender. Thank you. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: n00b cannot get jar files to work.
Hi, The class itself and web.xml look fine (though we usually tell people to put servlet-name before url-pattern in the servlet-mapping element, for backwards compatibility and/or historical reasons). There's no reason it should work in a jar. Webapps/test/WEB-INF/lib is the right place to put that jar. What are tomcat:tomcat permissions? The permissions should be such that the server user can read the jar. Yoav Shapira Millennium Research Informatics >-Original Message- >From: Michael Labhard [mailto:[EMAIL PROTECTED] >Sent: Thursday, May 27, 2004 12:39 PM >To: [EMAIL PROTECTED] >Subject: n00b cannot get jar files to work. > >How do I get jar files to work? > >Learning Tomcat I have a simple "HelloServlet" class. When compiled and >the >class file is inserted into the directory > > /opt/tomcat/webapps/test/WEB-INF/classes/example > >and the web.xml file given below is placed in > > /opt/tomcat/webapps/test/WEB-INF/ > >and tomcat is restarted then the url > >http://localhost:8080/test/hello > >page reads: > > Hello, world! > >But if the same class is placed in a jar file and this jar file is inserted >into any of the following directories and given permissions tomcat:tomcat > > /opt/tomcat/webapps/test/WEB-INF/lib > /opt/tomcat/common/lib > /opt/tomcat/shared/lib > >when tomcat is restarted and the same url is addressed first there is > > < Blank page > > >the second time the page is refreshed there is > > Status 500: > javax.servlet.ServletException: Wrapper cannot find servlet class > > example.HelloServlet or a class it depends on > >and the third and all subsequent times the page is refreshed there is > > Status 400: >Servlet hello is not available > >How do I get jar files to work? Thank you. > >-- Michael > >Appendix: > >web.xml file: > > > >http://java.sun.com/xml/ns/j2ee"; >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; >version="2.4"> > >hello >example.HelloServlet > > > >/hello >hello > > > > >HelloServlet.java: > >package example; > >import java.io.*; >import java.util.*; > >import javax.servlet.http.*; >import javax.servlet.*; > >public class HelloServlet extends HttpServlet { > public void doGet ( >HttpServletRequest req, >HttpServletResponse res >) throws ServletException, IOException > { >res.setContentType("text/html"); >PrintWriter pw = res.getWriter(); > >pw.println("Transitional//EN\">"); >pw.println(); >pw.println(""); >pw.println("charset=ISO-8859-1\">"); >pw.println(); >pw.println(""); >pw.println(); >pw.println("Hello, world!"); >pw.println(""); >pw.println(); >pw.println(""); >pw.println(); >pw.println("Hello, world!"); >pw.println(); >pw.println(""); >pw.close(); > } > > public HelloServlet() {} >} > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]