question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

type "jtermios.windows.WinAPI$ULONG_PTR" is not supported

See original GitHub issue

When I call CommPortIdentifier.getPortIdentifier("COM2") I get an error that unsigned Long pointer is not supported. I know the device is connected on COM2 because I can access it in YAT.

I’ve imported the library using gradle compile group: 'com.github.purejavacomm', name: 'purejavacomm', version: '1.0.2.RELEASE'

Stack trace: java.lang.IllegalArgumentException: Invalid Structure field in class jtermios.windows.WinAPI$OVERLAPPED, field name 'Internal' (class jtermios.windows.WinAPI$ULONG_PTR): The type "jtermios.windows.WinAPI$ULONG_PTR" is not supported: Can't create an instance of class jtermios.windows.WinAPI$ULONG_PTR, requires a public no-arg constructor: java.lang.reflect.InvocationTargetException at com.sun.jna.Structure.validateField(Structure.java:1215) at com.sun.jna.Structure.validateFields(Structure.java:1224) at com.sun.jna.Structure.<init>(Structure.java:200) at com.sun.jna.Structure.<init>(Structure.java:193) at com.sun.jna.Structure.<init>(Structure.java:180) at com.sun.jna.Structure.<init>(Structure.java:172) at jtermios.windows.WinAPI$OVERLAPPED.<init>(WinAPI.java:459) at jtermios.windows.JTermiosImpl$Port.<init>(JTermiosImpl.java:65) at jtermios.windows.JTermiosImpl$Port.<init>(JTermiosImpl.java:53) at jtermios.windows.JTermiosImpl.open(JTermiosImpl.java:348) at jtermios.JTermios.open(JTermios.java:422) at purejavacomm.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:101) at com.<redacted>.network.SerialClient.SerialClient.connect(SerialClient.java:47) at com.<redacted>.network.NMEAConnection.NMEAConnection.connect(NMEAConnection.java:148) at com.<redacted>.nmea_device.Application.run(Application.java:93) at com.<redacted>.nmea_device.Application.main(Application.java:132) Caused by: java.lang.IllegalArgumentException: The type "jtermios.windows.WinAPI$ULONG_PTR" is not supported: Can't create an instance of class jtermios.windows.WinAPI$ULONG_PTR, requires a public no-arg constructor: java.lang.reflect.InvocationTargetException at com.sun.jna.Native.getNativeSize(Native.java:1362) at com.sun.jna.Structure.getNativeSize(Structure.java:2174) at com.sun.jna.Structure.getNativeSize(Structure.java:2164) at com.sun.jna.Structure.validateField(Structure.java:1211) ... 15 more

Any help is appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yijunwucommented, Jan 25, 2022

This sounds like a non compatible version of JNA.

I encountered the same problem(java.lang.IllegalArgumentException: The type “jtermios.windows.WinAPI$ULONG_PTR” is not supported) and found it is indeed a JNA version compatibility problem. After downgrading to JNA 4.2.2(previously 5.10.0), the problem is solved. Just FYI.

0reactions
nyholkucommented, Jan 25, 2022

On 25. Jan 2022, at 11.27, Jacob Wu @.***> wrote:

On 19 Sep 2019, at 6.43, Tom M @.***> wrote: When I call CommPortIdentifier.getPortIdentifier(“COM2”) I get an error that unsigned Long pointer is not supported. I know the device is connected on COM2 because I can access it in YAT. I’ve imported the library using gradle compile group: ‘com.github.purejavacomm’, name: ‘purejavacomm’, version: ‘1.0.2.RELEASE’ Stack trace: java.lang.IllegalArgumentException: Invalid Structure field in class jtermios.windows.WinAPI$OVERLAPPED, field name ‘Internal’ (class jtermios.windows.WinAPI$ULONG_PTR): The type “jtermios.windows.WinAPI$ULONG_PTR” is not supported: Can’t create an instance of class jtermios.windows.WinAPI$ULONG_PTR, requires a public no-arg constructor: java.lang.reflect.InvocationTargetException at com.sun.jna.Structure.validateField(Structure.java:1215) at com.sun.jna.Structure.validateFields(Structure.java:1224) at com.sun.jna.Structure.(Structure.java:200) at com.sun.jna.Structure.(Structure.java:193) at com.sun.jna.Structure.(Structure.java:180) at com.sun.jna.Structure.(Structure.java:172) at jtermios.windows.WinAPI$OVERLAPPED.(WinAPI.java:459) at jtermios.windows.JTermiosImpl$Port.(JTermiosImpl.java:65) at jtermios.windows.JTermiosImpl$Port.(JTermiosImpl.java:53) at jtermios.windows.JTermiosImpl.open(JTermiosImpl.java:348) at jtermios.JTermios.open(JTermios.java:422) at purejavacomm.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:101) at com…network.SerialClient.SerialClient.connect(SerialClient.java:47) at com…network.NMEAConnection.NMEAConnection.connect(NMEAConnection.java:148) at com…nmea_device.Application.run(Application.java:93) at com…nmea_device.Application.main(Application.java:132) Caused by: java.lang.IllegalArgumentException: The type “jtermios.windows.WinAPI$ULONG_PTR” is not supported: Can’t create an instance of class jtermios.windows.WinAPI$ULONG_PTR, requires a public no-arg constructor: java.lang.reflect.InvocationTargetException at com.sun.jna.Native.getNativeSize(Native.java:1362) at com.sun.jna.Structure.getNativeSize(Structure.java:2174) at com.sun.jna.Structure.getNativeSize(Structure.java:2164) at com.sun.jna.Structure.validateField(Structure.java:1211) … 15 more Any help is appreciated. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread. This sounds like a non compatible version of JNA.

I encountered the same problem(java.lang.IllegalArgumentException: The type “jtermios.windows.WinAPI$ULONG_PTR” is not supported) and found it is indeed a JNA version compatibility problem. After downgrading to JNA 4.2.2(previously 5.10.0), the problem is solved. Just FYI.

— Reply to this email directly, view it on GitHub https://github.com/nyholku/purejavacomm/issues/128#issuecomment-1020979559, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFP7LM6Y2B2FSUVMYETM5TUXZUHBANCNFSM4IYGARHA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.

Thansk for the heads up!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not initialize class jtermios.windows.WinAPI - Stack ...
when i run my api ,1st time its giving the correct response ,after again calling the api i am getting below error. I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found