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

a system properties casting issue in centos #289

Closed
denggeng opened this issue Mar 8, 2019 · 4 comments
Closed

a system properties casting issue in centos #289

denggeng opened this issue Mar 8, 2019 · 4 comments
Labels

Comments

@denggeng
Copy link

denggeng commented Mar 8, 2019

Hi,I have foud a problem in Centos.

java.lang.ExceptionInInitializerError: null
        at org.bytedeco.javacv.FFmpegFrameGrabber.<clinit>(FFmpegFrameGrabber.java:304)
        at com.yeezhao.minutes.api.util.AudioConverter.convert(AudioConverter.java:40)
        at com.yeezhao.minutes.api.meeting.service.VoiceMeetingService.tranlate(VoiceMeetingService.java:71)
        at com.yeezhao.minutes.api.meeting.service.VoiceMeetingService$$FastClassBySpringCGLIB$$f8d64b7.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
        at org.bytedeco.javacpp.Loader.loadProperties(Loader.java:196)
        at org.bytedeco.javacpp.Loader.loadProperties(Loader.java:136)
        at org.bytedeco.javacpp.Loader.load(Loader.java:935)
        at org.bytedeco.javacpp.avformat$Read_packet_Pointer_BytePointer_int.<clinit>(avformat.java:632)
        ... 12 common frames omitted

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

CentOS Linux release 7.2.1511 (Core)

And then,I modfied this file(https://github.com/bytedeco/javacpp/blob/master/src/main/java/org/bytedeco/javacpp/Loader.java)) ,
changed line 195,196 from

            String key = (String)e.getKey();
            String value = (String)e.getValue();

to

            String key = String.valueOf(e.getKey());
            String value = String.valueOf(e.getValue());

It has bean fixed.

@saudet
Copy link
Member

saudet commented Mar 8, 2019 via email

saudet added a commit that referenced this issue Mar 10, 2019
…ies (issue #289)

 * Fix `Parser` not replacing all type names of the base class with `Info.flatten` (issue #288)
@saudet saudet added the bug label Mar 10, 2019
@denggeng
Copy link
Author

denggeng commented Mar 11, 2019

How did you trigger that exception? In any case, we should skip over any illegal properties and ignore their values. Could you send a pull request that does that? Thanks!

I am using spring boot to run a web application with tomcat. Using this block of code

            if (!(e.getKey() instanceof String) || !(e.getValue() instanceof String)) {
                logger.info(String.format("property key:%s,value:%s,value class:%s", String.valueOf(e.getKey()),
                        String.valueOf(e.getValue()), e.getValue().getClass()));
            }

,
I have found the none String property value:

property key:server.port,value:11191,value class:class java.lang.Integer .

This is the port of tomcat! It looks like a Spring Boot property But I don't know how does Spring Boot set this property.

@saudet
Copy link
Member

saudet commented Mar 11, 2019

I see, so it's a bug in either Tomcat or Spring Boot. Thanks for the information!

@saudet
Copy link
Member

saudet commented Apr 11, 2019

In any case, the workaround has been included in JavaCPP 1.5. Thanks for reporting!

@saudet saudet closed this as completed Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants