Julian Coombes wrote:
<snip>
>
> Then there was the strange case of the JetspeedResources class. When
> Jetspeed is first started, the JetspeedLayout class is instantiated, and the
> TOP and BOTTOM members are initialised by the JetspeedResources singleton.
> Within JetspeedResources.init() there's the following bit of code:-
>
> synchronised (JetspeedResources.class) {
> try {
> instance = new JetspeedResources(filename);
> instance.setSingletonHandle( SINGLETON_HANDLE);
> SingletonHolder.put( instance );
> } catch (IOException ioe) {
> Log.error( ioe );
> return null;
> }
> }
> instance.setInitialized( true );
>
> When Jbuilder hit this piece of code, the 'try' block would execute fine
> without throwing an exception but then the Jbuilder debugger would jump to the
> 'return null' line, skipping 'Log.error' and exit the function. I attempted a
> number of fixes including disabling the JIT, and tweaking various Jbuilder
> compile and runtime settings to no effect.
Yeah... I have noticed that JBuilder has a tendency to do this when
Exceptions are thrown in code it is trying to debug. Log.error should
have been called though.
Find out why the IOException is happening. Maybe the file isn't there
or you don't have read?
> In the end I simply hard code the values of TOP and BOTTOM in the
> JetspeedLayout class, again just to get things moving. The only other value
> obtained from JetspeedResources that appeared to suffer was the
> MAX_THREAD_COUNT in the BulkDownloader class. My JVM typically blew up when the
> thread count reached around 40.
Yeah. I know. The algorithm used for the BulkDownloader is that the
more threads you create the quicker you can remove stall points based on
TCP latency and the more you can keep CPU at 100%. The problem is that
you need to maximize resources here.
A *lot* of JVMs were croaking on this. Because I had multiple child
threads calling a static synchronized method in another thread. In the
latest I am going to use a combination of splitting up the workload
(Thread 1 gets 10 URLs and Thread 2 gets another 10, etc) and also use a
shared object without synchronization.
If you don't want this to croak use the latest CVS.
> Again a simple manual edit worked round this
> problem so I set the count to the more reasonable value of 15.
>
> Anyway, Jetspeed now functioned under the debugger, and by simply changing my
> class output path to the webserver servlet directory, I could step through the
> code as it executed.
>
> However, this wasn't enough! What I wanted now was to run tomcat under the
> debugger with jetspeed running under that. That way I'd not have to throw away
> the jetspeed.util.servlet subtree 'cos I'd be using the 2.2 servlet api. So I
> packaged up the relevant classes, examined the tomcat startup code, configured
> tomat into my project as the main application class, setup my TOMCAT_HOME
> environment variable, dragged the snoop servlet into my project for something
> to debug, set a couple of breakpoints in snoop and fired up the debugger.
>
> I was able to access and run the tomcat samples, and the snoop servlet produced
> the expected output. However there was a problem. I could set breakpoints in
> the snoop servlet, but single stepping resulted in a random number of lines
> being executed which typically resulted in the function under examination
> returning. Not one for giving up easily, I consulted the tomcats dev docs and
> was met with the following comment "Using a debugger on servlets and JSP pages
> is currently outside the scope of this document. Enhancements to describe these
> procedures is requested."
>
> Oh well back to the good old turbine logger (Kevin was right :-))
Multithreaded debuging isn't impossible. I have seen decent
implementations. But you really need to shield yourself from the
complexity. JPDA doesn't really work and this might be the problem.
> I did get most of the way through a FAQ for the JSWK 1.01 setup, so I've tagged
> it onto the end of this email (mainly so I don't feel like I've completely
> wasted my time!).
We can put the below in CVS if you are interested in keeping it up to
date and also writing it up in Stylebook :) (see ./xdocs for examples)
> --------- JetSpeed Jbuilder debugging FAQ v0.1 ----------------------
> Prerequisites. The prerequisites are the tools I used, they aren't the only
> options but they're what I got working!
> ===
> Jbuilder 3.5 foundation
> http://www.inprise.com/
>
> Sun Java JDK 1.2
> http://www.javasoft.com/products/jdk/1.2/
>
> Sun Java Server Web Development Kit 1.01
> http://java.sun.com/products/jsp/download.html
>
> JetSpeed and Turbine CVS snapshots
> http://www.working-dogs.com/daily/
> I'm using the snapshot from ApacheJetspeed-20000429.tar.gz,
>
> Jbuilder Multifile extension
> http://www.javabuilders.com/opentools
> ===
> Install Sun JDK 1.2, Jbuilder, expand the Java Server Web development kit 1.01
> to a directory of your choice. To install the Jbuilder Multifile extension,
> copy the multifile.jar file to the jbuilde35/lib/ext directory.
>
> Expand the Apache-Jetspeed.tar.gz you got from the working-dogs daily
> snapshot directory to a path of your choice. For this document I expand
> everything under /usr/src which basically means expanding the .tar.gz
> to /usr/src and renaming the Apache-Jetspeed- directory name to jetspeed to
> ease typing.
>
> So now you've got /usr/src/jetspeed containing all the jetspeed files and
> directories. Jbuilder and JDK 1.2 setup, the JSWDK 1.01 files installed and the
> multifile jbuilder extension.
>
> Create a directory WEB-INF under /usr/src/jetspeed/src and copy the contents of
> the path-to-jswdk/webpages/WEB-INF directory here along with the servlets
> subdirectory and its contents.
>
> Start Jbuilder, create a new project, set the project file to
> /usr/src/jetspeed/src/java/jetspeed.jpr
> Click finish.
>
> Within your jetspeed project set the output path for class files.
> Project Menu ->Project Properties-> "Paths Tab" -> Output Path
> /usr/src/jetspeed/src/WEB-INF/servlets
> This makes all your class files available to the web server.
>
> Make /usr/src/jetspeed/src/java, the only entry in your project source paths
> listbox. (Project->Project Properties->"Source Tab").
>
> Create a Jbuider Library to hold the web server jar files.
> Project->Project Properties->"Required Libraries tab" -> Add ->
> New -> Add.
> Give it the name "JSWDK_1.01" then add the following jar files.
> path-to-jwsdk/webserver.jar
> path-to-jwsdk/lib/servlet.jar
> Click "OK" three times to close all the dialogs and add the library to your
> project.
>
> Copy the SimpleStartup.java file for path-to-jwsdk/etc/SimpleStartup.java to
> /usr/src/jetspeed/src/java. Then add SimpleStartup.java to your jetspeed
> project.(Project->Add to Project->Add files).
> Change line 20 of SimpleStartup.java to the following:
> URL url = resolveURL("/usr/src/jetspeed/src");
>
> Hit Make project.
>
> Set the project main application class to SimpleStartup.
> Project->Project Properties->"Run Tab"->"Application Tab"->
> Main Class->Set
>
> Hit Run Project.
>
> At this point you should be able to point your web browser at
> http://localhost:8080 and see a listing of the files in
> /usr/src/jetspeed/src. You should also be able to run the url
> http://localhost:8080/servlet/snoop, provided that you copied the
> SnoopServlet.class file over to the jetspeed/src/WEB-INF/servlets directory
> from path-to-jswdk/webpages/WEB-INF/servlets.
>
> Part 2.
> The next part is to simply setup up JetspeedResources.properties and
> TurbineResource.properties to recognise that their running
> from /usr/src/jetspeed/src. I'm assuming here that you've setup tmp directories
> and configured jdbcdrivers where appropriate.
>
> --- JetspeedResources.properties ---
> public.cache.directory=/usr/src/jetspeed/src/jetspeed-cache
> (you have to create the jetspeed-cache directory).
> xmlportletcontroller.stylesheet=/usr/src/jetspeed/src/content/xml/defaultstyle.xsl
> cocoon.properties.file=/usr/src/jetspeed/src/config/cocoon.properties
> --- TurbineResources.properties
> jetspeed.properties=/usr/src/jetspeed/src/config/JetspeedResources.properties
>
> Create a jbuilder library for the jetspeed libs and add it to your project.
> You need all the jar files in /usr/src/jetspeed/src/lib.
>
> Create a jbilder library for you jdbc drivers and add it to your project.
>
> Modify your /usr/src/jetspeed/src/WEB-INF/servlets.properties file so it looks
> like the following:-
>
> ----- servlets.properties ------------
> # Define servlets here
>
> # <servletname>.code=<servletclass>
> # <servletname>.initparams=<name=value>,<name=value>
>
> snoop.code=SnoopServlet
> snoop.initparams=initarg1=foo,initarg2=bar
> jetspeed.code=Turbine
>
>jetspeed.initparms=properties=/usr/src/jetspeed/src/config/TurbineResources.properties
> jsp.code=com.sun.jsp.runtime.JspServlet
> --------------------------------------
>
> Add the jetspeed source files to your project.
> Select Add to Project->Add Files, then select the org directory in the folders
> windows from /usr/src/jetspeed/src/java. Check the "Recurse Directories"
> checkbox. Click on OK, making sure that the name "org" appears in the "Enter
> filename" field on the bottom of this dialog box.
>
> Do a "Rebuild All".
>
> You'll get a number of "Deprecated warnings" which I presume you can ignore.
> You'll also get errors from things in the jetspeed.util.servlet subtree. I just
> removed the subtree from the project, to get the compile going. Its probably
> something to do with the servlet.jar file from JSWDK1.01, but the aim here is
> simply to get a working environment!
>
> Now try and run it ...
> -------
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html>
> Problems?: [EMAIL PROTECTED]
--
Kevin A Burton ([EMAIL PROTECTED])
http://relativity.yi.org
Message to SUN: "Please Open Source Java!"
The house of the unbelievers shall be razed and they shall be
scorched to the earth. Their code will be open until the end of days.
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]