问:
java.lang.IncompatibleClassChangeError: Implementing class on weblogic 10.3.6 with spring saml2
I am getting a following error when trying to deploy my application to weblogic 10.3.6 server. It appears after I add spring-security-saml2-core dependency. Note that it works locally on tomcat. Java 1.6 is required.

Another thing worth mentioning is that the app used to deploy without problems with the current POM before some changes to some classes. However, after commenting the changed classes problem still persists.

```weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1531)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:488)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused By: java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
    at java.lang.Class.getDeclaredMethods(Class.java:1868)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1007)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:168)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanType(BeanTypeRegistry.java:157)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.updateTypesIfNecessary(BeanTypeRegistry.java:207)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:114)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:185)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:171)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:139)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:110)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1871)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3173)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1529)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:488)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
>
####<Jul 7, 2017 10:32:21 AM CEST> <Error> <Console> <myhost## Heading ##> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d9874ae9727daa67:7e0ff4a0:15d1be0088c:-8000-00000000000000bb> <1499416341950> <BEA-240003> <Console encountered the following error weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1531)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:488)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
    at java.lang.Class.getDeclaredMethods(Class.java:1868)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1007)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:168)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanType(BeanTypeRegistry.java:157)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.updateTypesIfNecessary(BeanTypeRegistry.java:207)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:114)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:185)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:171)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:139)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:110)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1871)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3173)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1529)
>
```

<p>my POM dependencies:</p>

```<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
</parent>
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.6.7</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.6.7</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.6.7</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security.extensions</groupId>
            <artifactId>spring-security-saml2-core</artifactId>
            <version>1.0.2.RELEASE</version>
        </dependency>

    </dependencies>
```

答:
This looks a duplicated question: What causes java.lang.IncompatibleClassChangeError?

I try using the tools mentioned in that question for checking backward compatibility with your libraries.

Body:
I am getting a following error when trying to deploy my application to weblogic 10.3.6 server. It appears after I add spring-security-saml2-core dependency. Note that it works locally on tomcat. Java 1.6 is required.

Another thing worth mentioning is that the app used to deploy without problems with the current POM before some changes to some classes. However, after commenting the changed classes problem still persists.

weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1531)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:488)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused By: java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
    at java.lang.Class.getDeclaredMethods(Class.java:1868)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1007)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:168)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanType(BeanTypeRegistry.java:157)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.updateTypesIfNecessary(BeanTypeRegistry.java:207)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:114)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:185)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:171)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:139)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:110)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1871)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3173)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1529)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:488)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
>
####<Jul 7, 2017 10:32:21 AM CEST> <Error> <Console> <myhost## Heading ##> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d9874ae9727daa67:7e0ff4a0:15d1be0088c:-8000-00000000000000bb> <1499416341950> <BEA-240003> <Console encountered the following error weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1531)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:488)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
    at java.lang.Class.getDeclaredMethods(Class.java:1868)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1007)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:168)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanType(BeanTypeRegistry.java:157)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.updateTypesIfNecessary(BeanTypeRegistry.java:207)
    at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:114)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:185)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:171)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:139)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:110)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1871)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3173)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1529)
>

my POM dependencies:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
</parent>
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.6.7</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.6.7</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.6.7</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security.extensions</groupId>
            <artifactId>spring-security-saml2-core</artifactId>
            <version>1.0.2.RELEASE</version>
        </dependency>

    </dependencies>


来源: stackexchange

问:
Is it possible to take input from a file in NotesSQL
For example I have to run a query to fetch data for a list of part numbers.

The list is very big say 1000. So I do not want to give all the part numbers in the query instead want to take it from a file say .txt or .xls

Is It possible with Notes SQL?

答: You have it all backwards.  NotesSQL lets you query (pull data out of) a Notes database (.nsf) using ODBC.  That way any software that can connect via ODBC has access to Notes data.  It doesn't allow importing data into Notes.  To get the data into Notes you'll need to either write a script or use something like IBM Enterprise Integrator (IEI, formerly LEI, formerly formerly Notes Pump.)</p>

ContentLicense: CC BY-SA 3.0


问:
GAE multi modules (services) and working directory
By following instruction from:
Create Google App Engine Project in Eclipse with Modules

I'm able create 1 Enterprise app and 2 associated dynamic web app (default and task).  They work fine but every time running the local server (using Google plugin for Eclipse), console always display below error:

```<code>WARNING: Your working directory, (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject) is not equal to your
web application root (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_default.war)
...
WARNING: Your working directory, (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject) is not equal to your
web application root (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_tasks.war)
You will not be able to access files from your working directory on the production server.
</code>```

Understand that it complain the working folder (which is belong to Enterprise App) is not same for both web root.

If I change the argument for working folder to root folder for default web app:
D:\Workspaces\GAE\MyProject.metadata.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_default.war

First warning is no longer display but it still display second warning.

And I don't think that is right to change the working folder to default web app root folder.

In summary, because of multi modules, I have 2 root folders but only can set one working folder in argument.  Is that a way to solve this problem?

Thanks

Rgds
SJ

答:
App Engine modules have been renamed to services, in large part (I suspect) to avoid confusion with web modules.  A limitation of the local development app server is that it hosts services within a single process, and a process can only have a single working directory.

This limitation only affects accessing files directly (e.g., new File("path/to/my/file")).  But there are better ways to access files from within a servlet.

Body:
By following instruction from:
Create Google App Engine Project in Eclipse with Modules

I'm able create 1 Enterprise app and 2 associated dynamic web app (default and task).  They work fine but every time running the local server (using Google plugin for Eclipse), console always display below error:

WARNING: Your working directory, (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject) is not equal to your
web application root (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_default.war)
...
WARNING: Your working directory, (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject) is not equal to your
web application root (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_tasks.war)
You will not be able to access files from your working directory on the production server.

Understand that it complain the working folder (which is belong to Enterprise App) is not same for both web root.

If I change the argument for working folder to root folder for default web app:
D:\Workspaces\GAE\MyProject.metadata.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_default.war

First warning is no longer display but it still display second warning.

And I don't think that is right to change the working folder to default web app root folder.

In summary, because of multi modules, I have 2 root folders but only can set one working folder in argument.  Is that a way to solve this problem?

Thanks

Rgds
SJ


问:
image onLoad function on IPAD javascript
Hello
I am trying to write a simple javascript function that zooms images with javascript and using this on Ipad. But it seems that, when the new zoomed size is more that 2000px Ipad doesn't fire the onload event of the image tag. Here is my code:

```<code>img2 = new Image(sImg.outerWidth()*zoomSize,sImg.outerHeight()*zoomSize);
img2.src = sImg.attr('href');
img2.onload=function () {
        alert('zoom done');
};
</code>```

onload event is not fired when sImg.outerWidth()*zoomSize>2000? Is this a ipad safari bug?

答:
```<code>    img2 = new Image();
img2.src = sImg.attr('href'); img2.onload=function () {
            sImg.outerWidth()*zoomSize,sImg.outerHeight()*zoomSize
            alert('zoom done'); };
</code>```

ContentLicense: CC BY-SA 2.5

Body:
Hello
I am trying to write a simple javascript function that zooms images with javascript and using this on Ipad. But it seems that, when the new zoomed size is more that 2000px Ipad doesn't fire the onload event of the image tag. Here is my code:

img2 = new Image(sImg.outerWidth()*zoomSize,sImg.outerHeight()*zoomSize);
img2.src = sImg.attr('href');
img2.onload=function () {
        alert('zoom done');
};

onload event is not fired when sImg.outerWidth()*zoomSize>2000? Is this a ipad safari bug?


问:
Exog variable with not appropriated shape on Statsmodels SARIMAX get_prediction
I have a very simple Sarimax model using statsmodels:

```<code>mdl = sm.tsa.statespace.SARIMAX(ts_monthly, exog=ts_exog, order=(3,1,0)).fit()
</code>```

where ts_monthly and ts_exog are pandas series indexed by date:

```<code>df
date          vl_1    vl_2
2016-01-01     10     12
2016-02-01     14      1
2016-03-01     98     33

ts_monthly = df.vl_1
ts_exog    = df.vl_2
</code>```

The model fit works, but when I try to run a get_prediction, I get the following error:

```<code>ts = pd.Series([12,3,2], index=pd.date_range('2016-04-01', '2016-07-01', freq='M'))

mdl.get_prediction('2016-03-01', '2016-07-01', exog=ts, dynamic=False)

    ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-135-c89e9e005a31> in <module>()
      6 print(mdl.summary())
      7 _ = mdl.plot_diagnostics()
----> 8 pred = mdl.get_prediction(start=start_date, end=end_date, exog=ts_exog, dynamic=False)
      9 pred_ci = pred.conf_int()
     10

C:\Users\myuer\bin\anaconda3\lib\site-packages\statsmodels\tsa\statespace\sarimax.py in get_prediction(self, start, end, dynamic, exog, **kwargs)
   1901                                      ' appropriate shape. Required %s, got %s.'
   1902                                      % (str(required_exog_shape),
-> 1903                                         str(exog.shape)))
   1904                 exog = np.c_[self.model.data.orig_exog.T, exog.T].T
   1905

ValueError: Provided exogenous values are not of the appropriate shape. Required (3, 1), got (3,).
</code>```

Any ideas of what kind of shape the prediction exogenous series must be?

答:
This answer may be helpful.

While your prediction series is in a pandas Series (and is therefore a numpy ndarray), the shape (3,) indicates that it only has one index (i.e. you access its values with a single index, as in ts[0]). If you reshape your data with ts.reshape(3, 1) you create a second index (which will always be 0) so that values can be accessed in the manner ts[0, 0].

I haven't dug into this behavior enough to understand its rationale, but I've seen it also in dealing with dependency/related modules such as scipy and scikit-learn.

Body:
I have a very simple Sarimax model using statsmodels:

mdl = sm.tsa.statespace.SARIMAX(ts_monthly, exog=ts_exog, order=(3,1,0)).fit()

where ts_monthly and ts_exog are pandas series indexed by date:

df
date          vl_1    vl_2
2016-01-01     10     12
2016-02-01     14      1
2016-03-01     98     33

ts_monthly = df.vl_1
ts_exog    = df.vl_2

The model fit works, but when I try to run a get_prediction, I get the following error:

ts = pd.Series([12,3,2], index=pd.date_range('2016-04-01', '2016-07-01', freq='M'))

mdl.get_prediction('2016-03-01', '2016-07-01', exog=ts, dynamic=False)

    ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-135-c89e9e005a31> in <module>()
      6 print(mdl.summary())
      7 _ = mdl.plot_diagnostics()
----> 8 pred = mdl.get_prediction(start=start_date, end=end_date, exog=ts_exog, dynamic=False)
      9 pred_ci = pred.conf_int()
     10

C:\Users\myuer\bin\anaconda3\lib\site-packages\statsmodels\tsa\statespace\sarimax.py in get_prediction(self, start, end, dynamic, exog, **kwargs)
   1901                                      ' appropriate shape. Required %s, got %s.'
   1902                                      % (str(required_exog_shape),
-> 1903                                         str(exog.shape)))
   1904                 exog = np.c_[self.model.data.orig_exog.T, exog.T].T
   1905

ValueError: Provided exogenous values are not of the appropriate shape. Required (3, 1), got (3,).

Any ideas of what kind of shape the prediction exogenous series must be?


问:
Service Work and Push Notifications
I am currently trying to implement Push Notifications into my website and I am having trouble trying to display a dynamic title and link.

This is what my service worker currently looks like

```<code>self.addEventListener( 'push', function(event) {
    // console.log( '[Service Worker] Push Received.' );
    // console.log( '[Service Worker] Push has this data: ' );

    const title = event.data.title;
    const options = {
        body: event.data.text(),
    }

    const notificationPromise = self.registration.showNotification(title, options);
    event.waitUntil(notificationPromise);
} );

self.addEventListener( 'notificationclick', function( event ) {
    console.log( '[Service Worker] Notification click Received.' );

    event.notification.close();

    event.waitUntil(
        clients.openWindow( 'https://developers.google.com' )
    );
} )
</code>```

As you can see currently the link is a hard-coded developers.google.com link and the title returns 'undefined'

Is there anything I have to do from the backend of the website to send these into the payload?

In case it helps I am using the Web Push Library for C#

答:
I believe this is actually an issue with how you're accessing the title data from the json object.

To access the event.data object as a json object, you have to call the json() method on the data object. So something like this:

```<code>const title = event.data.json().title;
</code>```

Title: Service Work and Push Notifications

Body:
I am currently trying to implement Push Notifications into my website and I am having trouble trying to display a dynamic title and link.

This is what my service worker currently looks like

self.addEventListener( 'push', function(event) {
    // console.log( '[Service Worker] Push Received.' );
    // console.log( '[Service Worker] Push has this data: ' );

    const title = event.data.title;
    const options = {
        body: event.data.text(),
    }

    const notificationPromise = self.registration.showNotification(title, options);
    event.waitUntil(notificationPromise);
} );

self.addEventListener( 'notificationclick', function( event ) {
    console.log( '[Service Worker] Notification click Received.' );

    event.notification.close();

    event.waitUntil(
        clients.openWindow( 'https://developers.google.com' )
    );
} )

As you can see currently the link is a hard-coded developers.google.com link and the title returns 'undefined'

Is there anything I have to do from the backend of the website to send these into the payload?

In case it helps I am using the Web Push Library for C#

Body:
I believe this is actually an issue with how you're accessing the title data from the json object.

To access the event.data object as a json object, you have to call the json() method on the data object. So something like this:

const title = event.data.json().title;


问:
How to assign a method to a button when pressed or released with ActionListener in Java?
I am new to coding GUIs in Java and I am trying to just print a message on the terminal when a button is pressed and another one when it is released.

This is what I have for a regular button pressing.

```<code> leftButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            System.out.println("Pressed");
        }
    });
</code>```

I did this with the help of IntelliJ IDEA. I want to make the button send a message when pressed and a different thing when released.

答:
You can just add a simple MouseAdapter, like this:

```<code>MouseAdapter ma = new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
        System.out.println("Pressed");
    }
    public void mouseReleased(MouseEvent e) {
        System.out.println("Released");
    }
};
leftButton.addMouseListener(ma);
frame.add(button);
</code>```

This will detect when it is the mouse is pressed on the button or released on the button.

If you want, you can also add a mouseClicked() method, mouseExited(), mouseEntered(), mouseMoved(), and (many) more methods in your MouseAdapter. Check out this JavaDoc

Body:
I am new to coding GUIs in Java and I am trying to just print a message on the terminal when a button is pressed and another one when it is released.

This is what I have for a regular button pressing.

 leftButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            System.out.println("Pressed");
        }
    });

I did this with the help of IntelliJ IDEA. I want to make the button send a message when pressed and a different thing when released.

Body:
You can just add a simple MouseAdapter, like this:

MouseAdapter ma = new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
        System.out.println("Pressed");
    }
    public void mouseReleased(MouseEvent e) {
        System.out.println("Released");
    }
};
leftButton.addMouseListener(ma);
frame.add(button);

This will detect when it is the mouse is pressed on the button or released on the button.

If you want, you can also add a mouseClicked() method, mouseExited(), mouseEntered(), mouseMoved(), and (many) more methods in your MouseAdapter. Check out this JavaDoc


问:
Ignore parent divs width
I have had issues with modify a navigation bar for mobile. I want the navigation bar to ignore its parent div inner-wrapper width of 80% and use a full width of 100%.

The most logical solution I can think of is to set header: relative, width: 100% and header li to absolute with a width of 100%. However, this doesn't seem to work.

I want each navigation to have a full width of the screen rather than a full width of its parent wrapper.

.header {
  background-color: #FFB6C1;
  color: black;
  overflow: hidden;
  position: relative;
}

.inner-wrapper {
  width: 80%;
  margin: 0 auto;
  margin-top: 30px;
  margin-bottom: 20px;
}

.header h2 {
  float: left;
  font-family: 'Pacifico', sans-serif;
  font-size: 30px;
}

.header h3 {
  padding-top: 5px;
  font-family: 'Petit Formal Script';
  clear: both;
  font-weight: 700;
}

.header span {
  font-weight: bolder;
}

.header ul {
  float: right;
  margin-right: 10%
}

.header ul li {
  list-style: none;
  display: inline-block;
  font-family: 'Podkova', sans-serif;
  margin-right: 20px;
  font-weight: bold;
}
/* Navigation Menu click for mobile */

.mobile-menu {
  padding: 0;
  margin: 0;
  display: none;
}
/* Smartphones (portrait) ----------- */

@media only screen and (max-width: 414px) {
  /* Styles */
  /* Display flex to change the ordering of HTML elemtns*/
  .inner-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 0px;
  }
  .header-title {
    order: 1;
  }
  .header-description {
    order: 2;
  }
  .dropdown {
    order: 3;
  }
  .header-li {
    display: none;
    position: absolute;
    width: 100%;
  }
  .header ul {
    float: none;
    margin-right: 0%;
  }
  .mobile-menu {
    padding: 0;
    margin: 0;
    display: initial;
    cursor: pointer;
  }
  .header ul li {
    width: 100%;
    background-color: green;
    padding-top: 20px;
  }
  .header {
    position: relative;
    width: 100%;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!-- Header and Navigation -->
<div class="header">
  <div class="inner-wrapper">
    <h2 class="header-title">text</h2>
    <div class="dropdown">
      <div class="mobile-menu">
        <p align="right">Menu</p>
      </div>
      <ul class="header-li">
        <li>About me</li>
        <li>Progress</li>
        <li>Food</li>
        <li>Contact</li>
      </ul>
    </div>
    <h3 class="header-description">text</span></h3>
  </div>
</div></code>```

答:
How's this James?

.theContainer {
  width: 200px;
  height: 200px;
  background-color: gray;
  position: relative;
}

.theParent {
  width: 80%;
  height: 150px;
  background-color: lightgray;
}

.theChild {
  width: 100%;
  background-color: lightgreen;
  position: absolute;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="theContainer">
  <div class="theParent">
    This is the parent trying to restrict the child to 80% width.
    <div class="theChild">
      This is the child with 100% width ignoring parent.
    </div>
  </div>
</div></code>```

Title: Ignore parent divs width

Body:
I have had issues with modify a navigation bar for mobile. I want the navigation bar to ignore its parent div inner-wrapper width of 80% and use a full width of 100%.

The most logical solution I can think of is to set header: relative, width: 100% and header li to absolute with a width of 100%. However, this doesn't seem to work.

I want each navigation to have a full width of the screen rather than a full width of its parent wrapper.

.header {
  background-color: #FFB6C1;
  color: black;
  overflow: hidden;
  position: relative;
}

.inner-wrapper {
  width: 80%;
  margin: 0 auto;
  margin-top: 30px;
  margin-bottom: 20px;
}

.header h2 {
  float: left;
  font-family: 'Pacifico', sans-serif;
  font-size: 30px;
}

.header h3 {
  padding-top: 5px;
  font-family: 'Petit Formal Script';
  clear: both;
  font-weight: 700;
}

.header span {
  font-weight: bolder;
}

.header ul {
  float: right;
  margin-right: 10%
}

.header ul li {
  list-style: none;
  display: inline-block;
  font-family: 'Podkova', sans-serif;
  margin-right: 20px;
  font-weight: bold;
}
/* Navigation Menu click for mobile */

.mobile-menu {
  padding: 0;
  margin: 0;
  display: none;
}
/* Smartphones (portrait) ----------- */

@media only screen and (max-width: 414px) {
  /* Styles */
  /* Display flex to change the ordering of HTML elemtns*/
  .inner-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 0px;
  }
  .header-title {
    order: 1;
  }
  .header-description {
    order: 2;
  }
  .dropdown {
    order: 3;
  }
  .header-li {
    display: none;
    position: absolute;
    width: 100%;
  }
  .header ul {
    float: none;
    margin-right: 0%;
  }
  .mobile-menu {
    padding: 0;
    margin: 0;
    display: initial;
    cursor: pointer;
  }
  .header ul li {
    width: 100%;
    background-color: green;
    padding-top: 20px;
  }
  .header {
    position: relative;
    width: 100%;
  }
}

text

Menu

About me

Progress

Food

Contact

text

Body:
How's this James?

.theContainer {
  width: 200px;
  height: 200px;
  background-color: gray;
  position: relative;
}

.theParent {
  width: 80%;
  height: 150px;
  background-color: lightgray;
}

.theChild {
  width: 100%;
  background-color: lightgreen;
  position: absolute;
}

<div class="theContainer">
  <div class="theParent">
    This is the parent trying to restrict the child to 80% width.
    <div class="theChild">
      This is the child with 100% width ignoring parent.
    </div>
  </div>
</div>


问:
Getting CertPathValidatorException when accesing a secure webservice with Retrofit 2
I have an Android application that accesses a secure webservice with no problem. It uses my own class, which extends Apache DefaultClientHttp.

```<code>class CustomHttpClient extends DefaultHttpClient {

    private final String alias;
    private final X509Certificate[] certificates;
    private final PrivateKey privateKey;

    public CustomHttpClient(String alias, X509Certificate[] certificates, PrivateKey privateKey) {
        this.alias = alias;
        this.certificates = certificates;
        this.privateKey = privateKey;
    }

    @Override
    protected ClientConnectionManager createClientConnectionManager() {
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schemeRegistry.register(new Scheme("https", newSslSocketFactory(), 443));
        return new SingleClientConnManager(getParams(), schemeRegistry);
    }

    private SSLSocketFactory newSslSocketFactory() {
        try {
            KeyStore trusted = KeyStore.getInstance("pkcs12");
            trusted.load(null);
            if (this.alias != null) {
                trusted.setKeyEntry(this.alias, privateKey, Constants.KEYSTORE_PASS.toCharArray(), this.certificates);
            }

            SSLSocketFactory socketFactory = new SSLSocketFactory(trusted, Constants.KEYSTORE_PASS);
            socketFactory.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
            return socketFactory;
        } catch (Exception ex) {
            throw new AssertionError(ex);
        }
    }

}
</code>```

Alias, certificates and privateKey are obtained from KeyChain (I don't want to incorporate the certificates in the application as raw files). The application works properly, but now I want to refactor the Http client and use Retrofit2. This is my new class using OkHttpClient.

```<code>public class SslOkHttpClient {

private static final String LOGGER = SslOkHttpClient.class.getName();
private static String alias;
private static Key privateKey;
private static X509Certificate[] certificates;
private static String KEYSTORE_PASS = "password";

public static OkHttpClient getOkHttpClient(Context context) throws GeneralSecurityException, IOException, IllegalStateException {
    if (alias == null)
        alias = HttpsUtils.getAlias(context);
    if (privateKey == null)
        privateKey = HttpsUtils.getPrivateKey(context, alias);
    if (certificates == null)
        certificates = HttpsUtils.getCertificateChain(context, alias);

    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

    ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
            .tlsVersions(TlsVersion.TLS_1_2)
            .build();

    KeyStore ks = getKeystore();

    OkHttpClient client = new OkHttpClient.Builder()
            .sslSocketFactory(getSslSocketFactory(ks), (X509TrustManager) getTrustManager(ks)[0])
            .connectionSpecs(Collections.singletonList(spec))
            .addInterceptor(interceptor)
            .build();
    return client;
}

private static SSLSocketFactory getSslSocketFactory(KeyStore keystore) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, KeyManagementException, IllegalStateException, NoSuchProviderException {
    SSLContext sslContext;

    sslContext = SSLContext.getInstance("TLS");
    sslContext.init(null, getTrustManager(keystore), null);
    return sslContext.getSocketFactory();
}

private static TrustManager[] getTrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, IllegalStateException, NoSuchProviderException {
    TrustManager[] trustManagers;
    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
    trustManagerFactory.init(keystore);

    trustManagers = trustManagerFactory.getTrustManagers();

    if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
        throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
    }

    return trustManagers;
}

private static KeyStore getKeystore() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, NoSuchProviderException {
    KeyStore keystore = KeyStore.getInstance("PKCS12");
    keystore.load(null, null);
    if (alias != null) {
        keystore.setKeyEntry(alias, privateKey, KEYSTORE_PASS.toCharArray(), certificates);
    }

    return keystore;
}
}
</code>```

I use the new secure client like this:

```<code>private static ServiceData service;

public static ServiceAtestado getInstance(Context context) throws GeneralSecurityException, IOException, IllegalStateException {
    if (service == null) {

        Retrofit.Builder builder = new Retrofit.Builder()
                .baseUrl(Constants.URL);

        Retrofit retrofit = builder
                .addConverterFactory(GsonConverterFactory.create())
                .client(SslOkHttpClient.getOkHttpClient(context))
                .build();

        service = retrofit.create(ServiceData.class);
    }

    return service;
}
</code>```

Although both the private certificate and the CA certificate are the same I am currently using, every time I try to access a resource in the webservice I get the following exception:

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

I think the problem has nothing to do with the certificate itself because I can access the webservice from the device's browser using it, so I think the problem is the configuration of Retrofit2. I've read a lot of tutorials and articles about configuring it for using SSLSocketFactory so I think I'm doing it right, but obviously I'm not.

What am I doing wrong? I'd appreciate any helping hand.

答:
After a few days struggling with this, I eventually realized that the old code (the one that works) isn't exactly the same the one I'm trying to make with Retrofit 2. That one doesn't use a custom trust manager, but the system's default.
For whom might be interested (including myself in the future ;-)), here you are the final, simplified working class.

```<code>public class SslOkHttpClient {

private static final String LOGGER = SslOkHttpClient.class.getName();
private static String alias;
private static Key privateKey;
private static X509Certificate[] certificates;
private static String KEYSTORE_PASS = "secret";

  public static OkHttpClient getOkHttpClient(Context context) throws GeneralSecurityException, IOException, IllegalStateException {
        if (alias == null)
            alias = HttpsUtils.getAlias(context);
        if (privateKey == null)
            privateKey = HttpsUtils.getPrivateKey(context, alias);
        if (certificates == null)
            certificates = HttpsUtils.getCertificateChain(context, alias);

        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient client = new OkHttpClient.Builder()
                .sslSocketFactory(getSslSocketFactory(), getAllTrustManager())
                .readTimeout(10, TimeUnit.SECONDS)
                .connectTimeout(10, TimeUnit.SECONDS)
                .addInterceptor(interceptor)
                .hostnameVerifier(new HostnameVerifier() {
                    @Override
                    public boolean verify(String hostname, SSLSession session) {
                        return true;
                    }
                })
                .build();
        return client;
    }

    private static SSLSocketFactory getSslSocketFactory() throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, KeyManagementException, IllegalStateException, NoSuchProviderException, UnrecoverableKeyException {
        SSLContext sslContext;

        sslContext = SSLContext.getInstance("TLSv1.2");

        KeyStore keystore = KeyStore.getInstance("PKCS12");
        keystore.load(null, null);
        if (alias != null) {
            keystore.setKeyEntry(alias, privateKey, KEYSTORE_PASS.toCharArray(), certificates);
        }

        KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509");
        kmf.init(keystore, KEYSTORE_PASS.toCharArray());

        sslContext.init(kmf.getKeyManagers(), null, null);
        return sslContext.getSocketFactory();
    }

    private static X509TrustManager getAllTrustManager() throws KeyStoreException, NoSuchAlgorithmException {
        TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
        trustManagerFactory.init((KeyStore) null);
        TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
        if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
            throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
        }
        return (X509TrustManager) trustManagers[0];
    }

}
</code>```

HttpUtils is simply a utility class.

```<code>public class HttpsUtils {

private static final String KEYCHAIN_PREF_ALIAS = "alias";
private static final String KEYCHAIN_PREF = "keychain";
private static final int MODE_PRIVATE = 0;
private static final String DEFAULT_ALIAS = "";
private static final String LOGGER = HttpsUtils.class.getName();

private HttpsUtils() {

}

/**
 * This method returns the alias of the key chain from the application
 * preference
 *
 * @return The alias of the key chain
 */
public static String getAlias(Context context) {
    SharedPreferences pref = context.getSharedPreferences(KEYCHAIN_PREF, MODE_PRIVATE);
    return pref.getString(KEYCHAIN_PREF_ALIAS, DEFAULT_ALIAS);
}

/**
 * This method sets the alias of the key chain to the application preference
 */
public static void setAlias(Context context, String alias) {
    SharedPreferences pref = context.getSharedPreferences(KEYCHAIN_PREF, MODE_PRIVATE);
    SharedPreferences.Editor editor = pref.edit();
    editor.putString(KEYCHAIN_PREF_ALIAS, alias);
    editor.apply();
}

public static X509Certificate[] getCertificateChain(Context context, String alias) {
    try {
        return KeyChain.getCertificateChain(context, alias);
    } catch (KeyChainException | InterruptedException ex) {
        Log.e(LOGGER, ex.getMessage() == null ? context.getResources().getString(R.string.err_no_especificado) : ex.getMessage());
    }
    return null;
}

public static Key getPrivateKey(Context context, String alias) {
    try {
        return KeyChain.getPrivateKey(context, alias);
    } catch (KeyChainException | InterruptedException ex) {
        Log.e(LOGGER, ex.getMessage() == null ? context.getResources().getString(R.string.err_no_especificado) : ex.getMessage());
    }
    return null;
}
}
</code>```

Body:
I have an Android application that accesses a secure webservice with no problem. It uses my own class, which extends Apache DefaultClientHttp.

class CustomHttpClient extends DefaultHttpClient {

    private final String alias;
    private final X509Certificate[] certificates;
    private final PrivateKey privateKey;

    public CustomHttpClient(String alias, X509Certificate[] certificates, PrivateKey privateKey) {
        this.alias = alias;
        this.certificates = certificates;
        this.privateKey = privateKey;
    }

    @Override
    protected ClientConnectionManager createClientConnectionManager() {
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schemeRegistry.register(new Scheme("https", newSslSocketFactory(), 443));
        return new SingleClientConnManager(getParams(), schemeRegistry);
    }

    private SSLSocketFactory newSslSocketFactory() {
        try {
            KeyStore trusted = KeyStore.getInstance("pkcs12");
            trusted.load(null);
            if (this.alias != null) {
                trusted.setKeyEntry(this.alias, privateKey, Constants.KEYSTORE_PASS.toCharArray(), this.certificates);
            }

            SSLSocketFactory socketFactory = new SSLSocketFactory(trusted, Constants.KEYSTORE_PASS);
            socketFactory.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
            return socketFactory;
        } catch (Exception ex) {
            throw new AssertionError(ex);
        }
    }

}

Alias, certificates and privateKey are obtained from KeyChain (I don't want to incorporate the certificates in the application as raw files). The application works properly, but now I want to refactor the Http client and use Retrofit2. This is my new class using OkHttpClient.

public class SslOkHttpClient {

private static final String LOGGER = SslOkHttpClient.class.getName();
private static String alias;
private static Key privateKey;
private static X509Certificate[] certificates;
private static String KEYSTORE_PASS = "password";

public static OkHttpClient getOkHttpClient(Context context) throws GeneralSecurityException, IOException, IllegalStateException {
    if (alias == null)
        alias = HttpsUtils.getAlias(context);
    if (privateKey == null)
        privateKey = HttpsUtils.getPrivateKey(context, alias);
    if (certificates == null)
        certificates = HttpsUtils.getCertificateChain(context, alias);

    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

    ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
            .tlsVersions(TlsVersion.TLS_1_2)
            .build();

    KeyStore ks = getKeystore();

    OkHttpClient client = new OkHttpClient.Builder()
            .sslSocketFactory(getSslSocketFactory(ks), (X509TrustManager) getTrustManager(ks)[0])
            .connectionSpecs(Collections.singletonList(spec))
            .addInterceptor(interceptor)
            .build();
    return client;
}

private static SSLSocketFactory getSslSocketFactory(KeyStore keystore) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, KeyManagementException, IllegalStateException, NoSuchProviderException {
    SSLContext sslContext;

    sslContext = SSLContext.getInstance("TLS");
    sslContext.init(null, getTrustManager(keystore), null);
    return sslContext.getSocketFactory();
}

private static TrustManager[] getTrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, IllegalStateException, NoSuchProviderException {
    TrustManager[] trustManagers;
    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
    trustManagerFactory.init(keystore);

    trustManagers = trustManagerFactory.getTrustManagers();

    if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
        throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
    }

    return trustManagers;
}

private static KeyStore getKeystore() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, NoSuchProviderException {
    KeyStore keystore = KeyStore.getInstance("PKCS12");
    keystore.load(null, null);
    if (alias != null) {
        keystore.setKeyEntry(alias, privateKey, KEYSTORE_PASS.toCharArray(), certificates);
    }

    return keystore;
}
}

I use the new secure client like this:

private static ServiceData service;

public static ServiceAtestado getInstance(Context context) throws GeneralSecurityException, IOException, IllegalStateException {
    if (service == null) {

        Retrofit.Builder builder = new Retrofit.Builder()
                .baseUrl(Constants.URL);

        Retrofit retrofit = builder
                .addConverterFactory(GsonConverterFactory.create())
                .client(SslOkHttpClient.getOkHttpClient(context))
                .build();

        service = retrofit.create(ServiceData.class);
    }

    return service;
}

Although both the private certificate and the CA certificate are the same I am currently using, every time I try to access a resource in the webservice I get the following exception:

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

I think the problem has nothing to do with the certificate itself because I can access the webservice from the device's browser using it, so I think the problem is the configuration of Retrofit2. I've read a lot of tutorials and articles about configuring it for using SSLSocketFactory so I think I'm doing it right, but obviously I'm not.

What am I doing wrong? I'd appreciate any helping hand.

Body:
After a few days struggling with this, I eventually realized that the old code (the one that works) isn't exactly the same the one I'm trying to make with Retrofit 2. That one doesn't use a custom trust manager, but the system's default.
For whom might be interested (including myself in the future ;-)), here you are the final, simplified working class.

public class SslOkHttpClient {

private static final String LOGGER = SslOkHttpClient.class.getName();
private static String alias;
private static Key privateKey;
private static X509Certificate[] certificates;
private static String KEYSTORE_PASS = "secret";

  public static OkHttpClient getOkHttpClient(Context context) throws GeneralSecurityException, IOException, IllegalStateException {
        if (alias == null)
            alias = HttpsUtils.getAlias(context);
        if (privateKey == null)
            privateKey = HttpsUtils.getPrivateKey(context, alias);
        if (certificates == null)
            certificates = HttpsUtils.getCertificateChain(context, alias);

        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient client = new OkHttpClient.Builder()
                .sslSocketFactory(getSslSocketFactory(), getAllTrustManager())
                .readTimeout(10, TimeUnit.SECONDS)
                .connectTimeout(10, TimeUnit.SECONDS)
                .addInterceptor(interceptor)
                .hostnameVerifier(new HostnameVerifier() {
                    @Override
                    public boolean verify(String hostname, SSLSession session) {
                        return true;
                    }
                })
                .build();
        return client;
    }

    private static SSLSocketFactory getSslSocketFactory() throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, KeyManagementException, IllegalStateException, NoSuchProviderException, UnrecoverableKeyException {
        SSLContext sslContext;

        sslContext = SSLContext.getInstance("TLSv1.2");

        KeyStore keystore = KeyStore.getInstance("PKCS12");
        keystore.load(null, null);
        if (alias != null) {
            keystore.setKeyEntry(alias, privateKey, KEYSTORE_PASS.toCharArray(), certificates);
        }

        KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509");
        kmf.init(keystore, KEYSTORE_PASS.toCharArray());

        sslContext.init(kmf.getKeyManagers(), null, null);
        return sslContext.getSocketFactory();
    }

    private static X509TrustManager getAllTrustManager() throws KeyStoreException, NoSuchAlgorithmException {
        TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
        trustManagerFactory.init((KeyStore) null);
        TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
        if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
            throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
        }
        return (X509TrustManager) trustManagers[0];
    }

}

HttpUtils is simply a utility class.

public class HttpsUtils {

private static final String KEYCHAIN_PREF_ALIAS = "alias";
private static final String KEYCHAIN_PREF = "keychain";
private static final int MODE_PRIVATE = 0;
private static final String DEFAULT_ALIAS = "";
private static final String LOGGER = HttpsUtils.class.getName();

private HttpsUtils() {

}

/**
 * This method returns the alias of the key chain from the application
 * preference
 *
 * @return The alias of the key chain
 */
public static String getAlias(Context context) {
    SharedPreferences pref = context.getSharedPreferences(KEYCHAIN_PREF, MODE_PRIVATE);
    return pref.getString(KEYCHAIN_PREF_ALIAS, DEFAULT_ALIAS);
}

/**
 * This method sets the alias of the key chain to the application preference
 */
public static void setAlias(Context context, String alias) {
    SharedPreferences pref = context.getSharedPreferences(KEYCHAIN_PREF, MODE_PRIVATE);
    SharedPreferences.Editor editor = pref.edit();
    editor.putString(KEYCHAIN_PREF_ALIAS, alias);
    editor.apply();
}

public static X509Certificate[] getCertificateChain(Context context, String alias) {
    try {
        return KeyChain.getCertificateChain(context, alias);
    } catch (KeyChainException | InterruptedException ex) {
        Log.e(LOGGER, ex.getMessage() == null ? context.getResources().getString(R.string.err_no_especificado) : ex.getMessage());
    }
    return null;
}

public static Key getPrivateKey(Context context, String alias) {
    try {
        return KeyChain.getPrivateKey(context, alias);
    } catch (KeyChainException | InterruptedException ex) {
        Log.e(LOGGER, ex.getMessage() == null ? context.getResources().getString(R.string.err_no_especificado) : ex.getMessage());
    }
    return null;
}
}


问:
reactjs how to minimize or manage controlled input code
I am using reactjs controlled input

reference for below code

```<code><input type="text"
       value={this.state.username}
       onChange={(e) => this.setState({ username: e.target.value })}
       />
</code>```

I want to avoid extra code like value , onChange And move them to component like

```<code><input type="text" setValueOnChange=(this,'username')/>
</code>```

答:
While getting exactly the result you want is not possible, just because it is not a syntactically valid JSX. It is possible to make something looking quite similar to that:

```<code>// in render
<input type="text"
  value={this.state.username}
  onChange={setValue(this, 'username')}
/>

// add this method to the component
setValue(propName) {
  return (e) => {
    this.setState({ [propName]: e.target.value })
  }
}
</code>```

You can actually extract the setValue function and reuse it with any other component:

```<code>// in render
<input type="text"
  value={this.state.username}
  onChange={setValue(this, 'username')}
/>

// somewhere outside of the component
function setValue(component, propName) {
  return (e) => {
    component.setState({ [propName]: e.target.value })
  }
}
</code>```

I believe I've seen some quite popular React forms handling library which was doing exactly this, but in a bit smarter way — they have cached the generated function to avoid creating a bunch of new function objects on each render. Just can't recall how was it named — there are too much new libs in the react world :)

Body:
I am using reactjs controlled input

reference for below code

<input type="text"
       value={this.state.username}
       onChange={(e) => this.setState({ username: e.target.value })}
       />

I want to avoid extra code like value , onChange And move them to component like

<input type="text" setValueOnChange=(this,'username')/>

Body:
While getting exactly the result you want is not possible, just because it is not a syntactically valid JSX. It is possible to make something looking quite similar to that:

// in render
<input type="text"
  value={this.state.username}
  onChange={setValue(this, 'username')}
/>

// add this method to the component
setValue(propName) {
  return (e) => {
    this.setState({ [propName]: e.target.value })
  }
}

You can actually extract the setValue function and reuse it with any other component:

// in render
<input type="text"
  value={this.state.username}
  onChange={setValue(this, 'username')}
/>

// somewhere outside of the component
function setValue(component, propName) {
  return (e) => {
    component.setState({ [propName]: e.target.value })
  }
}

I believe I've seen some quite popular React forms handling library which was doing exactly this, but in a bit smarter way — they have cached the generated function to avoid creating a bunch of new function objects on each render. Just can't recall how was it named — there are too much new libs in the react world :)


问:
Trouble with Angular UI Bootstrap Datepicker
I need to integrate the datepicker but its not working properly.

This is my HTML

```<code> <div class="form-group">
                <label>Date</label>
                <p class="input-group">
        <input type="text" class="form-control"
         datepicker-popup="mediumDate"
         is-open="shipment.valuationDatePickerIsOpen"
        ng-click="shipment.valuationDatePickerOpen()"
        ng-model="shipment.valuationDate" />
  <span class="input-group-btn">
     <button type="button" class="btn btn-default"
        ng-click="shipment.valuationDatePickerOpen($event)">
         <i class="fa fa-calendar"></i>
     </button>
</span>
</p>

</div>
</code>```

And this is my controller

```<code>var vm = this;
    // $scope.Eship;

      vm.valuationDate = new Date();
  vm.valuationDatePickerIsOpen = false;
  vm.opens = [];

  $scope.$watch(function () {
       return vm.valuationDatePickerIsOpen;
   },function(value){
      vm.opens.push("valuationDatePickerIsOpen: " + value + " at: " + new Date());
   });

  vm.valuationDatePickerOpen = function ($event) {

      if ($event) {
          $event.preventDefault();
          $event.stopPropagation();
      }
      this.valuationDatePickerIsOpen = true;
  };
</code>```

I already import the ui-bootstrap directive.
I dont know whats missing or whats wrong.

答:
You can follow the simplest example given in the documentation & then after customize or manipulate the Model value of that date input field,

```<code><p class="input-group">
  <input type="text" class="form-control" uib-datepicker-popup ng-model="dt" is-open="popup1.opened"
   datepicker-options="dateOptions" ng-required="true" close-text="Close" alt-input-formats="altInputFormats" />
  <span class="input-group-btn">
    <button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button>
  </span>
</p>
</code>```

Here's link for the plunk https://plnkr.co/edit/PbuiCq5f3NVaWx6OAW8D?p=preview

Body:
I need to integrate the datepicker but its not working properly.

This is my HTML

                Date

        <input type="text" class="form-control"
         datepicker-popup="mediumDate"
         is-open="shipment.valuationDatePickerIsOpen"
        ng-click="shipment.valuationDatePickerOpen()"
        ng-model="shipment.valuationDate" />

     <button type="button" class="btn btn-default"
        ng-click="shipment.valuationDatePickerOpen($event)">

     </button>

And this is my controller

var vm = this;
    // $scope.Eship;

      vm.valuationDate = new Date();
  vm.valuationDatePickerIsOpen = false;
  vm.opens = [];

  $scope.$watch(function () {
       return vm.valuationDatePickerIsOpen;
   },function(value){
      vm.opens.push("valuationDatePickerIsOpen: " + value + " at: " + new Date());
   });

  vm.valuationDatePickerOpen = function ($event) {

      if ($event) {
          $event.preventDefault();
          $event.stopPropagation();
      }
      this.valuationDatePickerIsOpen = true;
  };

I already import the ui-bootstrap directive.
I dont know whats missing or whats wrong.

Body:
You can follow the simplest example given in the documentation & then after customize or manipulate the Model value of that date input field,

<p class="input-group">
  <input type="text" class="form-control" uib-datepicker-popup ng-model="dt" is-open="popup1.opened"
   datepicker-options="dateOptions" ng-required="true" close-text="Close" alt-input-formats="altInputFormats" />
  <span class="input-group-btn">
    <button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button>
  </span>
</p>

Here's link for the plunk https://plnkr.co/edit/PbuiCq5f3NVaWx6OAW8D?p=preview


问:
How to delete the first 2 lines from string in C#?
I have a string like the following:

```<code>string myString = @"This is the first line

This is the third line as the 2nd is empty
The string continues

Anso so on ...
...
..
.";
</code>```

I know that I can split this into an array, delete the first 2 elements and then rebuild my string from that array but I'm looking for something much more simple.

答:
Good for large strings, code easy to read:</p>

```<code>using System.IO;

namespace ConsoleApplication
{
    class Program
    {
        static void Main (string[] args)
        {
            var text = "line 1\r\nline 2\r\nline 3\r\nline 4";

            using (var sr = new StringReader (text))
            {
                sr.ReadLine ();
                sr.ReadLine ();

                string result = sr.ReadToEnd ();
            }
        }
    }
}
</code>```

Body:
I have a string like the following:

string myString = @"This is the first line

This is the third line as the 2nd is empty
The string continues

Anso so on ...
...
..
.";

I know that I can split this into an array, delete the first 2 elements and then rebuild my string from that array but I'm looking for something much more simple.

Body:
Good for large strings, code easy to read:

using System.IO;

namespace ConsoleApplication
{
    class Program
    {
        static void Main (string[] args)
        {
            var text = "line 1\r\nline 2\r\nline 3\r\nline 4";

            using (var sr = new StringReader (text))
            {
                sr.ReadLine ();
                sr.ReadLine ();

                string result = sr.ReadToEnd ();
            }
        }
    }
}