Thingsboard: could not start up via cmd java -jar thingsboard-2.3.1-SNAPSHOT-boot.jar

Created on 11 Apr 2019  路  14Comments  路  Source: thingsboard/thingsboard

when I run java -jar thingsboard-2.3.1-SNAPSHOT-boot.jar
I got the failure on output: , it seems it could not load the template/ resources (*.vm)
2019-04-09 20:25:41,013 [main] ERROR o.a.v.runtime.log.Log4JLogChute - Problem instantiating the template loader: org.thingsboard.server.config.ThingsboardMessageConfiguration$SpringResourceLoader.
Look at your properties file and make sure the
name of the template loader is correct.
java.lang.IllegalAccessException: Class org.apache.velocity.util.ClassUtils can not access a member of class org.thingsboard.server.config.ThingsboardMessageConfiguration$SpringResourceLoader with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
at java.lang.Class.newInstance(Class.java:436)
at org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:105)
at org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:46)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:130)
at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:730)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:263)
at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:93)
at org.thingsboard.server.config.ThingsboardMessageConfiguration.velocityEngine(ThingsboardMessageConfiguration.java:69)
at org.thingsboard.server.config.ThingsboardMessageConfiguration$$EnhancerBySpringCGLIB$$607061f7.CGLIB$velocityEngine$1()

Most helpful comment

Got the same problem.

Try to add public keywords at SpringResourceLoader.

    @Slf4j
    public static class SpringResourceLoader extends ...

This problem has gone.

All 14 comments

Happen to have the same problem. Have you found out any solution about that?
tks

Yes, I also get the error:
I think the root cause is here:

private static final String DEFAULT_RESOURCE_LOADER_PATH = "classpath:/templates/";

private ResourceLoader resourceLoader = new DefaultResourceLoader();

@Bean
public VelocityEngine velocityEngine() {
    VelocityEngine velocityEngine = new VelocityEngine();
    try {
        Resource resource = resourceLoader.getResource(DEFAULT_RESOURCE_LOADER_PATH);
        File file = resource.getFile();
        velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "file");
        velocityEngine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, "true");
        velocityEngine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, file.getAbsolutePath());
    } catch (IOException e) {
        initSpringResourceLoader(velocityEngine, DEFAULT_RESOURCE_LOADER_PATH);
    }
    velocityEngine.init();
    return velocityEngine;

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'velocityEngine' defined in class path resource [org/thingsboard/server/config/ThingsboardMessageConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.velocity.app.VelocityEngine]: Factory method 'velocityEngine' threw exception; nested exception is org.apache.velocity.exception.VelocityException: Problem instantiating the template loader: org.thingsboard.server.config.ThingsboardMessageConfiguration$SpringResourceLoader.

Got the same issue any solutions ?

Yes, I also get the error

Got the same problem.

Try to add public keywords at SpringResourceLoader.

    @Slf4j
    public static class SpringResourceLoader extends ...

This problem has gone.

Thanks for your suggestion @choudh2011!
I was also having this problem

Thanks you @choudh2011!......your suggestion worked for me

@choudh2011 thanks, very helpful

@choudh2011 thank you. It work for me

How is this still not part of the 2.4 release ? Is this happening only on limited systems ?

@alexsmartens , you made pull request for this change ?

Just in case there are more people that didn't find where to add the public keyword in the SpringResourceLoader, presented by @choudh2011, is located in the file at ${TB_WORK_DIR}/application/src/main/java/org/thingsboard/server/config/ThingsboardMessageConfiguration.java at line 86/87

Why is this still missing?

This issue can be closed. PR: https://github.com/thingsboard/thingsboard/pull/2247
@ashvayka

Was this page helpful?
0 / 5 - 0 ratings