Ops, My mistake, I meant that "basic version of velocity jar".

But as you said, they are the same.

Thank you.

-----Mensagem original-----
De: Adrian Tarau [mailto:[EMAIL PROTECTED] 
Enviada em: sexta-feira, 26 de setembro de 2008 10:21
Para: Velocity Users List
Assunto: Re: RES: RES: Trying to run velocity with JBoss

Lucas,

By "basic version of spring jar" you mean 
<spring-framework-distribution-with-dependencies>/lib/velocity-1.5.jar ?
The same jar you could take it from a Velocity 1.5 distribution, but the 
one distributed with spring-framework it's fine.

Lucas Balensiefer wrote:
> Hi Adrian,
>
> It worked fine using the basic version of spring jar instead of
> velocity-dep. I only removed the velocity-dep and added the velocity basic
> jar and Jakarta Commons Lang jar.
>
> Thanks for your help.
> Lucas Balensiefer
>
> -----Mensagem original-----
> De: Adrian Tarau [mailto:[EMAIL PROTECTED] 
> Enviada em: quinta-feira, 25 de setembro de 2008 17:10
> Para: Velocity Users List
> Assunto: Re: RES: Trying to run velocity with JBoss
>
>
> It doesn't matter :) what component, commons-collection is mandatory and 
> you don't care which component, you must have it in your classpath.
>
> The purpose of velocity-dep is to be easy to use Velocity without 
> importing many jar files. It is not a good idea to use velocity + dep 
> version in a complex environment. Use velocity-1.5.jar and include 
> mandatory and/or optional libraries as per 
>
http://velocity.apache.org/engine/releases/velocity-1.5/jar-dependencies.htm
> l.
>
> If you don't want to escape references(see developer manual) don't 
> include  Jakarta ORO(even if is mandatory).
>
> PS. Maybe Jakarta ORO should be marked as optional because  by default 
> is not used(searching for EscapeHtmlReference doesn't show any usage).
>
> Lucas Balensiefer wrote:
>   
>> Adrian,
>>
>> Yes, I'm using commons-collections-2.1 and velocity-dep-1.5 in my
>> application.
>>
>> I saw that OrderedMap was using the WebAppClassLoader before Velocity and
>> when it starts the conflict occurs, but I still don't know what component
>> uses the OrderedMap.
>>
>> Thanks,
>> Lucas.
>>
>> -----Mensagem original-----
>> De: Adrian Tarau [mailto:[EMAIL PROTECTED] 
>> Enviada em: quinta-feira, 25 de setembro de 2008 16:21
>> Para: Velocity Users List
>> Assunto: Re: Trying to run velocity with JBoss
>>
>> Lucas,
>>
>> This is not related with resource loading, there is a class version 
>> conflict in the classloader.
>>
>> Do you use velocity-dep-1.5.jar and you have Jakarta Commons Collections 
>> in your application?
>>
>> Lucas Balensiefer wrote:
>>   
>>     
>>> Hi folks,
>>>
>>>  
>>>
>>> I'm trying to run Velocity 1.5 with a web application inside JBoss. I
use
>>> Velocity to generate some files, I'm not using to view them.
>>>
>>>  
>>>
>>> My code is running fine standalone, but when I'm deploying this in JBoss
>>>     
>>>       
>> and
>>   
>>     
>>> invoke my class by the application, the exception is thrown:
>>>
>>>  
>>>
>>> 14:17:37,896 ERROR [STDERR] java.lang.LinkageError: loader constraint
>>> violation: loader (instance of
>>> org/jboss/web/tomcat/service/WebAppClassLoader) previously initiated
>>>     
>>>       
>> loading
>>   
>>     
>>> for a different type with name
>>>       
> "org/apache/commons/collections/OrderedMap"
>   
>>> 14:17:37,912 ERROR [STDERR]   at
>>>       
> java.lang.ClassLoader.defineClass1(Native
>   
>>> Method)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>       
> java.lang.ClassLoader.defineClass(Unknown
>   
>>> Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>> java.security.SecureClassLoader.defineClass(Unknown Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
>   
>>   
>>     
>>> ader.java:1817)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:872)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:1325)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:1204)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>> java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>       
> java.lang.ClassLoader.defineClass1(Native
>   
>>> Method)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>       
> java.lang.ClassLoader.defineClass(Unknown
>   
>>> Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>> java.security.SecureClassLoader.defineClass(Unknown Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
>   
>>   
>>     
>>> ader.java:1817)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:872)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:1325)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:1204)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>> java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>       
> java.lang.ClassLoader.defineClass1(Native
>   
>>> Method)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>       
> java.lang.ClassLoader.defineClass(Unknown
>   
>>> Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>> java.security.SecureClassLoader.defineClass(Unknown Source)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
>   
>>   
>>     
>>> ader.java:1817)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:872)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:1325)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>   
>>   
>>     
>>> a:1204)
>>>
>>> 14:17:37,912 ERROR [STDERR]   at
>>> java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.velocity.runtime.resource.ResourceCacheImpl.initialize(ResourceCa
>   
>>   
>>     
>>> cheImpl.java:71)
>>>
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(Resource
>   
>>   
>>     
>>> ManagerImpl.java:198)
>>>
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(Runtim
>   
>>   
>>     
>>> eInstance.java:594)
>>>
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>       
> org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:241)
>   
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>       
> org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:534)
>   
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:227)
>   
>>   
>>     
>>> 14:17:37,927 ERROR [STDERR]   at
>>> org.apache.velocity.app.Velocity.init(Velocity.java:111)
>>>
>>> 14:17:37,927 ERROR [STDERR]   at
>>>
>>>     
>>>       
>
br.com.cwi.reporttool.report.build.velocity.VelocityHandler.<init>(VelocityH
>   
>>   
>>     
>>> andler.java:41)
>>>
>>>  
>>>
>>>  
>>>
>>> I already tried others alternatives (loading by WebappLoader or
>>> ClasspathLoader), but I can't to load the file too. I prefer to use the
>>> FileResourceLoader, but If exists a solution using other Loader, that's
>>>     
>>>       
>> ok.
>>   
>>     
>>> My code is:
>>>
>>>                    
>>>
>>> public class VelocityHandler {
>>>
>>>  
>>>
>>>     private VelocityContext context = null;
>>>
>>>     private Template template =  null;
>>>
>>>  
>>>
>>>     private static Logger logger =
>>>     
>>>       
>> Logger.getLogger(VelocityHandler.class);
>>   
>>     
>>>  
>>>
>>>     public VelocityHandler(final String templateFile, final String
>>> templatesDir) throws BuildException {
>>>
>>>  
>>>
>>>         try {
>>>
>>>             Properties p = new Properties();
>>>
>>>  
>>>
>>>             //p.setProperty("resource.loader", "webapp");
>>>
>>>             //p.setProperty("webapp.resource.loader.class",
>>> "org.apache.velocity.tools.view.servlet.WebappLoader");           
>>>
>>>             
>>>
>>>             p.setProperty("resource.loader","file");
>>>
>>>  
>>>
>>>     
>>>       
>
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
>   
>>   
>>     
>>> urce.loader.FileResourceLoader");
>>>
>>>             p.setProperty("file.resource.loader.path", templatesDir);
>>>
>>>  
>>>
>>>             //p.setProperty( "resource.loader", "class" );
>>>
>>>             //p.setProperty( "class.resource.loader.class",
>>> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>>>
>>>  
>>>
>>>             try {
>>>
>>>                   Velocity.init(p); 
>>>
>>>             } catch (Throwable e) {
>>>
>>>                   e.printStackTrace();
>>>
>>>             }
>>>
>>>             
>>>
>>> ...
>>>
>>>  
>>>
>>>  
>>>
>>>  
>>>
>>> Thanks,
>>>
>>> Lucas Balensiefer
>>>
>>>
>>>   
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to