문제

I'm getting an NPE when using the ConfigurableWroManagerFactory wroManagerFactory and can't seem to trace down the cause. It seems that Context.get().getFilterConfig(); returns null..

Stacktrace (this is the root cause of a WroRuntimeException)

Caused by: java.lang.NullPointerException
    at ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory.updatePropertiesWithConfiguration(ConfigurableWroManagerFactory.java:202)
    at ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory.access$000(ConfigurableWroManagerFactory.java:45)
    at ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory$1.newProperties(ConfigurableWroManagerFactory.java:86)
    at ro.isdc.wro.model.resource.support.AbstractConfigurableStrategySupport.getProperties(AbstractConfigurableStrategySupport.java:136)
    at ro.isdc.wro.model.resource.support.AbstractConfigurableStrategySupport.getConfiguredValue(AbstractConfigurableStrategySupport.java:52)
    at ro.isdc.wro.model.resource.support.AbstractConfigurableMultipleStrategy.getConfiguredStrategies(AbstractConfigurableMultipleStrategy.java:52)
    at ro.isdc.wro.model.resource.locator.factory.ConfigurableLocatorFactory.newLocatorFactory(ConfigurableLocatorFactory.java:69)
    at ro.isdc.wro.model.resource.locator.factory.ConfigurableLocatorFactory.<init>(ConfigurableLocatorFactory.java:38)
    at ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory$1.<init>(ConfigurableWroManagerFactory.java:82)
    at ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory.newUriLocatorFactory(ConfigurableWroManagerFactory.java:82)
    at ro.isdc.wro.manager.factory.BaseWroManagerFactory$1.initialize(BaseWroManagerFactory.java:96)
    at ro.isdc.wro.manager.factory.BaseWroManagerFactory$1.initialize(BaseWroManagerFactory.java:73)
    at ro.isdc.wro.util.LazyInitializer.get(LazyInitializer.java:32)
    at ro.isdc.wro.manager.factory.BaseWroManagerFactory.create(BaseWroManagerFactory.java:156)
    at ro.isdc.wro.manager.factory.BaseWroManagerFactory.create(BaseWroManagerFactory.java:51)
    at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.getWroManager(AbstractWro4jMojo.java:452)
    ... 26 more

wro4j.version is 1.7.0

Plugin entry in my pom.xml:

        <plugin>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-maven-plugin</artifactId>
            <version>${wro4j.version}</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/static/js</jsDestinationFolder>
                <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/static/css</cssDestinationFolder>
                <ignoreMissingResources>false</ignoreMissingResources>
                <wroManagerFactory>ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
            </configuration>
        </plugin>

and my wro.properties

#If true, it is DEVELOPMENT mode, by default this value is true
debug=true
# Default is true
gzipEnabled=true

# MBean name to be used if JMX is enabled
#mbeanName=wro
#jmxEnabled=true

# Default is 0
cacheUpdatePeriod=0
# Default is 0
modelUpdatePeriod=0
# Default is false.
disableCache=false
# Default is UTF-8
encoding=UTF-8

managerFactoryClassName=ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory
preProcessors=jsLint,lessCssImport,cssUrlRewriting,cssImport,semicolonAppender
postProcessors=googleClosureSimple,less4j

resourceWatcherUpdatePeriod=5
도움이 되었습니까?

해결책

When using the build-time solution (maven plugin), you should use

ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory

Notice that this class is in a different package the the one used by you. Also, try upgrading to version 1.7.1.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top