You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "ecstasy (Jira)" <ji...@apache.org> on 2020/09/20 21:42:00 UTC

[jira] [Updated] (VELOCITY-932) Resource not found when executing jar file, works fine in IDE

     [ https://issues.apache.org/jira/browse/VELOCITY-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ecstasy updated VELOCITY-932:
-----------------------------
    Description: 
Hello, I have a simple maven project with 1 class file. The project works fine in eclipse but when creating a jar out of it and executing it, it runs into error of ResourceNotFound

 
{code:java}
 SEVERE: ResourceManager : unable to find resource '\templates\welcomeLetter.vm' in any resource loader.
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '\templates\welcomeLetter.vm'
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
        at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
        at net.rajanpanchal.handlers.WelcomeLetterGeneratorHandler.<clinit>(WelcomeLetterGeneratorHandler.java:48)
{code}
 

  was:
Hello, I have a simple maven project with 1 class file. The project works fine in eclipse but when creating a jar out of it and executing it, it runs into error of ResourceNotFound

 
{code:java}
 SEVERE: ResourceManager : unable to find resource '\templates\welcomeLetter.vm' in any resource loader.
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '\templates\welcomeLetter.vm'
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
        at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
        at net.rajanpanchal.handlers.WelcomeLetterGeneratorHandler.<clinit>(WelcomeLetterGeneratorHandler.java:48)
{code}
Attaching project with source code and jar


> Resource not found when executing jar file, works fine in IDE
> -------------------------------------------------------------
>
>                 Key: VELOCITY-932
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-932
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.7.x, 2.2
>         Environment: local
>            Reporter: ecstasy
>            Priority: Major
>
> Hello, I have a simple maven project with 1 class file. The project works fine in eclipse but when creating a jar out of it and executing it, it runs into error of ResourceNotFound
>  
> {code:java}
>  SEVERE: ResourceManager : unable to find resource '\templates\welcomeLetter.vm' in any resource loader.
> Exception in thread "main" java.lang.ExceptionInInitializerError
> Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '\templates\welcomeLetter.vm'
>         at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
>         at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
>         at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
>         at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
>         at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
>         at net.rajanpanchal.handlers.WelcomeLetterGeneratorHandler.<clinit>(WelcomeLetterGeneratorHandler.java:48)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org