These are chat archives for spring-cloud/spring-cloud

28th
Dec 2018
muhmadtabrez
@muhmadtabrez
Dec 28 2018 09:50
@marcosbarbero i can see in the response headers jsessionid cookie is not set.
where for postman requests i am getting jesseionid in the response.
David J. M. Karlsen
@davidkarlsen
Dec 28 2018 12:15

I have this autoconfig class:

package com.edb.finance.common.spring.batch;

import com.edb.finance.common.spring.batch.listener.BatchOracleEndToEndMetricsContextResolver;
import com.edb.finance.common.spring.datasource.OracleEndToEndMetricDataSourceWrapper;
import com.edb.finance.common.spring.datasource.OracleEndToEndMetricsDataSourceBeanPostProcessor;
import oracle.jdbc.datasource.OracleDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.launch.support.ExitCodeMapper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Adds FINODS/JFR standard beans.
 *
 */
@Configuration
@ConditionalOnBean(Job.class)
public class SpringBatchAutoConfiguration {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Bean
    @ConditionalOnMissingBean(ExitCodeMapper.class)
    public ExitCodeMapper exitCodeMapper() {
        logger.info("Using FINODS standard spring-batch ExitCodeMapper");
        return new EdbExitCodeMapper();
    }

    @Bean
    @ConditionalOnClass(OracleDataSource.class)
    @ConditionalOnBean({OracleEndToEndMetricDataSourceWrapper.class,OracleEndToEndMetricsDataSourceBeanPostProcessor.class})
    public BatchOracleEndToEndMetricsContextResolver batchOracleEndToEndMetricsContextResolver() {
        return new BatchOracleEndToEndMetricsContextResolver();
    }

}

But when an application uses it, it fails with:

java.lang.IllegalStateException: Cannot load configuration class: com.edb.finance.common.spring.batch.SpringBatchAutoConfiguration
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:414)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:330)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
        at com.evry.fs.enterprise.txs.migration.TxsMigrationApplication.main(TxsMigrationApplication.java:61)
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
        at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
        at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
Marcos Barbero
@marcosbarbero
Dec 28 2018 12:37
Hi @muhmadtabrez how are you doing the two requests?
  1. Using postman
  2. curl or something else?
oops, it's an angular request, right?
I forgot
so, maybe you could get the postman request and export it to curl or something else and see whether it still works or not
Marcos Barbero
@marcosbarbero
Dec 28 2018 12:42
Hi @davidkarlsen I'd suggest you to ask it on https://gitter.im/spring-projects/spring-boot, however, what I would suggestion you is changing this @ConditionalOnClass(OracleDataSource.class) to this @ConditionalOnClass(name = "oracle.jdbc.datasource.OracleDataSource")
and removing the import line as well
Rahul Singh
@rahulsingh336
Dec 28 2018 18:35
@spencergibb is there any way to refresh config properties periodically in pcf env?
David J. M. Karlsen
@davidkarlsen
Dec 28 2018 20:53
@marcosbarbero oh - sorry - I’m in the wrong channel and didn’t notice