Question Embeddable UI input stream

Discussion in 'Developer Support' started by Crash, Jul 1, 2016.

  1. I've asked about this on the developers chat, but only got one response that didn't work. So I'll post it here.
    I've implemented an embeddable ui and when I run my bot on my system through intellij it works fine, but when I run it from the bot store I receive the error because of a null pointer from the input stream. I assume it means it can't find the resource, but I honestly do not know why. Any and all help is greatly appreciated. Thanks in advance.


    Null Pointer
    Code (Text):
    1. java.util.concurrent.ExecutionException: java.lang.NullPointerException: inputStream is null.
    2.  at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    3.  at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    4.  at nul.iiiIIIiiiiiI.initialize(jna:88)
    5.  at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
    6.  at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    7.  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
    8.  at nul.iiiiiiiiiIii.byte(xh:156)
    9.  at nul.iiiiiiiiiIii.byte(xh:209)
    10.  at nul.iiiIIIiiiiiI.(jna:137)
    11.  at nul.IIIiIIiiIiIi.byte(slb:1)
    12.  at nul.iIiIiIiIIIii.byte(zsa:22)
    13.  at nul.IiiIiIiiIIIi.byte(mqa:1046)
    14.  at nul.IiiIiIiiIIIi.call(mqa:2269)
    15.  at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
    16.  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    17.  at java.lang.Thread.run(Thread.java:745)
    18. Caused by: java.lang.NullPointerException: inputStream is null.
    19.  at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2455)
    20.  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
    21.  at com.crash.bots.agil_titan.ui.AgilFXGui.(AgilFXGui.java:42)
    22.  at com.crash.bots.agil_titan.Agil_Titan.botInterfaceProperty(Agil_Titan.java:69)
    23.  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    24.  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    25.  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    26.  ... 1 more


    AgilFXGui
    Code (Text):
    1. public class AgilFXGui extends GridPane implements Initializable {
    2.  
    3.     @Override
    4.     public void initialize(URL arg0, ResourceBundle arg1) {
    5.         setVisible(true);
    6.     }
    7.  
    8.     public AgilFXGui(Agil_Titan bot) {
    9.        
    10.         FXMLLoader loader = new FXMLLoader();
    11.        
    12.         Future<InputStream> stream = bot.getPlatform().invokeLater(() -> Resources.getAsStream("com/crash/bots/agil_titan/ui/AgilGui.fxml"));
    13.        
    14.         loader.setController(new AgilUIController(bot));
    15.        
    16.         loader.setRoot(this);
    17.  
    18.         try {
    19.             loader.load(stream.get());
    20.         } catch (IOException | InterruptedException | ExecutionException e) {
    21.             System.err.println("Error loading GUI");
    22.             e.printStackTrace();
    23.         }
    24.  
    25.     }
    26. }
    27.  
    Line 42 is : loader.load(stream.get());
     
  2. Did you make sure that all the files are committed to the svn and that each of the .fxml files are resources in your manifest?

    Ex.
    <resource>com/daugherty2016/bots/CookingDawg/CookingGui.fxml</resource>
    <resource>com/daugherty2016/bots/CookingDawg/CookingInfoUI.fxml</resource>
     
    AlexH666 likes this.
  3. Yes make sure it's set as a resource in manifest.
    Also last time, intellij for some reason did not commit the fxml files by itself until I forced it.
     
    awesome123man likes this.
  4. Yeah all my resources are listed in the manifest. I made sure of that.

    ^^ in manifest. IntelliJ committed all my fxml files, which is why I'm so confused/lost.
     
  5. You must have not declared all your fx:id things in your fxml files. In each controller you need to make sure you at least declare all of them :D

    These are the two items i gave fx:id's in my cookingfxGui.fxml
    which i declare in my cookingFxController.java as v

    @FXML
    private ComboBox Location_ComboBox;

    @FXML
    private Button Start_BT;
     
  6. Nope, I just double checked and they're all declared. :(
    I'm convinced RuneMate/Spectre hates me. You don't even want to know what I had to go through just to be able to successfully set up the svn. It was hell and involved me reformatting my hard drive. It's a long story.
    Any other ideas?
     
  7. Please share the manifest resource element
    --- Double Post Merged, Jul 1, 2016, Original Post Date: Jul 1, 2016 ---
    Sounds like an issue on your end because it's never been that difficult for anyone. It's as simple as opening intellij and checking out from your svn url
     
  8. show us
    AgilGui.fxml
    and AgilFxController.java Plz

    Or go on teamviewer with one of us :p
     
  9. Yeah the svn thing was definitely on my end, which is why I had to jump through so many hoops.


    Okay guys, I feel like an idiot because I just looked at the manifest for both bots. Each bot uses 2 fxml files, but I forgot to list one for each bot. On top of that, for the agil bot I referenced the completely wrong main fxml file. I'm thinking this is most certainly the issue?
     
  10. You are thinking correct :D
     

Share This Page

Loading...