Through guessing and dumb luck, I have solved the NullPointerException
using Xalan with Spring Framework, though I still cannot figure out to
debug Xalan under eclipse.

   In my Spring file, I declare my bean as;

        <bean id="XsltBean" class="myClass">
                <property name="transformer" value="/path/to/my.xslt"/>
        </bean>

Changing the bean line to the following made the NullPointerException go
away;

        <bean id="XsltBean" class="myClass" singleton="false">

--CB

> -----Original Message-----
> From: Brown, Charles [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 01, 2005 4:14 PM
> To: Chris Bare; xalan-j-users@xml.apache.org
> Subject: RE: Debugging hints please
> 
> 
> Chris,
> 
>    Thanks for tips.  Hope you have more.
> 
>    I did create a xalan project, and modified my target 
> project's Build Path to use it instead of a xalan JAR.
> 
>    I tried your ClassPathInfo on my TransformerFactory 
> object.  But, the
> getCodeSource() call returns null.
> 
>    I still get a warning out of eclipse that I can't set a 
> breakpoint in xalan, because "missing line number 
> attributes". Which I think means that the xalan in the rt.jar 
> is being used, since my xalan project definitely compiles 
> with line number attributes generated.  
> 
>    Also, I did use the eclipse 'debug...' menu and tried to 
> set java.endorsed.dirs to include the path to xalan class 
> files in the xalan project.  But, a getProperty call shows 
> this property is set to null when I run debug.  This perhaps, 
> is a side effect of the Spring Framework, as when I run a 
> simple main it seems to point to JRE_HOME/lib/endorsed.  So, 
> I tried using a setProperty call within the program, but that 
> didn't seem to phase it either.
> 
>    More hints?
> 
> --CB
> 
> > -----Original Message-----
> > From: Chris Bare [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 01, 2005 1:36 PM
> > To: xalan-j-users@xml.apache.org
> > Subject: RE: Debugging hints please
> > 
> > 
> > Here's a little thing I use to figure out if I'm really
> > getting the classes from the jar that I think I'm getting:
> > 
> > 
> >     /**
> >      *  tell what class an object is and where in the
> > classpath it came from
> >      */
> >     public static String getClassPathInfo(Object object) {
> >         try {
> >             return "class: "
> >                 + object.getClass().getName() +
> > System.getProperty("line.separator")
> >                 + "code source: " +
> >  
> > 
> object.getClass().getProtectionDomain().getCodeSource().getLocation();
> >         }
> >         catch (Exception e) {
> >             return "Exception in getClassPathInfo: " + 
> e.getMessage();
> >         }
> >     }
> > 
> > You probably already know this, but:
> > 
> > You can create a xalan project in eclipse and then link the
> > your project to the xalan project by right-clicking on your 
> > project in the Package Explorer view and selecting properties 
> > | Java Build Path | Projects and adding the xalan project to
> > the build path.
> > 
> > Alternatively, build your own xalan.jar, add it to your
> > project (properties | Java Build Path | Libraries | Add 
> > External Jar). Then right click on the jar in the package 
> > explorer and select properties | java source attachment.
> > 
> > 
> 

Reply via email to