You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2002/12/19 23:28:30 UTC

DO NOT REPLY [Bug 15547] New: - Velocity resource problems using Jboss-3.0.4_Tomcat-4.0.6 bundle

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15547>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15547

Velocity resource problems using Jboss-3.0.4_Tomcat-4.0.6 bundle

           Summary: Velocity resource problems using Jboss-3.0.4_Tomcat-
                    4.0.6 bundle
           Product: Velocity
           Version: 1.3-rc1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Build
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: moulden@adobe.com
                CC: moulden@adobe.com


I am using the velocity-tools (0.6) and Struts (1.02) to build an application 
that will run in JBoss.  I subclassed VelocityViewServlet to perform some 
specific startup functions.  JBoss does not unpack WARs and some references 
were returning java.io.FileNotFound errors.
I tracked the problem to VelocityServlet.loadConfiguration(ServletConfig 
config).  The following worked for me:

I changed this code fragment from this

        Properties p = new Properties();
        
        if ( propsFile != null )
        {
            String realPath = getServletContext().getRealPath(propsFile);
        
            if ( realPath != null )
            {
                propsFile = realPath;
            }

            p.load( new FileInputStream(propsFile) );
        }

        return p;

to this

        Properties p = new Properties();
        
        if ( propsFile != null )
        {
        	InputStream is = getClass().getClassLoader().getResourceAsStream
( propsFile );
           	p.load( is );
        }

        return p;

No other external settings/configurations worked until this change was made.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>