我在使用ConfigurableWroManagerFactory
wroManagerFactory时遇到NPE,似乎无法追查原因。似乎Context.get().getFilterConfig();
返回null ..
Stacktrace(这是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
是1.7.0
我的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>
和我的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
答案 0 :(得分:2)
使用构建时解决方案(maven插件)时,您应该使用
ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory
请注意,此类与您使用的包位于不同的包中。 另外,请尝试升级到1.7.1版。