struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burton Rhodes <burtonrho...@gmail.com>
Subject Re: [S2] Velocity.properties file and Struts
Date Sat, 08 May 2010 02:47:39 GMT
I think I figured it out.  Not struts related.  I am using the
singleton Velocity class which needs an explicit call to the
properties file or properties need to be set in code before init().
In case anyone is interested, the code below did the trick....

			Velocity.setProperty(Velocity.RUNTIME_LOG,
"/var/log/tomcat6/velocity.log");
			Velocity.init();
			Velocity.evaluate(context, writer, "LOG", reader);




On Fri, May 7, 2010 at 9:07 PM, Martin Gainty <mgainty@hotmail.com> wrote:
>
> turn off velocity logging
> runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogSystemlet log4j take
over logging by placing log4j.properties in your classpath ( i always place a copy of log4j.properties
in web-inf/classes )
>
> hth
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so
bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer
Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und
entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails
koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.
>
>
>
>
>> Date: Fri, 7 May 2010 18:59:25 -0500
>> Subject: [S2] Velocity.properties file and Struts
>> From: burtonrhodes@gmail.com
>> To: user@struts.apache.org
>>
>> My struts web app seems to be ignoring my velocity.properties file.
>> After googling quite a bit I am seeing bits of information that struts
>> has it own velocity.properties file and it may be ignoring mine since
>> it finds the struts version (complete guess).  Curious if anyone has
>> had issues with this - or if this is totally unrelated to Struts.  My
>> project is maven based and my velocity.properties file is in the
>> src/main/resources/ directory.  I only use the velocity engine for a
>> few pages - my "view" is coded in JSP.
>>
>> Specifically, the velocity engine fails to initialize since the
>> velocity.log file is being written in a root location and I get a
>> "permission denied" error.  My stack trace is below.  I'm trying to
>> set velocity to use Log4J or change the location of the velocity.log
>> file.  No matter what I write, nothing seems to get set from my
>> properties file.  Any ideas?
>>
>> velocity.properties:
>> runtime.log.logsystem.class = org.apache.velocity.runtime.log.Log4JLogChute
>> runtime.log.logsystem.log4j.logger = org.apache.velocity
>> runtime.log.logsystem.log4j.logger.level = WARN
>> #runtime.log = /var/log/tomcat6/velocity.log
>>
>> Stack Trace:
>> May 07, 18:45:49 (LetterCreator.java:238)
>> FATAL: Error replacing contact fields on letter merge.
>> org.apache.velocity.exception.VelocityException: Failed to initialize
>> an instance of org.apache.velocity.runtime.log.Log4JLogChute with the
>> current runtime configuration.
>>       at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:206)
>>       at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:255)
>>       at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:795)
>>       at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:250)
>>       at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:114)
>>       at org.apache.velocity.app.Velocity.init(Velocity.java:79)
>>       at com.afs.service.reporting.LetterCreator.mergeContacts(LetterCreator.java:199)
>>       at com.afs.web.action.LetterMergeAction.mergeContact(LetterMergeAction.java:73)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>       at java.lang.reflect.Method.invoke(Method.java:616)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
>>       at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
>>       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:251)
>>       at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
>>       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
>>       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
>>       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
>>       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:164)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at com.afs.web.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:30)
>>       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
>>       at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
>>       at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
>>       at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
>>       at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
>>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>       at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
>>       at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>>       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>>       at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
>>       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
>>       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
>>       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
>>       at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
>>       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
>>       at java.lang.Thread.run(Thread.java:636)
>> Caused by: java.lang.RuntimeException: Error configuring Log4JLogChute :
>>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>>       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>       at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
>>       at org.apache.velocity.util.ExceptionUtils.createWithCause(ExceptionUtils.java:67)
>>       at org.apache.velocity.util.ExceptionUtils.createRuntimeException(ExceptionUtils.java:45)
>>       at org.apache.velocity.runtime.log.Log4JLogChute.initAppender(Log4JLogChute.java:133)
>>       at org.apache.velocity.runtime.log.Log4JLogChute.init(Log4JLogChute.java:85)
>>       at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:157)
>>       ... 81 more
>> Caused by: java.io.FileNotFoundException: velocity.log (Permission denied)
>>       at java.io.FileOutputStream.openAppend(Native Method)
>>       at java.io.FileOutputStream.<init>(FileOutputStream.java:207)
>>       at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
>>       at org.apache.log4j.FileAppender.setFile(FileAppender.java:289)
>>       at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:167)
>>       at org.apache.log4j.FileAppender.<init>(FileAppender.java:108)
>>       at org.apache.log4j.RollingFileAppender.<init>(RollingFileAppender.java:69)
>>       at org.apache.velocity.runtime.log.Log4JLogChute.initAppender(Log4JLogChute.java:118)
>>       ... 83 more
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> _________________________________________________________________
> The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
> http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message