I got the following crash report in Google Play Store:
java.lang.NullPointerException:
at com.xxx.MainActivity.access$1000 (MainActivity.java)
or .access$900 (MainActivity.java)
or .doStamping (MainActivity.java)
or .handleIntent (MainActivity.java)
or .putLabelOnStableStoppedButton (MainActivity.java)
or .wrongFilePopup (MainActivity.java)
at com.xxx.MainActivity.access$1502 (MainActivity.java)
or .access$1700 (MainActivity.java)
or .access$200 (MainActivity.java)
or .access$2000 (MainActivity.java)
or .access$800 (MainActivity.java)
or .createDateDetailsSummaryText (MainActivity.java)
or .refreshLabelOnStampButton (MainActivity.java)
or .stampGPSEvent (MainActivity.java)
or .startGPSLogging (MainActivity.java)
at com.xxx.MainActivity.access$100 (MainActivity.java)
or .access$1402 (MainActivity.java)
or .access$1602 (MainActivity.java)
or .access$1900 (MainActivity.java)
or .access$2400 (MainActivity.java)
or .access$400 (MainActivity.java)
or .access$500 (MainActivity.java)
or .access$602 (MainActivity.java)
or .access$702 (MainActivity.java)
or .btAutoStamping (MainActivity.java)
or .createHtmlTextForButton (MainActivity.java)
or .csvImportFinished (MainActivity.java)
or .displayGetProPopup (MainActivity.java)
or .getValuesAndSaveDialog (MainActivity.java)
or .intentDisplayMap (MainActivity.java)
or .parseIntFromPrefs (MainActivity.java)
or .pickedFileOK (MainActivity.java)
or .showCurrentTripPopUp (MainActivity.java)
or .showStampLimitExceededPopup (MainActivity.java)
or .stopGPSLogging (MainActivity.java)
or .stopTickingBtStamp (MainActivity.java)
or .wrongFilePopup (MainActivity.java)
at com.xxx.MainActivity$21.onClick (MainActivity.java)
at android.support.v7.app.AlertController$ButtonHandler.handleMessage (AlertController.java)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6776)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1386)
I have 2 questions:
why does it say "or" all the time? Can I not get a clear statement as to where it crashed?
what are all the numbers preceded by ".access$"? I was hoping for line numbers, but it doesn't seem to be the case
1: Proguard will often re-use method names which means when it comes to de-obfuscation the map cannot tell the difference, so it has to show you all the possibilities. This question and This question might help.
2: access$ are methods are on inner classes or lambdas where they access the parent class. For example if you had some code like this:
class Outer {
private boolean field = false;
class Inner {
void doSomething() {
if (field) {
System.out.println("hello world");
}
}
}
}
Roughly speaking, to do the line "if field" the compiler needs to access Outer.field from Inner. But the bytecode has no concept of an inner class.
So it creates a hidden method access$XXX() to get access to Outer.field. Similar things happen if you use a lambda expression.
Related
I am trying to use spring data with elastic search version 6. Since this version only has the REST client, the only version of spring-data-elasticsearch that supports it is 3.1.0.RC2. Spring posted documentation for this version but there is no information on how to configure it to connect to elastic search's REST client. Does anyone know how to find this information?
What's also interesting is the documentation gives an example of how to create an embedded instance but all of the classes/annotations it says to use are all missing from the spring-data-elasticsearch.3.1.0.RC2.jar. E.g. #EnableElasticsearchRepositories, ElasticsearchOperations, and ElasticsearchTemplate
Edit: The missing classes were actually due to eclipse not automatically pulling in the manually downloaded jars even though I had gradle pointing to them. But the question still remains.
Update:
I looked into georges van's suggestion. I created a bean for RestHighLevelClient but I don't see a way to use it to configure the ElasticsearchTemplate.
#Configuration
#EnableElasticsearchRepositories
public class ElasticsearchConfig {
#Bean
public ElasticsearchOperations elasticsearchTemplate() {
return new ElasticsearchTemplate(/*expects org.elasticsearch.client.Client*/);
}
#Bean(destroyMethod = "close")
// org.elasticsearch.client.RestHighLevelClient does not extend org.elasticsearch.client.Client
public RestHighLevelClient getRestClient() {
return new RestHighLevelClient(RestClient.builder(new HttpHost("theserver", 9200)));
}
}
Any ideas? Do I even need the ElasticsearchOperations bean? It's in the documentation so I can't tell.
Also, when I run only the getRestClient() bean I get the following error:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getRestClient' defined in class path resource [com/example/ElasticsearchConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.RestHighLevelClient]: Factory method 'getRestClient' threw exception; nested exception is java.lang.IllegalAccessError: org.apache.logging.log4j.core.layout.AbstractJacksonLayout
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
... 25 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.RestHighLevelClient]: Factory method 'getRestClient' threw exception; nested exception is java.lang.IllegalAccessError: org.apache.logging.log4j.core.layout.AbstractJacksonLayout
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 42 common frames omitted
Caused by: java.lang.IllegalAccessError: org.apache.logging.log4j.core.layout.AbstractJacksonLayout
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:729)
at java.net.URLClassLoader.access$400(URLClassLoader.java:95)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1184)
at java.security.AccessController.doPrivileged(AccessController.java:732)
at java.net.URLClassLoader.findClass(URLClassLoader.java:604)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:925)
at java.lang.ClassLoader.loadClass(ClassLoader.java:870)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:343)
at java.lang.ClassLoader.loadClass(ClassLoader.java:853)
at org.apache.logging.log4j.core.config.plugins.util.PluginRegistry.decodeCacheFiles(PluginRegistry.java:181)
at org.apache.logging.log4j.core.config.plugins.util.PluginRegistry.loadFromMainClassLoader(PluginRegistry.java:119)
at org.apache.logging.log4j.core.config.plugins.util.PluginManager.collectPlugins(PluginManager.java:132)
at org.apache.logging.log4j.core.pattern.PatternParser.<init>(PatternParser.java:129)
at org.apache.logging.log4j.core.pattern.PatternParser.<init>(PatternParser.java:110)
at org.apache.logging.log4j.core.layout.PatternLayout.createPatternParser(PatternLayout.java:217)
at org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:128)
at org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:56)
at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:377)
at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:58)
at org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:70)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:145)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:74)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:195)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:160)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:492)
at org.elasticsearch.common.logging.ESLoggerFactory.getLogger(ESLoggerFactory.java:45)
at org.elasticsearch.common.logging.ESLoggerFactory.getLogger(ESLoggerFactory.java:53)
at org.elasticsearch.common.logging.Loggers.getLogger(Loggers.java:38)
at org.elasticsearch.common.ParseField.<clinit>(ParseField.java:35)
at org.elasticsearch.client.RestHighLevelClient.lambda$getDefaultNamedXContents$47(RestHighLevelClient.java:673)
at org.elasticsearch.client.RestHighLevelClient$$Lambda$57.00000000119BE790.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:204)
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1707)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:523)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:513)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:719)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:245)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:510)
at org.elasticsearch.client.RestHighLevelClient.getDefaultNamedXContents(RestHighLevelClient.java:674)
at org.elasticsearch.client.RestHighLevelClient.<init>(RestHighLevelClient.java:215)
at org.elasticsearch.client.RestHighLevelClient.<init>(RestHighLevelClient.java:200)
at org.elasticsearch.client.RestHighLevelClient.<init>(RestHighLevelClient.java:192)
at com.example.ElasticsearchConfig.getRestClient(ElasticsearchConfig.java:23)
at com.example.ElasticsearchConfig$$EnhancerBySpringCGLIB$$29592f91.CGLIB$getRestClient$0(<generated>)
at com.example.ElasticsearchConfig$$EnhancerBySpringCGLIB$$29592f91$$FastClassBySpringCGLIB$$b12c3bab.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at com.example.ElasticsearchConfig$$EnhancerBySpringCGLIB$$29592f91.getRestClient(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 43 common frames omitted
Update: spring-data-elasticsearch.3.1.0.RELEASE is now out but there is still no documentation on how to configure it as a REST client.
To configure the ElasticsearchTemplate, you can inject the Client into the bean
#Bean
public ElasticsearchTemplate elasticsearchTemplate(Client client, Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder) {
return new ElasticsearchTemplate(client, ...);
}
After adding 2 dependencies shown below to my application everything works fine my session data is written to my local redis server, but when i try to specify different address of redis server i got an error. I assume that error is connected with some dependencies problem, but i dont know how to tackle this issue.
compile "org.springframework.boot:spring-boot-starter-data-redis-reactive:${springVersion}"
compile "org.springframework.session:spring-session-data-redis:${springVersion}"
Error during startup
java.lang.IllegalStateException: Error processing condition on
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
at
org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:180)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:61)
~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
pl.bk.pizza.store.Initializer.main(Initializer.java:11) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class
[org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration]
from ClassLoader [sun.misc.Launcher$AppClassLoader#18b4aac2] at
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:569)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:599)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:724)
~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:665)
~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:633)
~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1489)
~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1012)
~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:164)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanType(BeanTypeRegistry.java:153)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.updateTypesIfNecessary(BeanTypeRegistry.java:203)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:115)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:265)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:254)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:196)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:116)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] at
org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE] ... 17
common frames omitted Caused by: java.lang.NoClassDefFoundError:
javax/servlet/Filter at java.lang.ClassLoader.defineClass1(Native
Method) ~[na:1.8.0-internal] at
java.lang.ClassLoader.defineClass(ClassLoader.java:763)
~[na:1.8.0-internal] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
~[na:1.8.0-internal] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
~[na:1.8.0-internal] at
java.net.URLClassLoader.access$100(URLClassLoader.java:73)
~[na:1.8.0-internal] at
java.net.URLClassLoader$1.run(URLClassLoader.java:368)
~[na:1.8.0-internal] at
java.net.URLClassLoader$1.run(URLClassLoader.java:362)
~[na:1.8.0-internal] at
java.security.AccessController.doPrivileged(Native Method)
~[na:1.8.0-internal] at
java.net.URLClassLoader.findClass(URLClassLoader.java:361)
~[na:1.8.0-internal] at
java.lang.ClassLoader.loadClass(ClassLoader.java:424)
~[na:1.8.0-internal] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
~[na:1.8.0-internal] at
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
~[na:1.8.0-internal] at java.lang.ClassLoader.defineClass1(Native
Method) ~[na:1.8.0-internal] at
java.lang.ClassLoader.defineClass(ClassLoader.java:763)
~[na:1.8.0-internal] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
~[na:1.8.0-internal] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
~[na:1.8.0-internal] at
java.net.URLClassLoader.access$100(URLClassLoader.java:73)
~[na:1.8.0-internal] at
java.net.URLClassLoader$1.run(URLClassLoader.java:368)
~[na:1.8.0-internal] at
java.net.URLClassLoader$1.run(URLClassLoader.java:362)
~[na:1.8.0-internal] at
java.security.AccessController.doPrivileged(Native Method)
~[na:1.8.0-internal] at
java.net.URLClassLoader.findClass(URLClassLoader.java:361)
~[na:1.8.0-internal] at
java.lang.ClassLoader.loadClass(ClassLoader.java:424)
~[na:1.8.0-internal] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
~[na:1.8.0-internal] at
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
~[na:1.8.0-internal] at java.lang.Class.getDeclaredMethods0(Native
Method) ~[na:1.8.0-internal] at
java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
~[na:1.8.0-internal] at
java.lang.Class.getDeclaredMethods(Class.java:1975)
~[na:1.8.0-internal] at
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] ... 35 common frames
omitted Caused by: java.lang.ClassNotFoundException:
javax.servlet.Filter at
java.net.URLClassLoader.findClass(URLClassLoader.java:381)
~[na:1.8.0-internal] at
java.lang.ClassLoader.loadClass(ClassLoader.java:424)
~[na:1.8.0-internal] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
~[na:1.8.0-internal] at
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
~[na:1.8.0-internal] ... 63 common frames omitted
RedisConfig
#Configuration
#EnableRedisHttpSession
public class RedisConfig
{
#Bean
LettuceConnectionFactory jedisConnectionFactory()
{
final RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
config.setHostName("redis-19999.c14.us-east-1-2.ec2.cloud.redislabs.com");
config.setPort(19999);
config.setPassword(RedisPassword.of("***"));
return new LettuceConnectionFactory();
}
}
build.gradle file
buildscript {
ext.springVersion = '2.0.2.RELEASE'
ext.gradleDocker = '1.2'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "se.transmode.gradle:gradle-docker:$gradleDocker"
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springVersion"
}
}
plugins {
id "org.sonarqube" version "2.6.2"
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'groovy'
apply plugin: 'org.springframework.boot'
apply plugin: 'docker'
apply plugin: 'jacoco'
dependencies {
// spring
compile "org.springframework.boot:spring-boot-starter-webflux:${springVersion}"
compile "org.springframework.boot:spring-boot-starter-data-mongodb-reactive:${springVersion}"
compile "org.springframework.boot:spring-boot-starter-security:${springVersion}"
testCompile "org.springframework.security:spring-security-test:${springSecurityTest}"
testCompile "org.springframework.boot:spring-boot-starter-test:${springVersion}"
compile "org.springframework.boot:spring-boot-starter-data-redis-reactive:${springVersion}"
compile "org.springframework.session:spring-session-data-redis:${springVersion}"
// utils
testCompile "org.assertj:assertj-core:${assertJ}"
compile "com.google.guava:guava:${guava}"
compile "io.projectreactor:reactor-core:${reactor}"
compile "io.reactivex.rxjava2:rxjava:${rxjava}"
compile "commons-lang:commons-lang:${commonsLang}"
compile "commons-validator:commons-validator:${commonsLangValidator}"
compileOnly "org.projectlombok:lombok:${lombok}"
// embedded mongo for tests
testCompile "de.flapdoodle.embed:de.flapdoodle.embed.mongo:${embeddedMongo}"
// spock
compile "org.codehaus.groovy:groovy-all:${groovy}"
testCompile "org.spockframework:spock-core:${spockCore}"
testCompile "org.spockframework:spock-spring:${spockSpring}"
}
There are several thing going on here.
The log you've supplied indicates javax.servlet.Filter is missing from the classpath while your build script and dependencies suggest your building a Spring WebFlux app. I suspect this is due to you explicitly configuring Spring Session's Servlet support using #EnableRedisHttpSession (notice HttpSession in there?) rather than #EnableRedisWebSession. Even better, you should leave Spring Session configuration to Spring Boot to auto-configure it - see Spring Session dedicated section of Spring Boot's reference manual.
The same advice (avoid explicit config, rely on auto-config) applies to your Redis configuration i.e. no need for that explicit LettuceConnectionFactory bean.
Furthermore, with Spring Boot, it's highly recommended to use its dependency management, rather then providing the versions of your dependency explicitly, at least for the dependencies that are covered by Spring Boot's dependency management. Refer to dependency management and dependency versions appendix sections of Boot's reference manual. On top of that, you should also strongly consider using Boot's starters to make sure all the required dependencies are pulled in - see starters dedicated section.
This same error message presents if you create an application via spring initializr , specify Session as a dependency, create a #RestController and then use #EnableSpringHttpSession.
Without using #EnableSpringHttpSession, the application will start and exit, with no stack trace. This gives the appearance that perhaps there is something wrong with the HttpSession configuration.
The actual cause of the error condition is due to not having included Web as an application dependency (or implementation('org.springframework.boot:spring-boot-starter-web' in build.gradle)
For me ,Everything is perfect but it still throws the exception-Propertyplaceholderautoconfiguration
I just tried maven reload and project reload ,still it throws this error and shows some red lines on dependency Class which is I used to import and used it in my project files
Just closed IntelliJ and opened the project again,Then Everything works fine.
Thumbs up,If it is useful to you
I trying develop application with 2 types of databases: HSQL for test module, and PostgreSQL for main. I can't run tests without error. I was reading a lot of tutorials how to set up embedded database, but unfortunately still doesn't work. I added my codes above, can you help me please? I spent 2 days without any progress. Thanks in advance.
JPA entity in main module:
#Entity
#Table(name="\"USER\"")
public class User {
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name= "ID", columnDefinition = "serial")
#Id
public Long id;
#Column(name = "FIRSTNAME")
public String firstname;
#Column(name = "LASTNAME")
public String lastname;
}
My applciation.properties for test module:
spring.datasource.url=jdbc:hsqldb:mem:testdb
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=org.hsqldb.jdbc.JDBCDriver
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL94Dialect
spring.datasource.data=import.sql
My sample test:
#RunWith(SpringRunner.class)
#SpringBootTest
#Transactional
public class UserRepositoryTest {
#PersistenceContext
private EntityManager entityManager;
#Autowired
private UserRepository repository;
#Test
public void test1() {
List<User> users = repository.findAll();
Assert.assertEquals(3, users.size());
}
}
dependencies in gradle script:
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-validation')
runtime('org.hsqldb:hsqldb')
runtime('org.postgresql:postgresql')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
}
Log output:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:44)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [import.sql]: INSERT INTO "USER" (ID, FIRSTNAME, LASTNAME) VALUES (1, 'MARTIN', 'VOGUE'); nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USER
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [import.sql]: INSERT INTO "USER" (ID, FIRSTNAME, LASTNAME) VALUES (1, 'MARTIN', 'VOGUE'); nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USER
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1634)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:220)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1018)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:345)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:340)
at org.springframework.orm.jpa.EntityManagerFactoryUtils.findEntityManagerFactory(EntityManagerFactoryUtils.java:143)
at org.springframework.orm.jpa.JpaTransactionManager.setBeanFactory(JpaTransactionManager.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1647)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
... 39 more
Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [import.sql]: INSERT INTO "USER" (ID, FIRSTNAME, LASTNAME) VALUES (1, 'MARTIN', 'VOGUE'); nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USER
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:491)
at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:238)
at org.springframework.jdbc.datasource.init.DatabasePopulatorUtils.execute(DatabasePopulatorUtils.java:48)
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.runScripts(DataSourceInitializer.java:192)
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.runDataScripts(DataSourceInitializer.java:128)
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.onApplicationEvent(DataSourceInitializer.java:118)
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.onApplicationEvent(DataSourceInitializer.java:51)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.publishEventIfRequired(DataSourceInitializedPublisher.java:77)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.postProcessAfterInitialization(DataSourceInitializedPublisher.java:68)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1775)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:113)
... 50 more
Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USER
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy68.execute(Unknown Source)
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:470)
... 66 more
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: USER
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.ParserDQL.readTableName(Unknown Source)
at org.hsqldb.ParserDQL.readRangeVariableForDataChange(Unknown Source)
at org.hsqldb.ParserDML.compileInsertStatement(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatements(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 75 more
Try to replace
#Table(name="\"USER\"")
with
#Table(name="[USER]")
as user is a key word in sql (not tested)
I'm developing a project with Spring Boot 1.3.2, Spring Data MongoDB and Spring Security, using Dev Tools, with IntelliJ IDEA 15.0.3, using Maven.
I did read the Spring Boot Developer Tools documentation, and carefully configured everything as indicated, and the hot reload worked just fine.
Then, since i needed to perform some tasks during the application startup, mainly connecting to the database and perform validations, and insertions if needed, i decided to use CommandLineRunner beans like this:
#Configuration
public class DatabaseInitializer {
#Bean
CommandLineRunner verifyConfiguration(ConfigurationRepository repository) {
return args -> {
// The id is a provided one and i can't modify it.
if (repository.findOne(...) == null) { // this is the offending line
//perform some tasks here
}
};
}
// more CommandLineRunners following the same approach
}
If i restart the application, everything works just fine, no crashes, no errors, but when i trigger the dev tools hot reload, then it fails, and throws this stacktrace:
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:809) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:790) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:777) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at com.adrisasws.gestor.CesteriaApariciApplication.main(CesteriaApariciApplication.java:15) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.3.2.RELEASE.jar:1.3.2.RELEASE]
Caused by: org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate com.adrisasws.gestor.configuracion.api.outputs.ConfiguracionFacturacion using constructor NO_CONSTRUCTOR with arguments
at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:64) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.data.convert.ClassGeneratingEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:83) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:251) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:231) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1186) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$200(MappingMongoConverter.java:78) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1134) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:870) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:283) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:271) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:271) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:231) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:191) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:78) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:2224) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1855) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1672) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.core.MongoTemplate.findById(MongoTemplate.java:614) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.findOne(SimpleMongoRepository.java:119) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:483) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:468) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at com.sun.proxy.$Proxy160.findOne(Unknown Source) ~[na:na]
at com.adrisasws.gestor.Inicializacion.lambda$inicializacionConfiguracion$1(Inicializacion.java:47) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:806) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
... 11 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.adrisasws.gestor.configuracion.api.outputs.ConfiguracionFacturacion]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:101) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:61) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
... 47 common frames omitted
I'm aware that it complains of ConfiguracionFacturacion being an interface, one of the properties of the document is declared as an interface, but in my code, i always instantiate a concrete implementation, as i said, everything works fine on a normal startup, and during execution.
So basically my questions are:
why does it work normally but fails on hot reload?, is it a bug and then i should submit an issue?
or it is a really bad practice to use abstractions in the entity classes annotated with #Document and i should consider refactoring?
P.S. if you need more information, ask for it, and i'll update the question.
Update: The first time the CommandLineRunner runs, when the element in the database is not present, so the findOne() call returns null, the Hot Reload, does not fail.
Update2: Avoiding the findOne(), and using exists() and count() instead whenever possible, solves the problem, but doesn't seem like a definitive solution, since, fortunately, in my use case I don't really need to access the data, just check if it is present, or to know how many records there are, but in some other use cases, where data access is mandatory, developers can't enjoy the benefits of the hot reload from DevTools.
If it is of any help, here's more information that about this particular issue:
In the specific case of Spring Data MongoDB, when a field in the #Document class is declared as an interface, then in the database, in the embedded document representing that field, a property named _class, with the value of the fully qualified class name of the concrete implementation is inserted, for example:
public class AddressDocument implements Address {
...
}
#Document
public class PersonDocument {
private Address address;
...
}
when performing the following operation:
PersonDocument p = new PersonDocument();
p.setAddress(new AddressDocument(...));
repository.save(p);
then the mongo document stored in the database would have the following form:
{
...
address : {
"_class" : "package.AddressDocument",
...
}
...
}
So it is really obvious to think that Spring Data is using _class to determine what class to use in order to be able to instantiate the class, and for some reason, DevTools is bypassing that mechanism.
I am trying to use quickbooks-online connector in mule project using maven. I am getting following error when I am running the mule application.
ERROR 2015-03-11 16:10:05,108 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
java.lang.ClassNotFoundException: com.intuit.ipp.data.ItemTypeEnum
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.mule.module.launcher.FineGrainedControlClassLoader.findClass(FineGrainedControlClassLoader.java:175)
at org.mule.module.launcher.MuleApplicationClassLoader.findClass(MuleApplicationClassLoader.java:134)
at org.mule.module.launcher.FineGrainedControlClassLoader.loadClass(FineGrainedControlClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.intuit.ipp.data.transformers.ItemTypeEnumEnumTransformer.<init>(ItemTypeEnumEnumTransformer.java:21)
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:525)
at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:408)
at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:443)
at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:415)
at org.mule.config.bootstrap.SimpleRegistryBootstrap.registerObject(SimpleRegistryBootstrap.java:402)
at org.mule.config.bootstrap.SimpleRegistryBootstrap.registerObjects(SimpleRegistryBootstrap.java:357)
at org.mule.config.bootstrap.SimpleRegistryBootstrap.initialise(SimpleRegistryBootstrap.java:218)
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:601)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1639)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1580)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:633)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:86)
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:105)
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:135)
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:90)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:52)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:84)
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:217)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:76)
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:187)
at org.mule.module.launcher.artifact.ArtifactWrapper$2.execute(ArtifactWrapper.java:62)
at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129)
at org.mule.module.launcher.artifact.ArtifactWrapper.init(ArtifactWrapper.java:57)
at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:25)
at org.mule.module.launcher.DefaultArchiveDeployer.guardedDeploy(DefaultArchiveDeployer.java:310)
at org.mule.module.launcher.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:330)
at org.mule.module.launcher.DefaultArchiveDeployer.deployExplodedApp(DefaultArchiveDeployer.java:297)
at org.mule.module.launcher.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:108)
at org.mule.module.launcher.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:290)
at org.mule.module.launcher.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151)
at org.mule.module.launcher.MuleDeploymentService.start(MuleDeploymentService.java:99)
at org.mule.module.launcher.MuleContainer.start(MuleContainer.java:152)
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:15)
INFO 2015-03-11 16:10:05,117 [main] org.mule.module.launcher.application.DefaultMuleApplication: App 'exampleqb' never started, nothing to dispose of
ERROR 2015-03-11 16:10:05,160 [main] org.mule.module.launcher.DefaultArchiveDeployer:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Failed to deploy artifact 'exampleqb', see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org.mule.module.launcher.DeploymentInitException: ClassNotFoundException: com.intuit.ipp.data.ItemTypeEnum
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:196)
at org.mule.module.launcher.artifact.ArtifactWrapper$2.execute(ArtifactWrapper.java:62)
at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129)
at org.mule.module.launcher.artifact.ArtifactWrapper.init(ArtifactWrapper.java:57)
at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:25)
at org.mule.module.launcher.DefaultArchiveDeployer.guardedDeploy(DefaultArchiveDeployer.java:310)
at org.mule.module.launcher.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:330)
at org.mule.module.launcher.DefaultArchiveDeployer.deployExplodedApp(DefaultArchiveDeployer.java:297)
at org.mule.module.launcher.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:108)
at org.mule.module.launcher.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:290)
at org.mule.module.launcher.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151)
at org.mule.module.launcher.MuleDeploymentService.start(MuleDeploymentService.java:99)
at org.mule.module.launcher.MuleContainer.start(MuleContainer.java:152)
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:15)
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleSimpleRegistryBootstrap' defined in URL [jar:file:/D:/MULE/AnypointStudio/plugins/org.mule.tooling.server.3.5.2.ee_4.1.0.201410031231/mule/lib/mule/mule-module-spring-config-3.5.2.jar!/registry-bootstrap-mule-config.xml]: Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: java.lang.NoClassDefFoundError: com/intuit/ipp/data/ItemTypeEnum (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:84)
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:217)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:76)
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:187)
... 13 more
I'm new to this connector and Maven. What is ItemTypeEnum?
How can I solve this error?
Thanks for help in advance.!!
Following is my mule flow:
<quickbooks:config name="Quickbooks_Online" consumerKey="key" consumerSecret="secret" objectStore-ref="_defaultInMemoryObjectStore" doc:name="Quickbooks Online" baseUri="https://sandbox-quickbooks.api.intuit.com/v3/company"/>
<flow name="Authorize" doc:name="Authorize">
<!-- INBOUND ENDPOINT -->
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<quickbooks:auth-user config-ref="Quickbooks_Online" accessTokenUrl="https://oauth.intuit.com/oauth/v1/get_access_token" authorizationUrl="https://appcenter.intuit.com/Connect/Begin" callbackUrl="http://localhost:8090" requestTokenId="#[groovy:message.getSessionProperty('requestTokenIdentifier')]" requestTokenUrl="https://oauth.intuit.com/oauth/v1/get_request_token" doc:name="Quickbooks Online"/>
</flow>
<flow name="GetAccessToken" doc:name="GetAccessToken">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8090" doc:name="HTTP"/>
<logger message="The key value created is: #[payload]" level="INFO" doc:name="Logger"/>
<quickbooks:get-access-token config-ref="Quickbooks_Online" doc:name="Quickbooks Online" requestTokenId="#[message.inboundProperties['userId']]" userIdentifier="#[message.inboundProperties['realmId']]" verifier="#[message.inboundProperties['oauth_verifier']]" apiUrl="https://sandbox-api.intuit.com/v3/company/"/>
<logger message="QB: #[payload] : #[message.inboundProperties['realmId']]" level="INFO" doc:name="Logger"/>
<flow-ref name="ListAccounts" doc:name="Flow Reference"/>
I tried to add the missing dependencies i.e., ipp-v3-java-devkit and ipp-v3-java.data the following way and it worked.
1. mvn install:install-file
-DgroupId=com.intuit.code.devkit.v3
-DartifactId=ipp-v3-java-devkit
-Dversion=2.3.2
-Dpackaging=jar -Dfile=C:/Users/user/Documents/QBMavenJar/ipp-v3-java-data-2.3.2.jar
2. <repository>
<id>my-local-repo</id>
<url>file:///home/user/.m2/repository/com/intuit/code/devkit/v3/ipp-v3-java-devkit/2.3.2/ipp-v3-java-devkit-2.3.2.jar</url>
</repository>
3. <dependency>
<groupId>com.intuit.code.devkit.v3</groupId>
<artifactId>ipp-v3-java-devkit</artifactId>
<version>2.3.2</version>
</dependency>
Performed above steps for both the dependencies.
'Type' attribute of Item entity is defined as String.
Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/item
It can contain either 'Service' or 'Inventory'.
Can you share the usecase on why you are suing ItemTypeEnum?