I am getting a NullPointerException when trying to use the Service class
I am getting a NullPointerException which is as follows
java.lang.NullPointerException
file:/K:/Learner/JavaFx2/ProductApplication/dist/run166129449/ProductApplication.jar!/com/product/app/view/viewsingle.fxml
at com.product.app.controller.ViewSingleController.initialize(ViewSingleController.java:70)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
And my View SingleController is as follows
package com.product.app.controller;
import com.product.app.model.Product;
import com.product.app.service.ViewProductsService;
import com.product.app.util.JSONParser;
import com.product.app.util.TagConstants;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javafx.collections.ObservableList;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
import javax.swing.JOptionPane;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
* FXML Controller class
* @author Arun Joseph
public class ViewSingleController implements Initializable {
private static String action = "";
@FXML
private TextField txtID;
@FXML
private TextField txtName;
@FXML
private TextField txtPrice;
@FXML
private TextArea txtDesc;
@FXML
private Region veil;
@FXML
private ProgressIndicator p;
private ViewProductsService service = new ViewProductsService();
private JSONObject product = null;
private JSONParser parser = new JSONParser();
private int pid = 1;
public void setPid(int pid) {
this.pid = pid;
* Initializes the controller class.
@Override
public void initialize(URL url, ResourceBundle rb) {
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
p.setMaxSize(150, 150);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
Product product = new Product();
service.start();
ObservableList<Product> products = service.valueProperty().get();
products.get(pid);
txtID.textProperty().set(String.valueOf(products.get(pid).getPid()));
//product = service.valueProperty().get().get(pid);
//txtID.setText(String.valueOf(product.getPid()));
txtName.textProperty().set(product.getName());
txtPrice.textProperty().set(String.valueOf(product.getPrize()));
txtDesc.textProperty().set(product.getDescription());
private SomeService someService = new SomeService();
@FXML
private void handleUpdateButtonClick(ActionEvent event) {
action = "update";
someService.start();
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
@FXML
private void handleDeleteButtonClick(ActionEvent event) {
action = "delete";
someService.start();
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
@FXML
private void handleCancelButtonClick(ActionEvent event) {
closeStage();
private void closeStage() {
ViewSingleController.stage.close();
private static Stage stage = null;
public static void setStage(Stage stage) {
ViewSingleController.stage = stage;
private class SomeService extends Service<String> {
@Override
protected Task<String> createTask() {
return new SomeTask();
private class SomeTask extends Task<String> {
@Override
protected String call() throws Exception {
String result = "";
int success = 0;
List<NameValuePair> params = new ArrayList<NameValuePair>();
switch (action) {
case "update":
params.add(new BasicNameValuePair("pid", txtID.getText()));
params.add(new BasicNameValuePair("name", txtName.getText()));
params.add(new BasicNameValuePair("price", txtPrice.getText()));
params.add(new BasicNameValuePair("description", txtDesc.getText()));
product = parser.makeHttpRequest(TagConstants.url_update_product_with_id, "POST", params);
success = product.getInt(TagConstants.TAG_SUCCESS);
if (success == 1) {
result = "Successfully Updated the product";
JOptionPane.showMessageDialog(null, result);
closeStage();
break;
case "delete":
params.add(new BasicNameValuePair("pid", txtID.getText()));
product = parser.makeHttpRequest(TagConstants.url_delete_product_with_id, "POST", params);
success = product.getInt(TagConstants.TAG_SUCCESS);
if (success == 1) {
result = "Successfully Deleted the product";
JOptionPane.showMessageDialog(null, result);
closeStage();
break;
return result;
Time Machine has its own mechanism for deleting files. The number you are seeing may represent a "underflow" or a number of files which exceeds the limit and becomes negative.
The best way to remove TM files is via the TM interface: select the files and click the Gear and select delete from all backups.
If you are deleting files on an external drive which once included TM files, it is best to use the terminal and just delete them directly. They go bye-bye without ever seeing the trash bucket.
Of course, using the terminal is not for everyone.
What you might be able to do is restore the files from trash and then delete them properly or in smaller bundles.
Similar Messages
-
Cannot get any exports to work on PDF's after I bought the membership? Any help?
Hi Dylan,
Are you trying to access the service from Acrobat Reader?
Try using the link: https://cloud.acrobat.com/exportpdf sign in with your Adobe ID and try to convert a pdf to doc and check if that works for you.
Regards,
Rave -
PS CS5 Extended on Windows
When trying to use the clone stamp and/or healing brush as soon as I move the cursor from the toolbar over to the image I get an exact copy of the existing layer that moves around the window with the movement of the clone stamp/healing brush. This just started tonight. What's causing this weird behaviour?What are the settings in Window > Clone Source?
-
I keep getting an error when trying to receive the new update iOS7 on iPhone5. Any suggestions?
Do the update using iTunes on your computer.
Plug your iPhone into iTunes (current version), let it sync, then click "Check for Updates" on the iPhone's summary page in iTunes. -
Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.
I may have already resolved this issue buy removing the device from my computer and re-pairing it. It is currently working just fine.
-
I am getting an error when trying to download the new Game of Thrones shows. The error is err = -61 You do not have the privilege to make changes. (err = -61) you do not have the privilege to make changes. I have not had this problem before
Solution:
Open Disk Utility.
Select your external hard disk and run a “verify” on it. After a few minutes (depending on the size of your drive), you should be good to go. You don’t need to run a “repair” on it... (at least I didn’t have to). See photo for reference.
This should fix the permissions issue, because on my Mac running Mountain Lion I was unable to edit the permissions in the get info dialog window even after "unlocking" the drive. -
I get an error when trying to open "The application Creative Cloud can't be opened. -1712
I get an error when trying to open "The application Creative Cloud can't be opened. -1712
The application Install.app can't be opened. -1712
-
I keep getting this error when I try to download apps or songs : MZCommerce.CreditBalance Mismatch.Mobile_message Can someone tell me how to get rid of this? It is very aggravating when trying to use the IPAD.
Try to go to Settings and then Store. Tap to your Apple ID and select View Apple ID. Now choose to check your payment information and when you're done tap Done. I had to rewrite my three digit code of the credit card and now it works.
Oh, I also activated Genius for Apps but I don't think it makes any difference. -
TS1424 Why am I getting error 11222 when trying to access the store?
Why am I getting error 11222 when trying to access the store?
The 11222s can sometimes be associated with LSP issues.
I'd try the following document:
Apple software on Windows: May see performance issues and blank iTunes Store
(If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.) -
I am unable to convert a pdf to a word doc. I get, "An error occured when trying to access the service"
This is the Reader forum, and your question seems to be related with ExportPDF. If it does, you should ask here:
http://forums.adobe.com/community/exportpdf -
I get the following error when trying to use the itunes store "your apple id has been disabled"
I get the following error when trying to use the itunes store "your apple id has been disabled". My account was disabled when someone else had been using it without my knowledge. I changed my apple id password and the apple id is still fine, but itunes has it disabled. I verified that the computer is authorized for this apple id. What to do now?
Welcome to the Apple Community.
Contact Apple through iTunes Store Support -
An error occurred when trying to access the service
I'm asking myself why I purchased a one year subscription to Adobe Reader to convert PDF files to Doc files, when it NEVER WORKS and no one seems to be able to help me!!! I am on a Mac Book Pro with Yosemite (don't upgrade it slows your Mac badly) and whenever I try to convert a pdf to a doc I get 'an error occurred when trying to access the service', can anybody help me please?
Hi Cedric,
The customer service number is 800833687
The direct link for chat support is: http://adobe.ly/19llvMN
You need to click on 'Still need help' to initiate the chat session.
Are you getting this error: "an error occurred when trying to access the service" while trying to access the service via Reader.
Try using the link: https://cloud.acrobat.com/exportpdf sign in with your Adobe ID and try to convert a pdf to doc and check if that works for you.
Reards,
Rave -
Export PDF will not convert a pdf to MS Word. This failure has been going on for about a week. The error message is "An error occurred when trying to access the service." What can I do to get this working again?
Hi,
It seems it was working fine earlier.
Is this happening with all files?
You can try using different browser.
Regards,
Florence -
Program error when trying to use the clone stamp tool - PSE 8
When trying to use the CLONE STAMP TOOL, getting the following: "Could not use the clone stamp tool because of a program error".
Runnng PSE 8 on Windows XP/SP3. I purchased the key to have a full version, versus the 'trial version'. I also have Photo Essentials 3 installed and have used it without any problems.
Any suggestions?I figured it out - it was ID 10 T error...ugh.
Was following along in a book and blindly did what it said....was forgetting to hit the 'alt' key when first defining the area to clone....
However, it was kind of a confusing error message - something like "clone area not defined" would be more of a help.
thanks. -
Limited or no internet connectivity when trying to use The MacU
When trying to use the MacU I get a message of limited or no internet connectivity, and I am actively online.
Hello tanyafromwest alexandria
If you are having issues with connecting to the internet, check out that article below to troubleshoot your issue to get better connectivity.
Wi-Fi: How to troubleshoot Wi-Fi connectivity
http://support.apple.com/kb/HT4628
Regards,
-Norm G.
Maybe you are looking for
-
Should I delete iPhoto now that I've updated the OS and have Photos?
I opened Photos and it seemed to import a lot of photographs, but did it take everything from iPhoto?
-
What is the difference between 11.1.0.1 And 11.1.0.1.1
-
Distiller 8.1.3 Crashes on Startup, and Other Pro8 Woes
I bought Adobe Acrobat Professional 8 a couple years ago, and Distiller 8.1.3 has never worked. I have a Dual 2 GHz PowerPC G5, currently running 10.4.11. Whenever I double-click Distiller, it doesn't even get as far as an opening screen before it
-
OCR suspect corrections not found in search
I created a PDF from a scanned document. I ran the OCR inside Acrobat with Searchable Image. The OCR went fine, except with some mistakes for some of the words. I corrected those words by going through the suspects. I edited the wrongly guessed words
-
Crystal Reports for Eclipse - Using .csv files?
I recently installed crystal reports for Eclipse and much of the basic CR functionality seems to be there, but then I added a .csv file as an ODA flat file data source and I can see it in my "Data Source Explorer", but can not seem to drag it into my