aspose file tools*
The moose likes Cattle Drive and the fly likes My BeeServlet won't buzz Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "My BeeServlet won Watch "My BeeServlet won New topic
Author

My BeeServlet won't buzz

Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
It compiles. I got the class file in the right place. DateServlet works & a basic servlet I wrote for another class works. The trouble seems to between my setup and the javaranch files I want to use.
The www page complains:
500 Internal Server Error
java.lang.NoClassDefFoundError: LocalSystem
at com.javaranch.common.LogServlet.validAccess(LogServlet.java:181)
at com.javaranch.common.LogServlet.doGet(LogServlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind[Orion/1.5.2 (build 10460)]._eab.doFilter(Unknown Source)
at com.orionserver[Orion/1.5.2 (build 10460)].http.patch.PathInvalidationFilter.doFilter(PathInvalidationFilter.java:150)
at com.evermind[Orion/1.5.2 (build 10460)]._cxb._abe(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._cxb._uec(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._io._twc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._io._gc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._if.run(Unknown Source)
--------------------------------------------------
I looked at the code for LogServlet line 181.
It reads:
<code>String password = req.getParameter( LocalSystem.getLogServletAccessParameterName() );
</code>
I don't know where the class LocalSystem comes from either. Its not in the API. Could LocalSystem be something else on my machine because mine runs finnish W2000 and finnish Explorer 5?
[ February 19, 2003: Message edited by: Elouise Kivineva ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
LocalSystem is a file that comes with the com.javaranch.common package. I think this may be a java 1.4 related problem, but I'm not at home right now to check it out.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Might be a silly question, but you did stick the JavaRanchCommon.jar in Orion's lib directory, right?
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1740
    
    2
LocalSystem is a file that comes with the com.javaranch.common package. I think this may be a java 1.4 related problem,
LocalSystem comes in the .zip file, but it doesn't declare itself as part of the com.javaranch.common package. LogServlet, for example, imports it directly (as part of the "default package"):
import LocalSystem ;
I know there is some 1.4 trickiness with this kind of importing, but I can't remember the details.
If it turns out that Elouise does have the .jar file in the Orion's lib directory and this still doesn't work, would it be necessary to update LocalSystem to be part of a package in order for LogServlet to import it?
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
One thing I learned about 1.4 is that it no longer accepts importing from the "default" package, so importing a class without it actually being in a package doesn't work.
I experienced this with developing web applications. The beans I accessed in a JSP page had to be part of package, because of how the code turns up with the JSP page getting turned into a servlet. If I used 1.3, it worked fine, but for it to work in 1.4, I had to put the bean in a package. I found a note about it in Tomcat's bug list.
Not sure if that is the issue here, but I think that is what you were referring to Mike.
[ February 19, 2003: Message edited by: jason adam ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
That is the issue I am referring to, Jason. I ran into it when I updated the Rules Roundup game.

I think we will need to update the JavaRanchCommon.jar so it will work in the 1.4 SDK. Give me a couple of days, please, Elouise.
[ February 19, 2003: Message edited by: Marilyn de Queiroz ]
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
Yes, I have the JavaRanch common in C:\orion\lib. And it must see it too otherwise it couldn't kick over at a specific line in the code of LogServlet.
Some messages talk about tools.jar. My C:\orion\lib has a tools.jar although I honestly can't remember if I put it there. The general setup must be okay though, because my other homemade servlet (which doesn't use JavaRanch packages) runs fine.
I've got J2 1.4.0 and J2EE 1.3.1.
[ February 19, 2003: Message edited by: Elouise Kivineva ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I did not experience any problems with j2sdk1.4.1_01, j2ee1.3.1 and windows 2000. Ma bee buzzes...
However, I do have JavaRanchCommon.jar in e:\orion\default-web-app\WEB-INF\lib and not in e:\orion\lib
I also have put a package statement:
package com.bfgaunt.servlets1 in the source code.
Under e:\orion\default-web-app\WEB-INF\classes I have: com\bfgaunt\servlets1\BeeServlet.class
And in e:\orion\default-web-app\WEB-INF\web.xml
I have
[ February 20, 2003: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
I tried the above and my bee's still silent. Barry, does your BeeServlet use LogServlet.java?
I can't get LogServlet.java to compile; one of the compiler's complaints is (somewhat translated) "what the heck is LocalSystem?".
-----------------------------------------------
I understand this whole problem stems from my computer's having java 1.4 instead of 1.4 so
I'll try installing orion & java 1.3 on my kids computer if they will let me use it -which isn't exactly likely...
[ February 22, 2003: Message edited by: Elouise Kivineva ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
You should not run into this problem if you use java 1.3. It changed with java 1.4.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Originally posted by Elouise Kivineva:
I tried the above and my bee's still silent. Barry, does your BeeServlet use LogServlet.java?
I can't get LogServlet.java to compile; one of the compiler's complaints is (somewhat translated) "what the heck is LocalSystem?".

Yes, it extends LogServlet. But why do you want to compile LogServlet.java? I just import it from JavaRanchCommon.jar: import com.javaranch.common.*;
-Barry
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
By that last question/comment I meant that I import the classes (not the java files) so why is there a compilation of LogServlet going on? Have you by any chance unpacked the jar file ?
-Barry
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
With a copy of the zip, in a different location on my drive, I opened the zip file to see what LogServlet's code said (how else would I know how line 181 reads). That's also how I could see that the package conmtains no files named LocalSystem.
About trying to compile:
I just wanted to see if my java version had problems with it, so I checked to see what would happen. I'd think the fact that it won't compile confirms that the problem is exactly what Jason & Marilyn suspect it to be.
I gotta admit though, why the same setup would run on your machine but not mine is way beyond me.
[ February 22, 2003: Message edited by: Elouise Kivineva ]
[ February 22, 2003: Message edited by: Elouise Kivineva ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Weird. If I get time I'll break open the jar file and try to see what's up (for my own interest, that is). I guess you better follow Marilyn's advice to use 1.3 or wait for a fix.
-Barry
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
Hey wait a minute! I noticed that my cursor said something about a "somethingorother or damaged" (compromised was maybe the 1st word) zip file when it was near the JavaRanchCommon package. I tossed all mine ('cause I don't know which was copied from where) and downloaded a new one.
Now it works.
I tossed the old BeeServlet to be sure & changed the output just to sure and yes, I'm honest to God seeing my very own little buzz-buuzzer!
Thanks for the help & I'm sorry about the worry I caused.
[ February 22, 2003: Message edited by: Elouise Kivineva ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
I'm glad to hear it's working for you, but we're still going to fix it just in case someone else tries to compile the files in the jar.
michaelR simpson
Greenhorn

Joined: Feb 28, 2003
Posts: 5
i've read this thread of discussion with interest because my bee won't buzz either.
having compiled the servlet to the correct directory in orion I get the following internal server error
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at com.evermind[Orion/1.5.2 (build 10460)]._dz.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at com.evermind[Orion/1.5.2 (build 10460)]._ah._axe(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._ah._fpd(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._ah._cwc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._io._twc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._io._gc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._if.run(Unknown Source)
I tried compling the log servlet myself because the bee servlet overides it and got problems because of the import LocalSystem ; line
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Hi, Michael,
Welcome to JavaRanch.

Did you download J2EE (Java 2 Enterprise Edition Software Development Kit) from Sun, and install it? You need to include the j2ee.jar in your classpath.

Your error java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet is typical of this particular omission.

You should not need to recompile the classes in the JavaRanchCommon.zip file in order to do the assignments.

However, we plan to fix that compiling problem this weekend.
michaelR simpson
Greenhorn

Joined: Feb 28, 2003
Posts: 5
Originally posted by Marilyn de Queiroz:
Hi, Michael,
Welcome to JavaRanch.

Did you download J2EE (Java 2 Enterprise Edition Software Development Kit) from Sun, and install it? You need to include the j2ee.jar in your classpath.

Your error java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet is typical of this particular omission.

.

Thanks,
Yes I have the J2EE installed but I have'nt been using a classpath - i've been putting .jar files in the /jre/lib/ext directory which has worked fine up till now - I got this Idea from Just Java 2. and I'm wondering if I'll have to set the classpath now to get the BeeServlet to work.
I started placing .jar files in the directory as above because i had trouble setting the classpath when I originally dowloaded the jRanch common zip file.
Do you recommend the set classpath method?
Great site by the way
michael
[ March 01, 2003: Message edited by: michaelR simpson ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Although placing the jar files in that sub directory is useful for beginning programming in Java, Peter van der Linden has this to say:

Strictly speaking this directory is reserved for use by the Java system, and it is intended for optional system libraries that don't come with the JDK ... Just don't do it for any deployed applications.


In this case, BeeServlet is a deployed application.

Also, I think it is a really good idea to get familiar with the CLASSPATH and the issues that surround using it properly.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Another good idea with web applications is to get familiar with the WEB-INF/lib. You place any libraries that your application needs, and that aren't inherently available from the container (like servlet.jar, etc.), in here. It allows your web applications to be bounced around from server to server without having to mess with either CLASSPATH or sticking .jar files somewhere. Quite handy.

And if you never want to have to mess with CLASSPATH again, check into Ant (great forum here, and great documentation at the Apache Ant site.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My BeeServlet won't buzz
 
Similar Threads
AbstractMethodError in Orion
Javaranch mock?Question Bank ID : 44
a question about the ServletContext
unable to access LogServlet...not the same error that Juliane had
java.lang.UnsupportedClassVersionError: Bad version number in .class file