Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating bean with name 'streamController': Unsatisfied dependency expressed through field 'channelService'; #13

Closed
satis4action opened this issue Apr 18, 2020 · 2 comments

Comments

@satis4action
Copy link

Sorry Guys, I am getting this error, could you please help:

WARN [main] org.springframework.context.support.AbstractApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'streamController': Unsatisfied dependency expressed through field 'channelService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createChannelService' defined in class path resource [com/github/segator/proxylive/service/ChannelServiceFactory.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.segator.proxylive.service.ChannelService]: Factory method 'createChannelService' threw exception; nested exception is java.lang.NullPointerException

after that the error continued...
ERROR [main] org.springframework.boot.SpringApplication: Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'streamController': Unsatisfied dependency expressed through field 'channelService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createChannelService' defined in class path resource [com/github/segator/proxylive/service/ChannelServiceFactory.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.segator.proxylive.service.ChannelService]: Factory method 'createChannelService' threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at com.github.segator.proxylive.Application.main(Application.java:38) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createChannelService' defined in class path resource [com/github/segator/proxylive/service/ChannelServiceFactory.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.segator.proxylive.service.ChannelService]: Factory method 'createChannelService' threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1290) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1210) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ... 27 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.segator.proxylive.service.ChannelService]: Factory method 'createChannelService' threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ... 40 common frames omitted Caused by: java.lang.NullPointerException: null at com.github.segator.proxylive.service.ChannelServiceFactory.createChannelService(ChannelServiceFactory.java:15) at com.github.segator.proxylive.service.ChannelServiceFactory$$EnhancerBySpringCGLIB$$db149b83.CGLIB$createChannelService$0(<generated>) at com.github.segator.proxylive.service.ChannelServiceFactory$$EnhancerBySpringCGLIB$$db149b83$$FastClassBySpringCGLIB$$20d0b594.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) at com.github.segator.proxylive.service.ChannelServiceFactory$$EnhancerBySpringCGLIB$$db149b83.createChannelService(<generated>) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ... 41 common frames omitted

here is the config (application.yml):

`spring.jackson.serialization.INDENT_OUTPUT: true
management:
server:
port: 8090
endpoints:
prometheus:
enabled: true
metrics:
enabled: true
web:
exposure:
include: "*"
metrics:
export:
prometheus:
enabled: true
security:
enabled: false
geoIP:
enabled: false
url: https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
source:
reconnectTimeout: 10
tvheadendURL: http://root:password@IP:9981
epg:
url: http://root:password@IP:9981/xmltv/channels
refresh: 600 #10 minutes
channels:
type: tvheadend
refresh: 60 #In seconds
streamTimeout: 60
ffmpeg:
path: '/usr/bin/ffmpeg'
profiles:
-
alias: "aac"
parameters: "-sn -ac 2 -c:a aac -b:a 320k -c:v copy"

        alias: "240p"
        parameters: "-sn -c:a:0 aac -ac 2 -b:a 64k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 300k  -preset veryslow -vf scale=-1:244,yadif=0"
    -
        alias: "360p"
        parameters: "-sn -c:a:0 aac -ac 2 -b:a 96k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 700k  -preset veryslow -vf scale=-1:360,yadif=0"
    -
        alias: "480p"
        parameters: "-sn -c:a:0 aac -ac 2 -b:a 196k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 1500k  -preset slow -vf scale=-1:484,yadif=0"
    -
        alias: "720p"
        parameters: "-sn  -c:a:0 aac -ac 2 -b:a 320k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 3000k  -preset fast -vf scale=-1:720,yadif=0"
    -
        alias: "1080p"
        parameters:  "-sn  -c:a:0 aac -ac 2 -b:a 320k -c:v libx264 -tune zerolatency -g 300 -vprofile high -level 4.0 -movflags +faststart -bufsize 15000k -maxrate 5000k  -preset faster -vf yadif=0"
mpegTS:
    parameters: "-threads 0 -f mpegts -mpegts_m2ts_mode 1 -mpegts_copyts 1 -mpegts_flags +resend_headers  "
hls:
    enabled: false
    tempPath: "/tmp"
    parameters: "-flags -global_header  -avoid_negative_ts disabled -map_metadata -1 -start_at_zero -copyts -flags -global_header -vsync cfr -y -nostats -f hls  -hls_time 2 -hls_list_size 10 -hls_wrap 20 -hls_allow_cache 0  -hls_flags +append_list -hls_flags +discont_start -hls_flags +delete_segments"
    timeout: 30

buffers:
chunkSize: 1048576
broadcastBufferSize: 52428800
`

System is:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Linux stream 4.19.0-8-amd64
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode, sharing)

@segator
Copy link
Owner

segator commented Apr 19, 2020

Fails because the format of the yaml is wrong, in your case type: tvheadend is not inside of channels:

What you have is

source:
    reconnectTimeout: 10
    tvheadendURL: http://root:password@IP:9981
    epg:
        url: http://root:password@IP:9981/xmltv/channels
        refresh: 600 #10 minutes
    channels:
    type: tvheadend
        refresh: 60 #In seconds

Expected format

source:
    tvheadendURL: http://user:password@your.tvheadend.com:9981
    channels:
        type: tvheadend

said that in your case should be...

source:
    reconnectTimeout: 10
    tvheadendURL: http://root:password@IP:9981
    epg:
        url: http://root:password@IP:9981/xmltv/channels
        refresh: 600 #10 minutes
    channels:
        type: tvheadend
        refresh: 60 #In seconds

@satis4action
Copy link
Author

Recompiled with suggested modification.
Server started without any issues.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants