I was able to solve this myself. I was correct that it was with how I was setting up the texture array. Solution:
Solution
public class TextureArray {
private static int imageIndex = 0;
public TextureArray(GL4 gl, int shaderProgram) {
try {
gl.glUseProgram(shaderProgram);
TextureData data1 = TextureIO.newTextureData(gl.getGLProfile(), new File("src/main/resources/textures/grass.png"), true, "png");
TextureData data2 = TextureIO.newTextureData(gl.getGLProfile(), new File("src/main/resources/textures/stone.png"), true, "png");
IntBuffer texture = IntBuffer.allocate(16);
int textureUnit = 5; // arbitrary
gl.glActiveTexture(GL_TEXTURE0 + textureUnit);
gl.glGenTextures(1, texture);
gl.glBindTexture(GL_TEXTURE_2D_ARRAY, texture.get());
gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 128, 128, 16);
gl.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 128, 128, 1, GL_RGBA, GL_UNSIGNED_BYTE, data1.getBuffer());
gl.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 1, 128, 128, 1, GL_RGBA, GL_UNSIGNED_BYTE, data2.getBuffer());
gl.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 4);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
int textureArrayLoc = gl.glGetUniformLocation(shaderProgram, "textureArray");
gl.glUniform1i(textureArrayLoc, textureUnit);
} catch (IOException ignored) {
System.out.println("Texture Array Failed");
}
}
}