This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Trucidoe's profile picture

Big Reactor with Multiple Turbines runtime

Started by Trucidoe, 25 July 2015 - 02:51 PM
Trucidoe #1
Posted 25 July 2015 - 04:51 PM
So a friend of mine wrote this program http://pastebin.com/Mia9jssw

However after updating java on the server to oracle JRE 8 it will not run for more then 24 hours when it will post this error: Java.Exception Thrown: Java.lang.NullPointerException http://imgur.com/GN89lNq

It happens within 24 hours but I cant find any information on the advanced monitor that would point to the area of the code to reference where it is failing at. I am not asking for a handout more like on advise on how to proceed? I have read the code as best as I am able but I cannot find a starting point.

Any advise or suggestions would be appreciated. Ultimately I am trying to run a single program to manage a reactor with multiple turbines and this one has been the simpliest because it only calls for one advanced computer and one monitor to modem connect to all the equipment.
flaghacker #2
Posted 25 July 2015 - 09:27 PM
So a friend of mine wrote this program http://pastebin.com/Mia9jssw

However after updating java on the server to oracle JRE 8 it will not run for more then 24 hours when it will post this error: Java.Exception Thrown: Java.lang.NullPointerException http://imgur.com/GN89lNq

It happens within 24 hours but I cant find any information on the advanced monitor that would point to the area of the code to reference where it is failing at. I am not asking for a handout more like on advise on how to proceed? I have read the code as best as I am able but I cannot find a starting point.

Any advise or suggestions would be appreciated. Ultimately I am trying to run a single program to manage a reactor with multiple turbines and this one has been the simpliest because it only calls for one advanced computer and one monitor to modem connect to all the equipment.

You'd be better of reporting that issue to the author of BigReactors, as it's a problem on his side.

I also remember a problem with Forge and Java 8, I don't know if that was fixed though.
HPWebcamAble #3
Posted 26 July 2015 - 07:10 AM
It happens within 24 hours

Unfortunantly, that's a long time, it makes the problem line much harder to find. Its likely something to do with a peripheral call to a big reactors block.

You could try adding 'print("test")' in the code (Have it print to the computer's screen, not the monitor).

That should give you an idea of what causes it.

Although, you may be better off making a 'log' function:

local filePath = "log" --# The path of the file output, in this case, /log

local f = fs.open( filePath , "w" ) --# Opens the file

local function log(sText) --# You'd use this instead of 'print', it lets you know what is the last line to successfully run.
  f.writeLine( sText )
  f.flush() --# Saves the file, but keeps it open to allow further writes to it.
end

f.close() --# Put this at the end of your program. It saves AND closes the file, freeing it up for other programs to modify.


If the error really only occurs every 24 hours, you might consider writing a short program to restart it when it errors.
Edited on 26 July 2015 - 05:15 AM
Trucidoe #4
Posted 26 July 2015 - 09:20 PM
If the error really only occurs every 24 hours, you might consider writing a short program to restart it when it errors.

Could you possibly give an example of that? I have never tried to code a program to re-run itself if it encounters an error.
HPWebcamAble #5
Posted 27 July 2015 - 03:04 AM
Well you could go really complicated, with coroutines or…



while true do
  shell.run("filePath")
  sleep(0)
end

This could cause a problem if the program errors quickly after starting, but if its only once in a while, this should do the trick.
( It should work, but I've heard of problems with the shell API during startup - let me know if you run into that )
Trucidoe #6
Posted 27 July 2015 - 04:03 AM
Thanks I will give that a try. I appreciate the help.