|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Robot code crashes on initialization
When we attempt to deploy code, on occasion we get the following error:
Code:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team449.robot.Robot java.lang.ExceptionInInitializationError at [java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:259), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:204)] We have also tried simply deploying an empty robot project, and got these errors: Code:
WARNING: Robots don't quit! ERROR: Could not instantiate robot org.usfirst.frc.team449.robot.Robot! Anyone have any idea what might be going on? |
|
#2
|
||||
|
||||
|
Re: Robot code crashes on initialization
My suggestion is trying to load on the sample robot code and seeing if your code is the problem. I assume that the difference between it working before and now is the changes you made to your code.
|
|
#3
|
|||
|
|||
|
Re: Robot code crashes on initialization
Quote:
One thing I remembered after searching ExceptionInInitializationError (which means that there was an error in a static initializer) was that previously we had sensors being initialized to the same port, but instead of seeing the exception stating that we had multiple sensors on the same ports, we saw this generic error. I double checked the code and removed all port overlaps I could find in our maps, but the error persisted. Tomorrow I'll try to catch the exceptions and print them and test this theory and post the results to this thread. TL;DR Exception handling in static init seems terrible, going to try and find the real error. EDIT 2/6 2PM: Turns out there were exceptions thrown in the constructors of some of our subsystems that were initialized statically (since they were declared as final and therefore cannot be initialized in robotInit()). We didn't notice they were there because of how static init exceptions are handled. To solve this we will either make the variables not final and instantiate them in robotInit() or instantiate them in the constructor (since putting a try-catch block in every constructor is very cumbersome) Last edited by yonip : 06-02-2016 at 13:56. Reason: Update information |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|