UGN Security
Posted By: bosky101 jsp - j2ee problem - 05/23/04 06:21 PM
i have a strange probelm.... jsp files that i delete from the public_html folder,are stll visible or can be run when the server runs.
eg: i deleted bean.jsp ,but when i go to localhost:8000/bean.jsp , it still runs !!!
i am coming across this problem a nmber of times.

I would also like to know where the beans,classes should be stored for j2ee ( j2ee/lib/classes/ ? )
Posted By: pergesu Re: jsp - j2ee problem - 05/24/04 01:32 AM
You might know that a JSP gets compiled into a servlet, it's just a convenient way to write a servlet with some HTML markup. The first time you call the page, it gets compiled into a servlet class, and like any class, is loaded by the class loader. The J2EE server stores the class in memory until you undeploy the web application. Next time you restart the J2EE server, your file won't show up.

Bean classes should be stored on a per application basis. Write your bean classes, then put them in a jar file, and stick that in the $app/WEB-INF/lib directory. The only time you want jar files in j2ee/lib is when they store something that should be used for the entire server, such as a JDBC connector or JMS implementation. If certain classes are to be used only by an application, they should be confined to that particular application's lib directory.
Posted By: bosky101 Re: jsp - j2ee problem - 05/28/04 05:24 AM
Posted By: bosky101 Re: jsp - j2ee problem - 05/28/04 05:26 AM
question ...

i have j2ee, do i need tomcat ?i hear that j2ee has a inbuilt tomcat,i havnt been able to access it so far.S o i downloaded tomcat 5.0.24 and extracted the zip file.hers what else i did

-set path for java_home
-set catalina_home

do i need to set a classpath variable to a servlet-api.jar or jsp-api.jar from \common\lib

-localhost:8080\ gives nothing

-bin\tomcat5 gives nothing when run
-bin\tomcat5w says not a batch or service
-bin\startup show this

Using CATALINA_BASE: d:\tomcat\jakarta-tomcat-5.0.24
Using CATALINA_HOME: d:\tomcat\jakarta-tomcat-5.0.24
Using CATALINA_TMPDIR: d:\tomcat\jakarta-tomcat-5.0.24\temp
Using JAVA_HOME: d:\java

-and running bin\startup.bat opens a new window with text that scrolls fast and then just closes !

what did i do ....... what Do i do ?! frown


PS:by the way the add quick reply or full reply button did not work,it took me to http://www.undergroundnews.com/boards .I had to click on the link on the bottom of the page,saying post reply !
Posted By: Gremelin Re: jsp - j2ee problem - 05/28/04 06:04 AM
/boards/ is unsupported. Only responses sent through the main board are supported. /boards/ is stricly a search engine mirror.
Posted By: pergesu Re: jsp - j2ee problem - 05/28/04 08:50 AM
Tomcat is just a servlet and JSP container. It's also the reference implementation of the Sun Servlet and JSP standards. If you want do use any other parts of J2EE, such as EJB or JDNI, you need a more comprehensive container. [url=http://www.jboss.org]JBoss[/jboss] is the one I'd recommend. It's open source, and a great product. But it seems you just want to do servlet/jsp stuff, so Tomcat will be fine.

As far as running Tomcat, you just extract it into whatever directory you want, set up the environment variables, and start it up. That's all covered in the documentation.

Here's the How-to: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/RUNNING.txt

Here's a pretty good tutorial, that covers the installation, and some basic servlet coding:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/
Posted By: bosky101 Re: jsp - j2ee problem - 05/28/04 10:28 PM
does having zone alarm or norton anti-vir hinder the functioning of the tomcat server ? localhost:8080/till shows "page cannot be displayed " message !
Posted By: pergesu Re: jsp - j2ee problem - 05/29/04 01:56 PM
I haven't used any of those. But if you've got a firewall running (which I think ZA is), then you have to allow access to port 8080.
Posted By: bosky101 Re: jsp - j2ee problem - 06/08/04 04:09 AM
one more Q,

wher do i put the classes or beans for j2ee ? any idea ?

thnx
Posted By: pergesu Re: jsp - j2ee problem - 06/08/04 04:32 PM
classes go in /WEB-INF/lib, and that's relative to the web application. You can have two forms of a web app - a war file or an exploded archive. A war file is just a jar with a .war extension. You have a WEB-INF directory in it, into which the web.xml file goes, and a WEB-INF/lib, where you put any compiled classes or jar files. Compiled servlet classes go into WEB-INF/classes
Posted By: bosky101 Re: jsp - j2ee problem - 06/09/04 02:37 PM
when double click on startup.bat in windows explorer,it just closes quickly after opening.
i went to the services and manually started tomcat.
But,when i go to http://localhost:80/ ,it says page cannot be found !

- should tomcat and j2ee have the same port numbers,j2ee uses 8000 and i made tomcat use 80 .
- Do i need j2ee to be runnning along with tomcat, i tried it ,it still doesnt show anything
- uncommented the <Context path="" docBase="ROOT" debug="0"> line in server.xml
-added a <DefaultContext reloadable="true"/> before the context path line,as in the manuals.


the index.jsp works when i open it with ie 5.0 ,but not at localhost:80

When i type install~dir/bin/catalina run
,the folwing message comes

[ERROR] Digester - -Begin event threw exception <sun.misc.InvalidJarIndexExce
on: Invalid index!>sun.misc.InvalidJarIndexException: Invalid index!
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:594)
at sun.misc.URLClassPath.getResource(URLClassPath.java:134)
at java.net.URLClassLoader$1.run(URLClassLoader.java:192)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at org.apache.catalina.loader.StandardClassLoader.findClass(StandardC
sLoader.java:621)
at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardC
sLoader.java:958)
at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardC
sLoader.java:857)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRul
ava:253)
at org.apache.commons.digester.Rule.begin(Rule.java:200)
at org.apache.commons.digester.Digester.startElement(Digester.java:12

at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown S
ce)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(U
own Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartEle
t(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCont
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Catalina.start: sun.misc.InvalidJarIndexException: Invalid index!
sun.misc.InvalidJarIndexException: Invalid index!
at org.apache.commons.digester.Digester.createSAXException(Digester.j
:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.j
:2566)
at org.apache.commons.digester.Digester.startElement(Digester.java:12

at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown S
ce)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(U
own Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartEle
t(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCont
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)


Ive beenstruggling with this for ...... SOO LLONG.
Posted By: bosky101 Re: jsp - j2ee problem - 06/11/04 07:33 PM
you wont believe it !!!!
after being slaughtered thru various manuals, cionfiguration faqs, downloading four verions of tomcat ,etc unsuccesfully ... i fianally stumbled across line #75 of server.xl under tomcat~-dir/conf/ which said that ...


Code
 * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
           later, and put the JAR files into "$JAVA_HOME/jre/lib/ext". 
and all the while i had jdk 1.3 !!!!
i immediately installed jdk 1.5 and voila ...it worked without any glitches ! hardly took 5 minutes for something ive been trying for one WHOLE month!

thnx pergusu ... and every1 else for letting me figure out this 1 myself ... the hard way . smile
© UGN Security Forum