Skip to content

java.lang.NullPointerException: ... because "environment" is null #698

@jozefcifre

Description

@jozefcifre

What you were trying to do

I was trying to run the game as follows:

nix-shell
./gradlew
./gradlew run

What actually happened

java.lang.NullPointerException: Cannot invoke "org.terasology.gestalt.module.ModuleEnvironment.getSubtypesOf(java.lang.Class, java.util.function.Predicate)" because "environment" is null
...

How to reproduce

No response

Game version

2.1.0 (develop branch)

Log details

java.lang.NullPointerException: Cannot invoke "org.terasology.gestalt.module.ModuleEnvironment.getSubtypesOf(java.lang.Class, java.util.function.Predicate)" because "environment" is null
	at org.terasology.gestalt.entitysystem.component.management.ComponentTypeIndex.changeEnvironment(ComponentTypeIndex.java:84)
	at org.terasology.gestalt.entitysystem.component.management.ComponentTypeIndex.<init>(ComponentTypeIndex.java:67)
	at org.destinationsol.assets.AssetHelper.init(AssetHelper.java:82)
	at org.destinationsol.SolApplication.create(SolApplication.java:164)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:416)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:366)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:167)
	at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:138)

Operating System

Linux

Additional Info

I use NixOS.

Here is the shell.nix where I usually run DS:

let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-unstable";
  pkgs = import nixpkgs { config = {}; overlays = []; };
in

pkgs.mkShell {
  packages = with pkgs; [
#    git # already installed
#    temurin-bin-11 # I installed temurin-bin-21 instead
    libglvnd
    libpulseaudio
    xorg.libXcursor
    xorg.libXrandr
    xorg.libXxf86vm
  ];
  LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.libglvnd}/lib:${pkgs.libpulseaudio}/lib:${pkgs.xorg.libXcursor}/lib:${pkgs.xorg.libXrandr}/lib:${pkgs.xorg.libXxf86vm}/lib";
}

I was able to run the game exactly as I tried today. It's a fresh clone, no changes, just the source code as it is in this repository; however, it didn't work this time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions