sarxos / webcam-capture

The goal of this project is to allow integrated or USB-connected webcams to be accessed directly from Java. Using provided libraries users are able to read camera images and detect motion. Main project consist of several sub projects - the root one, which contains required classes, build-in webcam driver compatible with Windows, Linux and Mac OS, which can stream images as fast as your camera can serve them (up to 50 FPS). Main project can be used standalone, but user is able to replace build-in driver with different one - such as OpenIMAJ, GStreamer, V4L4j, JMF, LTI-CIVIL, FMJ, etc.
http://webcam-capture.sarxos.pl
MIT License
2.27k stars 1.11k forks source link

Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber #798

Open DanielMartensson opened 3 years ago

DanielMartensson commented 3 years ago

I'm using OpenJDK 11 on Raspberry Pi 4 B.

Here is my code.

package se.danielmartensson.views;

import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

import com.github.sarxos.webcam.Webcam;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.applayout.AppLayout;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep;
import com.vaadin.flow.component.html.Image;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.component.select.Select;
import com.vaadin.flow.router.Route;
import se.danielmartensson.threads.CameraThread;
import se.danielmartensson.tools.Top;

@Route("camera")
@CssImport("./styles/shared-styles.css")
@CssImport(value = "./styles/vaadin-text-field-styles.css", themeFor = "vaadin-text-field")
@Push
public class CameraView extends AppLayout {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    public static final String START = "START";
    public static final String STOP = "STOP";

    // For the thread
    private static AtomicBoolean startStopThread = null;
    private static CameraThread cameraThread = null;
    private static Webcam selectedWebcam = null;

    // Selected values - Save them
    private static String selectedCamera = null;
    private static String selectedPictureSize = null;

    // This need to be a non-static field
    private Button startStop = null;

    public CameraView() {
        Top top = new Top();
        top.setTopAppLayout(this);

        // Create image for the real time
        Image realTimeCameraImage = new Image();
        Select<String> pictureSize = new Select<String>();
        pictureSize.setEnabled(false);
        pictureSize.setLabel("Video Size Stream");
        realTimeCameraImage.setTitle("Real Time Video");

        // Start and stop button for camera
        startStop = new Button(START);
        startStopYoloConfiguration();

        // Create the thread
        if (cameraThread == null) {
            startStopThread = new AtomicBoolean(false);
            cameraThread = new CameraThread();
        }

        // Create the drop down button for the camera
        Select<String> cameras = new Select<String>();
        cameras.setLabel("Camera");
        createCameraSelectorButton(cameras, cameraThread, realTimeCameraImage, pictureSize);
        setPictureSize(pictureSize, realTimeCameraImage);

        // Set the components to the thread
        cameraThread.setComponentsToThread(startStop, startStopThread, UI.getCurrent(), cameras, selectedWebcam, realTimeCameraImage, pictureSize);
        if (!cameraThread.isAlive())
            cameraThread.start();

        // Content
        VerticalLayout layout = new VerticalLayout();
        FormLayout form = new FormLayout(startStop, cameras, pictureSize);
        form.setResponsiveSteps(new ResponsiveStep("10em", 1), new ResponsiveStep("32em", 2), new ResponsiveStep("40em", 3));
        layout.add(form);
        layout.add(realTimeCameraImage);
        layout.setAlignItems(Alignment.CENTER);
        setContent(layout);
    }

    private void setPictureSize(Select<String> pictureSize, Image realTimeCameraImage) {
        pictureSize.addValueChangeListener(e -> {
            if (e.getValue() == null)
                return;
            // Change the display image
            String[] size = e.getValue().split("x"); // Width x height
            int width = (int) Float.parseFloat(size[0]);
            int height = (int) Float.parseFloat(size[1]);
            selectedPictureSize = width + "x" + height;
            realTimeCameraImage.setWidth(width + "px");
            realTimeCameraImage.setHeight(height + "px");

            // Change the camera
            if (selectedWebcam != null) {
                if (!selectedWebcam.isOpen()) {
                    selectedWebcam.setViewSize(new Dimension(width, height));
                } else {
                    new Notification("You can only set the camera size when the camera is closed", 3000).open();
                }
            }
        });
    }

    private void startStopYoloConfiguration() {
        startStop.setEnabled(false); // Need to be before the listener
        if (selectedWebcam != null) {
            if (selectedWebcam.isOpen()) {
                startStop.setEnabled(true);
            }
        }
        startStop.addClickListener(e -> {
            if (startStopThread.get()) {
                startStopThread.set(false); // Stop YOLO
            } else {
                startStopThread.set(true); // Start YOLO
            }
        });
    }

    /**
     * This creates the camera selector drop down button and also gives it a
     * listener for enable the camera
     * 
     * @param cameras
     * @param imageShowRealTimeThread
     * @param realTimeCameraImage
     * @param thresholds
     * @param pictureSize
     */
    private void createCameraSelectorButton(Select<String> cameras, CameraThread imageShowRealTimeThread, Image realTimeCameraImage, Select<String> pictureSize) {
        // Fill with camera names
        List<Webcam> webcamsList = Webcam.getWebcams();
        String[] webcamNames = new String[webcamsList.size()];
        int i = 0;
        for (Webcam webcam : webcamsList) {
            String cameraName = webcam.getName();
            boolean contains = Arrays.stream(webcamNames).anyMatch(cameraName::equals); // Check if cameraName contains in webcamArray
            if (!contains) {
                webcamNames[i] = cameraName;
                i++;
            }
        }
        cameras.setItems(webcamNames);

        // Add a listener for enabling the camera
        cameras.addValueChangeListener(e -> {
            if (selectedWebcam == null) {
                selectNewCamera(cameras, imageShowRealTimeThread, realTimeCameraImage, pictureSize);
            } else {
                selectedWebcam.close();
                selectNewCamera(cameras, imageShowRealTimeThread, realTimeCameraImage, pictureSize);
            }
        });
        if (selectedCamera != null) {
            cameras.setValue(selectedCamera);
        }
    }

    /**
     * This will select the camera from webcamsList for us and open it
     * 
     * @param cameras
     * @param imageShowRealTimeThread
     * @param realTimeCameraImage
     * @param thresholds
     * @param pictureSize
     */
    private void selectNewCamera(Select<String> cameras, CameraThread imageShowRealTimeThread, Image realTimeCameraImage, Select<String> pictureSize) {
        List<Webcam> webcamsList = Webcam.getWebcams();
        String selectedCameraName = cameras.getValue();
        selectedCamera = cameras.getValue();
        selectedWebcam = webcamsList.stream().filter(x -> selectedCameraName.equals(x.getName())).findFirst().get(); // This generates a new object of the web cam
        startStop.setEnabled(true);
        pictureSize.setEnabled(true);
        imageShowRealTimeThread.setSelectedWebcam(selectedWebcam);
        fillPictureSizesDropdownButton(pictureSize);
    }

    private void fillPictureSizesDropdownButton(Select<String> pictureSize) {
        pictureSize.clear();
        ArrayList<String> list = new ArrayList<>();
        for (Dimension dimension : selectedWebcam.getViewSizes()) {
            list.add(dimension.getWidth() + "x" + dimension.getHeight());
        }
        pictureSize.setItems(list);
        // Select the selected
        if (selectedPictureSize == null)
            return;
        for (String resolution : list) {
            String[] size = resolution.split("x"); // Width x height
            int width = (int) Float.parseFloat(size[0]);
            int height = (int) Float.parseFloat(size[1]);
            String[] selectedSize = selectedPictureSize.split("x"); // Width x height
            int widthSelected = (int) Float.parseFloat(selectedSize[0]);
            int heightSelected = (int) Float.parseFloat(selectedSize[1]);
            if (width == widthSelected && height == heightSelected) {
                pictureSize.setValue(resolution);
            }
        }
    }
}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'se.danielmartensson.views.CameraView': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [se.danielmartensson.views.CameraView]: Constructor threw exception; nested exception is com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1320)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1214)
    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.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:307)
    at com.vaadin.flow.spring.SpringInstantiator.getOrCreate(SpringInstantiator.java:117)
    at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:160)
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget$1(AbstractNavigationStateRenderer.java:135)
    at java.base/java.util.Optional.orElseGet(Optional.java:369)
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:134)
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.sendBeforeEnterEventAndPopulateChain(AbstractNavigationStateRenderer.java:518)
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.createChainIfEmptyAndExecuteBeforeEnterNavigation(AbstractNavigationStateRenderer.java:498)
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:230)
    at com.vaadin.flow.router.Router.handleNavigation(Router.java:249)
    at com.vaadin.flow.router.Router.navigate(Router.java:220)
    at com.vaadin.flow.router.Router.navigate(Router.java:186)
    at com.vaadin.flow.component.UI.navigate(UI.java:912)
    at com.vaadin.flow.component.UI.navigate(UI.java:882)
    at com.vaadin.flow.component.UI.navigate(UI.java:837)
    at se.danielmartensson.tools.Top.lambda$new$aa821371$6(Top.java:61)
    at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:441)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:441)
    at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:59)
    at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:64)
    at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:409)
    at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$1(ServerRpcHandler.java:390)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:390)
    at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:317)
    at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
    at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
    at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1545)
    at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
    at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
    at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter.doFilterInternal(DefaultLogoutPageGeneratingFilter.java:52)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:216)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [se.danielmartensson.views.CameraView]: Constructor threw exception; nested exception is com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:213)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1312)
    ... 122 more
Caused by: com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:124)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:893)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:866)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:845)
    at se.danielmartensson.views.CameraView.createCameraSelectorButton(CameraView.java:145)
    at se.danielmartensson.views.CameraView.<init>(CameraView.java:76)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:200)
    ... 124 more
Caused by: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:116)
    ... 134 more
Caused by: com.github.sarxos.webcam.WebcamException: Cannot execute task
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:72)
    at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:140)
    at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:46)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver$WebcamNewGrabberTask.newGrabber(WebcamDefaultDriver.java:45)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.getDevices(WebcamDefaultDriver.java:117)
    at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:36)
    at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:26)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    ... 1 more
Caused by: java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:812)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:1022)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:904)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:271)
    at org.bridj.BridJ.initialize(BridJ.java:1128)
    at org.bridj.NativeObject.<init>(NativeObject.java:50)
    at org.bridj.StructObject.<init>(StructObject.java:46)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:55)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver$WebcamNewGrabberTask.handle(WebcamDefaultDriver.java:55)
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:81)
    ... 3 more
Caused by: java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/tmp/BridJExtractedLibraries14722018208333847447/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:1072)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:1049)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:602)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:771)
    ... 13 more
DanielMartensson commented 3 years ago

Does anyone here have the same issue with Raspberry Pi 4B?