Alright, so I'm working on showing all the cds available within a genre. It starts with a user clicking on a link to a specific genre with the genre id included as a parameter in the url. The controller will receive this and pass it on to the model to get all cds that are in that genre. I'm returning the resultset from the model. My only problem is, how do I get to use the cachedrowset?
You are importing sun.jdbc.rowset.*; for this you need rowset.jar in your class path as sun.jdbc.rowset.* is the part of rowset.jar not JDK release. place the rowset jar in your class path it should solve your problem.
Shailesh
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
alright so I've downloaded rowset.jar and placed it in my classpath. Within my controller servlet I still have import sun.jdbc.rowset.*; however I still get there error stating package doesn't exist. Do I have to change the import path? like import rowset.*;?? Please help!!
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
I'm still having problems getting my servlet to compile with the cachedrowset. A friend of mine told me I should include a manifest.mf file. Is that necessary? Otherwise, I think I've done everything. Anyone who can help would be appreciated!!
This is not a servlet question, moving to the JDBC forum
In my opinion, this is a compilation problem, so what forum is appropriate for questions regarding compilation errors?
Jenn, Shailesh may have given you incorrect information. Have you verified that the class[es] you require are actually in the "rowset.jar" file? Also, are you compiling from the command line, or via some IDE (or similar)? If you're using an IDE, it may be ignoring your CLASSPATH (environment variable) setting.
Or, as Shailesh suggests, upgrading to JDK 5.0 should solve your problem.
sun has released more 2 or 3 version of rowset.jar
I stand corrected. Not incorrect information, but incomplete information.
extract your jar and verify that class file
Isn't that [almost] what I said? By the way, you can verify that a class is in a JAR without extracting the class. Refer to the javadocs for the "jar" tool to find out how.
Originally posted by Avi Abrami: Isn't that [almost] what I said?
Not almost exactly same content in different words.
By the way, you can verify that a class is in a JAR without extracting the class.
My Idea is to give direction in easiest possible way.There are numbers of way to do one thing.
thanks Shailesh
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
ok so I checked the rowset.jar file and it does contain the cachedrowset. However the problem is still the same. I get a compilation error now saying the package sun.jdbc.rowset.*; does not exist.
Part of my classpath is c:/jakarta-tomcat/webapps/jTunes/WEB-INF/classes I've placed the rowset.jar file in my classes directory as instructed and use include sun.jdbc.rowset.*; in my servlets, but still get the same error.
I don't know what I'm doing wrong, and anyone who can help is greatly appreciated!!
create a folder lib inside WEB-INF folder and place your jar file there
Shailesh
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Originally posted by Shailesh Chandra: create a folder lib inside WEB-INF folder and place your jar file there
Shailesh
Ok so just create a folder named lib under the WEB-INF directory and toss the rowset.jar file in... sounds easy enough.... but do I have to change my classpath at all?? Right now it's pointing to the classes folder within my WEB-INF??
part of my current classpath: c:/jakarta-tomcat/webapps/jTunes/WEB-INF/classes
Jar files are placed in web-inf/lib folder, and classes of jar file are picked during runtime of application.
I am assuming that you are using same class path for compilation,hence it should work.
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Originally posted by Shailesh Chandra: Jar files are placed in web-inf/lib folder, and classes of jar file are picked during runtime of application.
I am assuming that you are using same class path for compilation,hence it should work.
ok I'll give it a shot, and let you know. Thanks!!
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Alright I've added a lib directory to my WEB-INF folder, however when I try to compile it still says 'package sun.jdbc.rowset does not exist'. Should my import statement still be 'import sun.jdbc.rowset.*;' or should the path be changed? I don't understand what I'm doing wrong??
Jason Kwok
Ranch Hand
Joined: Mar 31, 2005
Posts: 126
posted
0
You should try installing JDK 5.0. Instead of using the sun.jdbc.rowset package, you can use import javax.sql.rowset.* which comes with JDK. Hopefully this solves your problem.
Still I have doubt that rowset.jar is in your compilation classpath. either update to jdk1.5 this will solve problem or verify if jar file is in your compilation path.
I have seen two rowset.jar so far.
In first one which was early release,CachedRowSet was place in sun.jdbc.rowset package. But in next release it was replaced to javax.sql.rowset package.
even in jdk 1.5 it is in javax.sql.rowset package
ss_java
Greenhorn
Joined: Jan 28, 2005
Posts: 6
posted
0
give this statement also..
import javax.sql.rowset.*
let me know if it is solved
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Ok I download JDK 5.0 and my code compiles when I import the new library. HOwever now when I start Tomcat and try to view the results tomcat cannot find the servlet. I was using j2sdk1.4.2_02 which is where my JAVA_HOME variable was pointing to. Do I need to change that to JDK 5.0?
As a windows service. After I installed tomcat, start and stop icons were added and I use those to activate it. So should I change my JAVA_HOME variable?
My current autoexec file: SET Path=C:\WINDOWS;C:\WINDOWS\COMMAND; SET CATALINA_HOME=c:\jakarta-tomcat-4.0.1 SET JAVA_HOME=c:\j2sdk1.4.2_02\bin SET CLASSPATH=c:\jakarta-tomcat-4.0.1\common\lib\servlet.jar;c:\jakarta-tomcat-4.0.1\webapps\bookStore\WEB-INF\classes
should it be changed to where JDK 5.0 was installed?? For example: C:\Program Files\Java\jdk1.5.0_02\bin
should it be changed to where JDK 5.0 was installed??
you should change to refer liabrary of jdk1.5
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Alright I changed my autoexec but I get an exception saying a servlet instance could not be found and the root cause was with java.lang
This is my current autoexec file: SET Path=C:\WINDOWS;C:\WINDOWS\COMMAND; SET CATALINA_HOME=c:\jakarta-tomcat-4.0.1 SET JAVA_HOME=c:\Progra~1\Java\jdk1.5.0_02\bin SET CLASSPATH=c:\jakarta-tomcat-4.0.1\common\lib\servlet.jar;c:\jakarta-tomcat-4.0.1\webapps\jTunes\WEB-INF\classes
Maybe I'm really inexperienced, but it seems like java is just one headache after another!!!
Thanks to everyone who've taken the time to help me, keep the advice coming please!!
Now your problem is tomcat specific !! I would recommend to start a new thread in Apache/Tomcat forum, so that other rancher can also help you
but it seems like java is just one headache after another!!!
more headache more expert [ April 03, 2005: Message edited by: Shailesh Chandra ]
Craig Jackson
Ranch Hand
Joined: Mar 19, 2002
Posts: 405
posted
0
Jenn, JAVA_HOME like CATALINA_HOME is an environment variable that points to the base(top level) directory of the JDK and TOMCAT installations. The PATH environment variable points to the executables of the operating system i.e. dos commands, java.exe, javac.exe. Therefore:
I dont think that JAVA_HOME includes \bin
So your autoexec.bat should look something like this:
Notice the last entry(s) in the PATH variable. I includeded the the Catalina entry if for example, you were starting/stopping from the command line.
The current setting for the JAVA_HOME be the cause of why you are getting [QOUTE] the root cause was with java.lang [/QOUTE] exception from TOMCAT, although it would help if you posted the entire stack trace. The reason being is that TOMCAT may not find the base packages, TOMCAT, I believe uses the JAVA_HOME environment variable to locate those packages. So if the JAVA_HOME environment variable is pointing to the bin directory, you may have a problem.
So correct the autoexec.bat, reboot your PC, and give it a try. Let us know how it goes.
Craig Jackson
Ranch Hand
Joined: Mar 19, 2002
Posts: 405
posted
0
Correct syntax for PATH environment variables on windows should be
Ignore the "$", my mind, just jumped to linux/unix syntax and back to dos.
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Alright, I'll try that all out and let you know the results this afternoon, hopefully this will be the end to my nightmare!! Thanks again!!
When you install Tomcat as a Windows Service, it doesn't use environment variables to find the JVM. Those values are stored in the registry.
If you checked the "Start Menu Items" node during installation, you can change the JVM pointer by going to "Start -> All Programs -> Apache Tomcat -> Configure Tomcat -> Then click on the Java Tab. From there, you will be able to change the pointers.
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Well I'm using Windows 98, and I just downloaded Tomcat and j2sdk from a website and installed them. After that, I had to manually edit my autoexec.bat file to include JAVA_HOME, CATALINA_HOME, and CLASSPATH.
Jenn Person
Ranch Hand
Joined: Jan 16, 2005
Posts: 89
posted
0
Hey guys, I'm still having problems running servlets now. Here's the complete exception message:
Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot allocate servlet instance for path /testarea/servlet/hope at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:415) at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106) at java.lang.Thread.run(Unknown Source)
root cause
java.lang.UnsupportedClassVersionError: testing/hope (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1534) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:852) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1156) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:801) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:396) at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106) at java.lang.Thread.run(Unknown Source)