can't inject the values in the class from configuration created in gradle.properties - gradle

the question is i want to use "Mapping Configuration to objects" in quarkus i have a gradle.properties so i want to declare this array of objects in the .properties file
myApplicationConfig.enabled = true and i want to fetch and use this value we can do that by using #ConfigMapping(prefix = myApplicationConfig) as the annotation on top of the interface for mapping it my interface code:
#ConfigMapping(prefix = "myApplicationConfig")
#StaticInitSafe
public interface ApplicationConfig {
boolean enabled();
List<Details> details();
interface details{
String name();
int age();}
and after injecting into this enabled() i want to fetch it to other class there i want to do some operations such as printing the value so i've injected this interface there and trying to get the value but it says that
ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
Caused by: java.lang.ExceptionInInitializerError
at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
... 6 more
Caused by: java.lang.IllegalStateException: io.smallrye.config.ConfigValidationException: Configuration validation failed:
java.util.NoSuchElementException: SRCFG00014: The config property
Config.enabled is required but it could not be found in any config source
Caused by: java.lang.IllegalStateException: io.smallrye.config.ConfigValidationException: Configuration validation failed:
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:453)
at io.quarkus.runtime.generated.Config.<clinit>(Unknown Source)
... 18 more
Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
java.util.NoSuchElementException: SRCFG00014: The config property Config.enabled is required but it could not be found in any config source
at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:805)
at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:761)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:450)
... 19 more
Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
2022-10-21 11:47:11,847 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2022-10-21 11:47:11,900 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-10-21 11:47:11,963 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:122)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:146)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:480)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:67)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:142)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:97)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:132)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.quarkus.runtime.generated.Config
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:144)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
Caused by: java.lang.ExceptionInInitializerError
at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
... 6 more
Caused by: java.lang.IllegalStateException: io.smallrye.config.ConfigValidationException: Configuration validation failed:
java.util.NoSuchElementException: SRCFG00014: The config property Config.enabled is required but it could not be found in any config source
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:453)
at io.quarkus.runtime.generated.Config.<clinit>(Unknown Source)
... 18 more
Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
java.util.NoSuchElementException: SRCFG00014: The config property Config.enabled is required but it could not be found in any config source
at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:805)
at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:761)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:450)
... 19 more
Caused by: java.lang.IllegalStateException: io.smallrye.config.ConfigValidationException: Configuration validation failed:
Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
i'm unable to inject the data can anyone explain why i can't? or did i miss anything? or should i need to add these configs in build.gradle or somewhere else ? and also i want to declare an array of objects as
Config.details[0].name = "Sam"
Config.details[0].age = 12
Config.details[1].name = "Tim"
Config.details[1].age = "34"
but when i try to use them after injecting it throws empty list
please explain it :)

Documentation
1. Config Sources By default, Quarkus reads configuration properties from multiple sources (by descending ordinal):
(400) System properties
(300) Environment variables
(295) .env file in the current working directory
(260) Quarkus Application configuration file in
$PWD/config/application.properties
(250) Quarkus Application configuration file application.properties in
classpath
(100) MicroProfile Config configuration file
META-INF/microprofile-config.properties in classpath
The final configuration is the aggregation of the properties defined
by all these sources. A configuration property lookup starts by the
highest ordinal configuration source available and works it way down
to other sources until a match is found. This means that any
configuration property may override a value just by setting a
different value in a higher ordinal config source. For example, a
property configured using an environment property overrides the value
provided using the application.properties file.
gradle is used to build the project not to provide by default any properties to quarkus.
So pick one of the above destinations and there add your configuration properties which will be picked then from quarkus
For example you can add
myApplicationConfig.enabled = true
myApplicationConfig.details[0].name = "Sam"
myApplicationConfig.details[0].age = 12
myApplicationConfig.details[1].name = "Tim"
myApplicationConfig.details[1].age = "34"
in the file src/main/resources/application.properties.

Related

I tried to connect mysql8.0.32 to the spring boot project in eclipse after I tried to run spring boot main class but its showing some error

Application.properties file
spring.datasource.url=jdbc:mysql://localhost:3306/emp?useSSL=false
spring.datasource.username=root
spring.datasource.password=root
#hibernate properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBdialect
#create,create-drop
spring.hibernate.ddl-auto=update
springprojectmain.java
packagePcom.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class StringProject1Application {
public static void main(String[] args) {
SpringApplication.run(StringProject1Application.class, args);
}
}
I got below error:
org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.MySQL5InnoDBdialect] as strategy [org.hibernate.dialect.Dialect]
at org.hibernate.boot.registry.selector
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.dialect.MySQL5InnoDBdialect]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:123) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:151) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
... 39 common frames omitted
Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.MySQL5InnoDBdialect
at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:210) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Class.java:467) ~[na:na]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:120) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
... 40 common frames omitted
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.4.jar:6.0.4]
at org.springframework.beans.factory.
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
at org.hibernate.service.
I tried to connect mysql8.0.32 to the spring boot project in eclipse after I tried to run spring boot main class but its showing some error in application properties file at spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBdialect.
In the following line:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBdialect
Replace MySQL5InnoDBdialect with MySQL5Dialect.

Quarkus #Inject settings from application.properties in #WebFilter

I'm trying to #Inject some settings from application.properties in #WebFilter, but it doesn't seem to work:
Caused by: javax.servlet.ServletException: UT010013: Could not instantiate com.foo.www.PageFilter
at io.undertow.servlet.core.ManagedFilter.createFilter(ManagedFilter.java:77)
at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:591)
at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:556)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:566)
at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:598)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:517)
... 18 more
Caused by: java.lang.RuntimeException: Error injecting com.foo.config.GlobalConfig com.foo.www.PageFilter.globalConfig
at com.foo.www.PageFilter_Bean.create(Unknown Source)
at com.foo.www.PageFilter_Bean.get(Unknown Source)
at com.foo.www.PageFilter_Bean.get(Unknown Source)
The config itself is as follows:
#ConfigMapping(prefix = "global")
public interface GlobalConfig {
List<String> domains();
}
Any workaround?

Integration test of spring stream failed after update to Greenwich

I just upgraded spring boot to 2.1.0.RELEASE and spring cloud stream to Greenwich.SR1.
I have an integration test which autowires MessageCollector, but the context fails to load because there is already a binder created in KafkaBinderConfiguration.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.test.binder.MessageCollector]: Factory method 'messageCollector' threw exception; nested exception is java.lang.ClassCastException: org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder cannot be cast to org.springframework.cloud.stream.test.binder.TestSupportBinder
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620)
... 44 more
Caused by: java.lang.ClassCastException: org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder cannot be cast to org.springframework.cloud.stream.test.binder.TestSupportBinder
at org.springframework.cloud.stream.test.binder.MessageCollectorAutoConfiguration.messageCollector(MessageCollectorAutoConfiguration.java:35)
at org.springframework.cloud.stream.test.binder.MessageCollectorAutoConfiguration$$EnhancerBySpringCGLIB$$7750c59.CGLIB$messageCollector$0(<generated>)
at org.springframework.cloud.stream.test.binder.MessageCollectorAutoConfiguration$$EnhancerBySpringCGLIB$$7750c59$$FastClassBySpringCGLIB$$6fd994de.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at org.springframework.cloud.stream.test.binder.MessageCollectorAutoConfiguration$$EnhancerBySpringCGLIB$$7750c59.messageCollector(<generated>)
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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 45 more
There's TestSupportBinderConfiguration class which creates a test binder bean, but it's not happening because of its signature:
#Configuration
#ConditionalOnMissingBean(Binder.class)
public class TestSupportBinderConfiguration {}
Any ideas?

Websphere Liberty ClassNotFoundException: org.apache.myfaces.renderkit.MyfacesResponseStateManager

I am running a JSF 2.2 application in Websphere Liberty 16.0.0.4.
Its using Myfaces 2.2 implementation of JSF, bundled in com.ibm.ws.jsf.2.2_1.0.15.jar . I am getting ClassNotFoundException for org.apache.myfaces.renderkit.MyfacesResponseStateManager .
The same JSF page works fine in WAS 9 Classic, which also uses Myfaces 2.2.
Any help will be most welcome. Please see the stack trace below.
Thanks, Sanjay
[9/28/17 14:53:57:669 EDT] 0000002a id= org.apache.myfaces.shared.util.ClassUtils
E null java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:670)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:542)
at org.apache.myfaces.config.FacesConfigurator.configureRenderKits(FacesConfigurator.java:1317)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:607)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:421)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:177)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2420)
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.notifyServletContextCreated(WebApp31.java:505)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1064)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6562)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1004)
at com.ibm.ws.webcontainer.osgi.WebContainer.startModule(WebContainer.java:825)
at com.ibm.ws.app.manager.module.internal.ModuleHandlerBase.deployModule(ModuleHandlerBase.java:100)
at com.ibm.ws.app.manager.module.internal.DeployedModuleInfoImpl.installModule(DeployedModuleInfoImpl.java:50)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:420)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:406)
at com.ibm.ws.app.manager.ear.internal.EARApplicationHandlerImpl.install(EARApplicationHandlerImpl.java:84)
at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:141)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1191)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:804)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: java.lang.IllegalStateException: Could not initialize MyFacesFlowResponseStateManager
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:58)
at org.springframework.faces.webflow.FlowRenderKit.<init>(FlowRenderKit.java:43)
... 31 more
Caused by: java.lang.NoClassDefFoundError: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:335)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:310)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:53)
... 32 more
Caused by: java.lang.ClassNotFoundException: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:294)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
... 43 more
[9/28/17 14:53:57:676 EDT] 0000002a id= org.apache.myfaces.webapp.AbstractFacesInitializer E An error occured while initializing MyFaces: java.lang.reflect.InvocationTargetException
javax.faces.FacesException: java.lang.reflect.InvocationTargetException
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:697)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:542)
at org.apache.myfaces.config.FacesConfigurator.configureRenderKits(FacesConfigurator.java:1317)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:607)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:421)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:177)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2420)
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.notifyServletContextCreated(WebApp31.java:505)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1064)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6562)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1004)
at com.ibm.ws.webcontainer.osgi.WebContainer.startModule(WebContainer.java:825)
at com.ibm.ws.app.manager.module.internal.ModuleHandlerBase.deployModule(ModuleHandlerBase.java:100)
at com.ibm.ws.app.manager.module.internal.DeployedModuleInfoImpl.installModule(DeployedModuleInfoImpl.java:50)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:420)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:406)
at com.ibm.ws.app.manager.ear.internal.EARApplicationHandlerImpl.install(EARApplicationHandlerImpl.java:84)
at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:141)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1191)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:804)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:670)
... 26 more
Caused by: java.lang.IllegalStateException: Could not initialize MyFacesFlowResponseStateManager
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:58)
at org.springframework.faces.webflow.FlowRenderKit.<init>(FlowRenderKit.java:43)
... 31 more
Caused by: java.lang.NoClassDefFoundError: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:335)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:310)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:53)
... 32 more
Caused by: java.lang.ClassNotFoundException: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:294)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
... 43 more
The jsf-2.2 Liberty feature doesn't expose the MyFaces implementation classes, whereas WebSphere Traditional profile (classic) allows access to those internal classes. In your scenario the Spring class org.springframework.faces.webflow.FlowRenderKit is trying to load the internal class org.apache.myfaces.renderkit.MyfacesResponseStateManager via ClassUtils.forName, which won't work on Liberty and isn't a good practice in general.
If you don't need CDI integration with your application, bundling MyFaces directly - instead of using the Liberty jsf-2.2 feature - should allow this scenario to work.
It may be worthwhile to raise an issue on Spring's issue tracker
Related answer: MyFaces and WebSphere Liberty Profile (ClassNotFoundException)

Hadoop:Cascading FlowException

I Installed hadoop 1.0.4 and hive 0.12.When i run the Cascading Pattern on this it Give Cascading flow exception. when i run with following hadoop command
hadoop jar bulid/libs/pattern-example*.jar
i am getting above mention exception,for reference i include Cascading Code.
Tap inputTap = new Hfs(new TextDelimited(true, "\t"),
"hdfs://hdmaster:54310/user/hive/warehouse/temp/Dataformated/finalformated");
String classifyPath=Output Path;
hdfsPath = classifyPath/pmml File Name;
Tap classifyTap = new Hfs(new TextDelimited(true, "\t"),
classifyPath/pmml File Name));
String formatLocalHdfsData = classifyPath/PMML FILE NAME);
FlowDef flowDef = FlowDef.flowDef().setName("classify")
.addSource("input", inputTap)// input is LFs or HFS
.addSink("classify", classifyTap);
flowDef.addAssemblyPlanner(pmmlPlanner);
Flow classifyFlow = flowConnector.connect(flowDef);
classifyFlow.writeDOT("dot/classify.dot");
classifyFlow.complete();
Cascading Flow Exception
Exception in thread "main" cascading.flow.FlowException: step failed: (1/1) ...eg_Nocoerce20150513093050, with job id: job_201505130921_0003, please see cluster logs for failure messages
at cascading.flow.planner.FlowStepJob.blockOnJob(FlowStepJob.java:221)
at cascading.flow.planner.FlowStepJob.start(FlowStepJob.java:149)
at cascading.flow.planner.FlowStepJob.call(FlowStepJob.java:124)
at cascading.flow.planner.FlowStepJob.call(FlowStepJob.java:43)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Log File Exceprtion
java.lang.RuntimeException: Error in configuring object
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:432)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.mapred.Child.main(Child.java:249)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
... 9 more
Caused by: cascading.flow.FlowException: internal error during mapper configuration
at cascading.flow.hadoop.FlowMapper.configure(FlowMapper.java:99)
... 14 more
Caused by: java.io.InvalidClassException: cascading.tap.hadoop.Hfs; local class incompatible: stream classdesc serialVersionUID = -2723557385578774808, local class serialVersionUID = -4246440312226820384
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:560)
Please Help Me to solve this Issue.
I resolve the issue. In log file I was getting serialVersionID compatibility issue. Generate the new SerialVersionID and it worked.

Resources