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

Safe mode without networking iftable error #1506

Closed
barisunsalhn opened this issue Feb 23, 2023 · 1 comment
Closed

Safe mode without networking iftable error #1506

barisunsalhn opened this issue Feb 23, 2023 · 1 comment

Comments

@barisunsalhn
Copy link

barisunsalhn commented Feb 23, 2023

Posted on Stacoverflow for more visibility. Mirroring here..
Created new maven project on intellij. Added this code to main:

import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Advapi32;
import com.sun.jna.platform.win32.Winsvc;
public class Main {
    public static void main(String[] args) throws InterruptedException {
        registerHandler();
        System.out.println(1);
        Thread.sleep(60000);
    }
    public static void registerHandler(){
        Winsvc.SERVICE_STATUS_HANDLE service_status_handle = Advapi32.INSTANCE.RegisterServiceCtrlHandlerEx("hvldlpxpa", new Winsvc.HandlerEx() {
            @Override
            public int callback(int i, int i1, Pointer pointer, Pointer pointer1) {
                return i;
            }
        }, Pointer.NULL);
    }
    public static void stopService(String[] args) throws Exception {
        System.exit(0);
    }
}

MAVEN FILE:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>jnaReg</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
    <dependency>
        <groupId>net.java.dev.jna</groupId>
        <artifactId>jna-platform</artifactId>
        <version>5.12.1</version>
    </dependency>
    </dependencies>
    <build>
<plugins>
    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.6</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
                <manifest>
                    <mainClass>Main</mainClass>
                </manifest>
            </archive>
            <finalName>JNA</finalName>
        </configuration>
    </plugin>
</plugins>
</build>
</project>

enter image description here
Booted into safe mode minimal. This error happens:

JNA safe mode
In safe mode with networking it works perfectly(outputs 1 and sleeps for 60 seconds). Winapi docs does not provide much help. I also searched on jna issues on github.

Provide complete information about the problem

  1. Version of JNA and related jars 5.12.1
  2. Version and vendor of the java virtual machine Oracle, 1.8.0_251
  3. Operating system Windows 10 Build 19041
  4. System architecture (CPU type, bitness of the JVM) 64 bit
  5. Complete description of the problem -> Already discussed
  6. Steps to reproduce -> Already discussed

Any help?

@matthiasblaesing
Copy link
Member

The exception come out of the JDK and happens when JNA tries to extract its native library. The JDK can't provide a safe random numer (see the error in the initilization of SeedGenerator. This is not an issue in JNA and the issue template directs you to the right place to ask questions (the mailinglist).

  1. You JDK is ancient. Active development is on JDK 20/21, 8 is in maintenance mode
  2. Your release of JDK 8 is also not current. JDK 8 Updates Projekt is at u362. One still maintained distribution is Corretto: https://github.com/corretto/corretto-8/releases . This might be fixed there.

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