Unexpected Error when Running Robot Code

Hello,

After trying to clean up my code utilizing an IO class with static instances of all my objects, I am running into a few problems.

When I upload the robot code and enable, I get this error in the driver station:

ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4159.robot.IO.<clinit>(IO.java:15), org.usfirst.frc.team4159.robot.Robot.teleopInit(Robot.java:58), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:142), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:234)]

Here is the code referenced first in the error: (line 15 is the line is where OctoDrive is instantiated)

package org.usfirst.frc.team4159.robot;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.networktables.NetworkTable;

public class IO {
	public static Joystick leftStick = new Joystick(1);                           //Joystick Declaration
	public static Joystick rightStick = new Joystick(2);
	public static Joystick secondaryStick = new Joystick(3);
	
	private static DriveWheels wheelSet = new DriveWheels(0, 1, 2, 3);			  //Drivetrain Declarations
	private static DrivePistons pistonSet = new DrivePistons(0, 1, 2, 3);		  
	public static OctoDrive mainDrive = new OctoDrive(wheelSet, pistonSet);
	static {
		mainDrive.octoShift(true);
		mainDrive.invertMotor("rearRight", true);
    	mainDrive.invertMotor("frontRight", true);
    	mainDrive.invertMotor("leftSide", true);
	}
	
	public static ToteLifter elevator = new ToteLifter(4, 5);					  //ToteLifter Declarations
	public static DigitalInput lowLimit = new DigitalInput(8);
	public static DigitalInput highLimit = new DigitalInput(9);
	static {
		elevator.setHighLow(lowLimit, highLimit);
	}
	
	public static GyroManager mainGyro = new GyroManager(new gyroSampler          //Gyro Declaration
				(new GyroITG3200(I2C.Port.kOnboard)));
	
	
	public static NetworkTable imageValues;											  //RoboRealm NetworkTable Declaration
	static {
		imageValues = NetworkTable.getTable("");
	}
	public static DigitalInput toteSensor = new DigitalInput(10);
	
}

Is there something I am doing wrong here? All the people I am asking are saying that it looks fine.

Thanks in advance!

Below the stack trace for the ExceptionInInitalizerError you should find another stack trace which will tell you the real error. There should be a line that had “caused by:” or something like that in it.

Posting that, along with the code for OctoDrive, would help. It looks like there is something wrong in the OctoDrive constructor.

We actually figured out the problem with our IO class, which was something that could was not indicated in the stacktrace error. The static blocks were not running properly when we wanted to, so we made a quick fix…

private static DriveWheels wheelSet = new DriveWheels(0, 1, 2, 3);			  //Drivetrain Declarations
private static DrivePistons pistonSet = new DrivePistons(0, 1, 2, 3);		  
public static OctoDrive mainDrive = new OctoDrive(wheelSet, pistonSet)
        .octoShift(true)
	.invertMotor("rearRight", true)
        .invertMotor("frontRight", true) 
        .invertMotor("leftSide", true); 

by method chaining!

Thanks for your help!