Incomplete instances for multiuser login giving null pointer exception error
Hi
I am facing one problem about Weblogic workflow. We have developed an application
where number of users logs in simultaneouly.
When a user logs in, one instance of workflow gets created. So when more than one
user logs in, that many instanaces gets created. But it gives us the error like "Null
pointerexception". This is beacuse The instanaces which gets created were not getting
completed, they are incomplete. And when I delete these incomplete instances and
try to login one after another user, it works fine. But again when two or more users
logs in at same time we get the same error.
Can you please help me out solving this problem.
Regards,
Rajesh Patil
I have just found out that when this error appear, a folder called splash is created in the same directory as my project folder and the application that I just ran has appeared in there and I can run it from the files in that folder. I can't see anywhere in my code which specifies sending these files to a splash folder.
Does anyone know why this might happen and if this is related to the Null Pointer Exception Error?
-Mark
Similar Messages
-
Xi 3.1 SP3 giving java null pointer exception error on scheduling webi
after we have the system uptime running for a few days and have schedule webi jobs successfully for a few days, we constant get the message java null pointer exception error on scheduling webi.
This only have days after restarting the environment.
Seems to be coming up after scheduling a certain amount of webi reports.
Only doing a stop all services and restart resolves the issue.
XI 3.1 SP3
SAP IK Sp3
Tomcat55
HPUX-IA64 (Hpunix) platform.Hello, I have the same issue. If someone gives you an answer please let me know how to fix it.
-
Why am I receiving Null pointer Exception Error.
why am I receiving Null pointer Exception Error.
Hi I am developing a code for login screen. There is no syntex error as such ut I am receving the aove mentioned error. Can some one please help me ??
------------ Main.java------------------
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Main implements ActionListener
Frame mainf;
MenuBar mb;
MenuItem List,admitform,inquiry,exit,helpn;
Menu newm,update,help;
Inquiry iq;
Admit ad;
// HosHelp hp;
Howuse hu;
Register reg;
Main()
mainf=new Frame(" Engg College V/S Mumbai University ");
mb=new MenuBar();
newm=new Menu(" New ");
update=new Menu(" Update ");
help=new Menu(" Help ");
List=new MenuItem("List");
admitform=new MenuItem("Admit");
inquiry=new MenuItem("Inquiry");
exit=new MenuItem("Exit");
helpn=new MenuItem("How to Use?");
newm.add(List);
newm.add(admitform);
newm.add(inquiry);
newm.add(exit);
help.add(helpn);
mb.add(newm);
mb.add(update);
mb.add(help);
mainf.setMenuBar(mb);
exit.addActionListener(this);
List.addActionListener(this);
inquiry.addActionListener(this);
admitform.addActionListener(this);
helpn.addActionListener(this);
mainf.setSize(400,300);
mainf.setVisible(true);
public void actionPerformed(ActionEvent ae)
if (ae.getSource()==List)
reg=new Register();
if(ae.getSource()==inquiry)
iq=new Inquiry();
if(ae.getSource()==admitform)
ad=new Admit();
if(ae.getSource()==helpn)
hu=new Howuse();
if(ae.getSource()==exit)
mainf.setVisible(false);
public static void main(String args[])
new Main();
-------------Register.java---------------------------
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Register implements ActionListener//,ItemListener
Label id,name,login,pass,repass;
Button ok,newu,cancel,check;
Button vok,iok,lok,mok,sok; //buttons for dialog boxes
TextField idf,namef,loginf,passf,repassf;
Dialog valid,invlog,less,mismat,acucreat;
Frame regis;
Checkbox admin,limit;
CheckboxGroup type;
DBconnect db;
Register()
db=new DBconnect();
regis=new Frame("Registeration Form");
type=new CheckboxGroup();
admin=new Checkbox("Administrator",type,true);
limit=new Checkbox("Limited",type,false);
id=new Label("ID :");
name=new Label("Name :");
login=new Label("Login :");
pass=new Label("Password :");
repass=new Label("Retype :");
idf =new TextField(20); idf.setEnabled(false);
namef=new TextField(30); namef.setEnabled(false);
loginf=new TextField(30); loginf.setEnabled(false);
passf=new TextField(30); passf.setEnabled(false);
repassf=new TextField(30); repassf.setEnabled(false);
ok=new Button("OK"); ok.setEnabled(false);
newu=new Button("NEW");
cancel=new Button("Cancel");
check=new Button("Check Login"); check.setEnabled(false);
vok=new Button("OK");
iok=new Button("OK");
lok=new Button("OK");
mok=new Button("OK");
sok=new Button("OK");
valid=new Dialog(regis,"Login name is valid !");
invlog=new Dialog(regis,"Login name already exist!");
less=new Dialog(regis,"Password is less than six characters !");
mismat=new Dialog(regis,"password & retyped are not matching !");
acucreat=new Dialog(regis,"You have registered successfully !");
regis.setLayout(null);
// regis.setBackground(Color.orange);
valid.setLayout(new FlowLayout());
invlog.setLayout(new FlowLayout());
less.setLayout(new FlowLayout());
mismat.setLayout(new FlowLayout());
acucreat.setLayout(new FlowLayout());
id.setBounds(35,50,80,25); //(left,top,width,hight)
idf.setBounds(125,50,40,25);
name.setBounds(35,85,70,25);
namef.setBounds(125,85,150,25);
login.setBounds(35,120,80,25);
loginf.setBounds(125,120,80,25);
check.setBounds(215,120,85,25);
pass.setBounds(35,155,80,25);
passf.setBounds(125,155,80,25);
repass.setBounds(35,190,80,25);
repassf.setBounds(125,190,80,25);
admin.setBounds(35,225,100,25);
limit.setBounds(145,225,100,25);
ok.setBounds(45,265,70,25);
newu.setBounds(135,265,70,25);
cancel.setBounds(225,265,70,25);
passf.setEchoChar('*');
repassf.setEchoChar('*');
regis.add(id);
regis.add(idf);
regis.add(name);
regis.add(namef);
regis.add(login);
regis.add(loginf);
regis.add(check);
regis.add(pass);
regis.add(passf);
regis.add(repass);
regis.add(repassf);
regis.add(ok);
regis.add(newu);
regis.add(cancel);
regis.add(admin);
regis.add(limit);
valid.add(vok);
invlog.add(iok);
less.add(lok);
mismat.add(mok);
acucreat.add(sok);
ok.addActionListener(this);
newu.addActionListener(this);
check.addActionListener(this);
cancel.addActionListener(this);
// limit.addItemListener(this);
//admin.addItemListener(this);
vok.addActionListener(this);
iok.addActionListener(this);
lok.addActionListener(this);
mok.addActionListener(this);
sok.addActionListener(this);
regis.setLocation(250,150);
regis.setSize(310,300);
regis.setVisible(true);
public void actionPerformed(ActionEvent ae)
if(ae.getSource()==check)
try{
String s2=loginf.getText();
ResultSet rs=db.s.executeQuery("select* from List");
while(rs.next())
if(s2.equals(rs.getString(2).trim()))
// invlog.setBackground(Color.orange);
invlog.setLocation(250,150);
invlog.setSize(300,100);
cancel.setEnabled(false);
ok.setEnabled(false);
check.setEnabled(false);
invlog.setVisible(true);
break;
else
// valid.setBackground(Color.orange);
valid.setLocation(250,150);
valid.setSize(300,100);
cancel.setEnabled(false);
ok.setEnabled(false);
check.setEnabled(false);
valid.setVisible(true);
}catch(Exception e)
e.printStackTrace();
if(ae.getSource()==newu)
try{
ResultSet rs=db.s.executeQuery("select max(ID) from List");
while(rs.next())
String s1=rs.getString(1).trim();
int i=Integer.parseInt(s1);
i++;
String s2=""+i;
idf.setText(s2);
newu.setEnabled(false);
namef.setText(""); namef.setEnabled(true);
loginf.setText(""); loginf.setEnabled(true);
passf.setText(""); passf.setEnabled(true);
repassf.setText(""); repassf.setEnabled(true);
ok.setEnabled(true);
check.setEnabled(true);
}catch(Exception e)
e.printStackTrace();
if(ae.getSource()==ok)
try
String s1=idf.getText();
String s2=loginf.getText();
String s3=passf.getText();
String s4=repassf.getText();
int x=Integer.parseInt(s1);
int t;
if(type.getSelectedCheckbox()==admin)
t=1;
else
t=0;
ResultSet rs=db.s1.executeQuery("select* from List");
while(rs.next())
if(s2.equals(rs.getString(2).trim()))
invlog.setBackground(Color.orange);
invlog.setLocation(250,150);
invlog.setSize(300,100);
cancel.setEnabled(false);
ok.setEnabled(false);
check.setEnabled(false);
invlog.setVisible(true);
break;
else
if (s3.length()<6)
less.setBackground(Color.orange);
less.setLocation(250,150);
less.setSize(300,100);
ok.setEnabled(false);
cancel.setEnabled(false);
check.setEnabled(false);
less.setVisible(true);
else if(!(s3.equals(s4)))
mismat.setBackground(Color.orange);
mismat.setLocation(250,150);
mismat.setSize(300,100);
ok.setEnabled(false);
cancel.setEnabled(false);
check.setEnabled(false);
mismat.setVisible(true);
else
db.s1.execute("insert into User values("+x+",'"+s2+"','"+s3+"',"+t+")");
acucreat.setBackground(Color.orange);
acucreat.setLocation(250,150);
acucreat.setSize(300,100);
regis.setVisible(false);
acucreat.setVisible(true);
}//else
}//while
} //try
catch(Exception e1)
// e1.printStackTrace();
if (ae.getSource()==cancel)
regis.setVisible(false);
if (ae.getSource()==vok)
ok.setEnabled(true);
cancel.setEnabled(true);
check.setEnabled(true);
valid.setVisible(false);
if (ae.getSource()==iok)
ok.setEnabled(true);
cancel.setEnabled(true);
check.setEnabled(true);
invlog.setVisible(false);
if (ae.getSource()==lok)
less.setVisible(false);
cancel.setEnabled(true);
ok.setEnabled(true);
check.setEnabled(true);
if (ae.getSource()==mok)
mismat.setVisible(false);
cancel.setEnabled(true);
ok.setEnabled(true);
check.setEnabled(true);
if (ae.getSource()==sok)
acucreat.setVisible(false);
ok.setEnabled(false);
newu.setEnabled(true);
regis.setVisible(true);
public static void main(String args[])
new Register();
-----------DBConnect.java------------------------------------
import java.sql.*;
public class DBconnect
Statement s,s1;
Connection c;
public DBconnect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("jdbc:odbc:Sonal");
s=c.createStatement();
s1=c.createStatement();
catch(Exception e)
e.printStackTrace();
----------Login.java----------------
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Login implements ActionListener
Frame log;
Label login,pass;
TextField loginf,passf;
Button ok,cancel;
Dialog invalid;
Button iok;
Register reg;
DBconnect db;
Main m;
Login()
db=new DBconnect();
log=new Frame();
log.setLocation(250,210);
login=new Label("Login :");
pass=new Label("Password :");
loginf=new TextField(20);
passf=new TextField(20);
passf.setEchoChar('*');
ok=new Button("OK");
// newu=new Button("New User");
cancel=new Button("CANCEL");
iok=new Button(" OK ");
invalid=new Dialog(log,"Invalid User!");
//log.setBackground(Color.cyan);
//log.setForeground(Color.black);
log.setLayout(null);
// iok.setBackground(Color.gray);
invalid.setLayout(new FlowLayout());
login.setBounds(35,50,70,25); //(left,top,width,hight)
loginf.setBounds(105,50,100,25);
pass.setBounds(35,85,70,25);
passf.setBounds(105,85,70,25);
ok.setBounds(55,130,70,25);
// newu.setBounds(85,120,80,25);
cancel.setBounds(145,130,70,25);
log.add(login);
log.add(loginf);
log.add(pass);
log.add(passf);
log.add(ok);
// log.add(newu);
log.add(cancel);
invalid.add(iok);//,BorderLayout.CENTER);
ok.addActionListener(this);
// newu.addActionListener(this);
cancel.addActionListener(this);
iok.addActionListener(this);
log.setSize(300,170);
log.setVisible(true);
public void actionPerformed(ActionEvent a)
if(a.getSource()==ok)
try{
String l=loginf.getText();
String p=passf.getText();
ResultSet rs=db.s.executeQuery("select * from List");
while(rs.next())
if(l.equals(rs.getString(2).trim())&& p.equals(rs.getString(3).trim()))
String tp=rs.getString(4).trim();
int tp1=Integer.parseInt(tp);
log.setVisible(false);
if(tp1==1)
m=new Main();
// m.List.setEnabled(true);
else
m=new Main();
m.List.setEnabled(false);
break;
else
invalid.setBackground(Color.orange);
invalid.setSize(300,100);
invalid.setLocation(250,210);
cancel.setEnabled(false);
ok.setEnabled(false);
invalid.setVisible(true);
}catch(Exception e1)
e1.printStackTrace();
if (a.getSource()==cancel)
log.setVisible(false);
if (a.getSource()==iok)
invalid.setVisible(false);
loginf.setText("");
passf.setText("");
cancel.setEnabled(true);
ok.setEnabled(true);
public static void main(String[] args)
new Login();
-------------inquiry.java---------------------------------
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.Date;
import java.text.*;
import java.sql.*;
public class Inquiry implements ActionListener
Frame inqry;
Label name,addr;
TextField namef,addrf;
Button ok,cancel,dok;
Dialog invalid;
Frame result; //Result of the inquiry....
Label lrname,lraddr,lward,lrdate,lcdate;
TextField rname,raddr,ward,rdate,cdate;
Date d;
DateFormat df;
Button rok,rcancel;
Dialog success;
Button rdok;
DBconnect db;
Inquiry()
db=new DBconnect();
inqry=new Frame("Inquiry Form");
inqry.setLayout(null);
inqry.setBackground(Color.cyan);
name=new Label(" NAME ");
addr=new Label("ADDRESS");
namef=new TextField(20);
addrf=new TextField(20);
ok=new Button("OK");
cancel=new Button("CANCEL");
dok=new Button("OK");
invalid=new Dialog(inqry,"Invalid Name or Address !");
invalid.setSize(300,100);
invalid.setLocation(300,180);
invalid.setBackground(Color.orange);
invalid.setLayout(new FlowLayout());
result=new Frame(" INQUIRY RESULT "); //Result Window......
result.setLayout(null);
result.setBackground(Color.cyan);
lcdate=new Label(" DATE ");
lrname=new Label(" NAME ");
lraddr=new Label(" ADDRESS ");
lward=new Label(" WARD ");
lrdate=new Label(" ADMIT-DATE ");
cdate=new TextField(10);
rname=new TextField(20);
rname.setEnabled(false);
raddr=new TextField(20);
raddr.setEnabled(false);
ward=new TextField(20);
ward.setEnabled(false);
rdate=new TextField(10);
rdate.setEnabled(false);
cdate=new TextField(20);
d=new Date();
df=DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.KOREA);
cdate.setText(df.format(d));
cdate.setEnabled(false);
rok=new Button(" OK ");
rcancel=new Button("CANCEL");
name.setBounds(40,50,50,25);
namef.setBounds(120,50,130,25);
addr.setBounds(40,100,60,25);
addrf.setBounds(120,100,80,25);
ok.setBounds(60,145,70,25);
cancel.setBounds(140,145,70,25);
lcdate.setBounds(200,50,60,25); //Result Window......
cdate.setBounds(270,50,80,25);
lrname.setBounds(35,85,70,25);
rname.setBounds(140,85,180,25);
lraddr.setBounds(35,120,80,25);
raddr.setBounds(140,120,100,25);
lward.setBounds(35,155,80,25);
ward.setBounds(140,155,100,25);
lrdate.setBounds(30,190,80,25);
rdate.setBounds(140,190,80,25);
rok.setBounds(70,240,70,25);
rcancel.setBounds(170,240,70,25);
inqry.add(name);
inqry.add(namef);
inqry.add(addr);
inqry.add(addrf);
inqry.add(ok);
inqry.add(cancel);
invalid.add(dok);
result.add(lcdate); //Result Window......
result.add(cdate);
result.add(lrname);
result.add(rname);
result.add(lraddr);
result.add(raddr);
result.add(lward);
result.add(ward);
result.add(lrdate);
result.add(rdate);
result.add(rok);
result.add(rcancel);
ok.addActionListener(this);
cancel.addActionListener(this);
dok.addActionListener(this);
rok.addActionListener(this); //Result Window......
rcancel.addActionListener(this);
inqry.setSize(280,180);
inqry.setLocation(300,180);
inqry.setVisible(true);
result.setSize(400,280); //Result Window......
result.setLocation(200,150);
result.setVisible(false);
public void actionPerformed(ActionEvent ae)
if(ae.getSource()==ok)
try
String nm=namef.getText();
String ad=addrf.getText();
inqry.setVisible(false);
ResultSet rs=db.s.executeQuery("select * from Billinformation");
while(rs.next())
String nm1=rs.getString(2).trim();
String ad1=rs.getString(3).trim();
int k=0;
if((nm1.equals(nm))&&(ad1.equals(ad)))
String adm=rs.getString(5).trim();
String wr=rs.getString(6).trim();
String bd=rs.getString(8).trim();
String wrb=wr+"-"+bd;
result.setVisible(true);
rname.setText(nm1);
raddr.setText(ad1);
ward.setText(wrb);
rdate.setText(adm);
k=1;
break;
}//if
else if(k==1)
invalid.setVisible(true);
}//while
}//try
catch(Exception e)
e.printStackTrace();
} //getsource ==ok
if(ae.getSource()==cancel)
inqry.setVisible(false);
if(ae.getSource()==rok) //Result Window......
namef.setText("");
addrf.setText("");
result.setVisible(false);
inqry.setVisible(true);
if(ae.getSource()==rcancel)
result.setVisible(false);
if(ae.getSource()==dok)
namef.setText("");
addrf.setText("");
invalid.setVisible(false);
inqry.setVisible(true);
public static void main(String args[])
new Inquiry();
PLease Help me !!
I need this urgently.can you explain what your program tries to do... and
at where it went wrong..Sir,
We are trying to make an project where we can make a person register in our data base & after which he/she can search for other user.
The logged in user can modify his/her own data but can view other ppl's data.
We are in a phase of registering the user & that's where we are stuck. The problem is that after the login screen when we hit register (OK- button) the data are not getting entered in the data base.
Can u please help me??
I am using "jdk1.3' - studnet's edition.
I am waiting for your reply.
Thanks in advance & yr interest. -
Null Pointer Exception Error's in WebDynpro Java
Hi All,
How Types are coming Null Pointer Exception Error's in WebDynpro Java, Please provide the types.of Errors.
Ex. Cardinality Type not correct etc...
Thanks,
Bye,
Vijay Hari.HI
Null Pointer Exception can occur in may instances , for suppose
1) when you create a Value Node with some attribute which has cardinality , and you have not
initialized the Node , then it would through Null Pointer exception ,
2) when you integrate the RFC and parameters you pass as input to the RFC are not set correctly
then there could be null pointer when you execute the RFC
3>or may be when you doesnot bind the node when using webservice then there could be null pointer exception
and there could be many occurances for the exception -
Hi All
I have to add an input field which will accept email Id from users. This field has to be kept mandatory. I have kept a check on the value entered. If the user does not enter any value, an error message should be displayed. Below is the code that I have written. Whenever, the user keeps this field blank and submits the form, null point exception error is displayed.
Please help how to overcome this problem
email = wdContext.currentContextElement().getEmail_Id();
try{
if (wdContext.currentContextElement().getEmail_Id().equals("") )
IWDMessageManager msg = wdThis.wdGetAPI().getComponent().getMessageManager();
msg.reportMessage(IMessageTender_ResignationComp.PERSONAL_EMAIL_ID,new Object[]{"Please enter correct Email Id"},true);
elseHi,
Change the following code to
email = wdContext.currentContextElement().getEmail_Id();
try{
if (wdContext.currentContextElement().getEmail_Id().equals("") )
IWDMessageManager msg = wdThis.wdGetAPI().getComponent().getMessageManager();
msg.reportMessage(IMessageTender_ResignationComp.PERSONAL_EMAIL_ID,new Object[]{"Please enter correct Email Id"},true);
if (wdContext.currentContextElement() != null)
email = wdContext.currentContextElement().getEmail_Id();
if ( email.equals("") )
IWDMessageManager msg = wdThis.wdGetAPI().getComponent().getMessageManager();
msg.reportMessage(IMessageTender_ResignationComp.PERSONAL_EMAIL_ID,new Object[]{"Please enter correct Email Id"},true);
Regards
Ayyapparaj -
JFrame will not close giving null pointer exception
Hello ev1, Heres what I'm doing, I have a menu with JButtons that when pressed will take you to a game (this works fine). When your done with the game, you press a button that closes the JFrame(game) and starts the menu again (this gives the error null pointer exception). Heres a brief summary of the design:
FullScreenSetup class
has openWindow() that sets up a new full screen JFrame. (works)
has closeWindow() that removes everything in the contentPane and sets
visible(false).
GameMenu class
uses FullScreenSetup via FullScreenSetup window;
uses window.openWindow() to set up the window.
also sets up the buttons and handles them when pressed
VideoPoker class (the game)
uses FullScreenSetup via FullScreenSetup window;
runs the game and has the button that should close the window and go
back to the menu.
heres how i thought it should work, in the actionPerformed method I have
window.closeWindow(); <- this gives me the error
new GameMenu(); <- this is my ultimate goal (hopefully brings me
back to the menu screen to choose another game)
I hope what I have written is enough for someone to help me because I know what it is like to read through hundreds of lines of code to help someone. Thx.What I cannot understand is that when going from the menu to the game I use window.closeWindow(); so that I can clear the menu and paste the game on the screen this works fine. so why does it not work a second time?
-
Problem in getEelementById() method-null pointer exception
Hi All,
I am using DocumentBuilder factory for parsing a xml file.
I am getting the document object and also creating an element in
the root element .And also I am setting the element id for the
element as attiribute .I need to select the element having same ID
using getElementById() method .But it is giving null pointer
exception.
N.B: My parsing file contains dtd declaration and root element.
My sample code look like this;
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db=dbf.newDocumentBuilder();
Document doc=db.parse(ne File("C:/index.xml");
Element root t=doc.getDocumentElement();
root.setAttribute("ID","12345");
Element oElement = doc.createElement(element_name);
oElement.setAttribute("ID",element_id);
Element oEle=doc.getElementById(element_id);
Could anyone please to solve this problem.
Please do favour with me.
Thanks and Regards,
Sreekanthwhile creating xml you should mention which attribute is ID attribute using
setIDAttribute() method,
as you are setting "ID" attribute as ID so
after adding Id attribute to the root element
use setIDAttribute("ID",true);
then getElementById will return the element by using ID
regards
shivakumar.T -
Null pointer exception in ISimpleTypeModifiable
Hi
I am trying to add values to dropdownbykey dynamically using this code:
IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("PROCESS");
ISimpleTypeModifiable processType = attributeInfo.getModifiableSimpleType();
processType.setFieldLabel("PROCESS");
IModifiableSimpleValueSet valueSet = processType.getSVServices().getModifiableSimpleValueSet();
Code is giving null pointer exception in the following line:
ISimpleTypeModifiable processType = attributeInfo.getModifiableSimpleType();
How to Solve it.Its urgent.
Points will be awarded.Actually the process is the attribute of node within context.
so i changed the code to:
IWDAttributeInfo attributeInfo = wdContext.nodeAuditNode().getNodeInfo().getAttribute("PROCESS") ;
ISimpleTypeModifiable processType = attributeInfo.getModifiableSimpleType();
processType.setFieldLabel("PROCESS");
IModifiableSimpleValueSet valueSet = processType.getSVServices().getModifiableSimpleValueSet();
The second point is: we can't modify the data type of mapped attribute in view controller.
So for that, we have to write that code in component controller. -
Null pointer exception with Lists
Hi,
I have got a problem with java.util.List. It is giving Null pointer exception whenever I try to add after extracting from my XML file.I have written the code like this:
List year; //Global variable
List loaddatas; //Global variable
Element e1; //Global
loaddatas=root.getChild("Load").getChildren("LoadData");
int k=loaddatas.size();
for(int i=0;i<loaddatas.size();i++)
e1=(Element)loaddatas.get(i);
year.add(i,Integer.valueOf(e1.getChildText("Year"))); // I am getting exception here.....
root is root element in XML file.
I am able to display "Integer.valueOf(e1.getChildText("Year"))" correctly.
Anybody please tell me how to solve this.
Thanks,
Sai RamLooks like somebody forgot to learn to program before starting to write code....
List list = new ArrayList(); -
Null Pointer exception in accessing EJB in 9.0.3
Hi
The application is working fine with 9.0.2, but when I deployed in 9.0.3 it is giving Null Pointer Exception, throwing the error message in Stack Trace.
==========================================================
java.lang.NullPointerException
at com.evermind.server.ejb.EJBUtils.cloneOneObjectInstance(EJBUtils.java:416)
at com.evermind.server.ejb.EJBUtils.cloneArrayList(EJBUtils.java:599)
at com.evermind.server.ejb.EJBUtils.cloneObject(EJBUtils.java:357)
at ETOperationUtilitiesSession_StatelessSessionBeanWrapper136.getHouseChargesPrefs(ETOperationUtilitiesSession_StatelessSessionBeanWrapper136.java:5965)
at ETAHouseDocumentController.doPost(ETAHouseDocumentController.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermi[i]Long postings are being truncated to ~1 kB at this time.Hi
The Problem which I posted earlier seems to be like..
If a EJB (Remote) has a method that returns an ArrayList, and one of the entries of the ArrayList is null, we get a NullPointerException, when clonnning the ArrayList .
This looks same as the one posted in relation EJB-Remote returning HashMap has null values. -
Help with Null Pointer Exception
Hi, I am working on a simple menu program. It compiles and works correctly except for one item. I am having a problem with Greying out a menu item...... Specifically, When I press the EDIT / OPTIONS / READONLY is supposed to Greyout the Save and SaveAs options. But, when I do that it displays a Null Pointer Exception error message in the command window.
Your advice would be much appreciated!
Now for the code
/ FileName Menutest.java
// Sample Menu
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class MenuTest extends JFrame {
private Action saveAction;
private Action saveAsAction;
private JCheckBoxMenuItem readOnlyItem;
// set up GUI
public MenuTest()
super( "Menu Test" );
//* file menu and menu items
// set up File menu and its menu items
JMenu fileMenu = new JMenu( "File" );
// set up New menu item
JMenuItem newItem = fileMenu.add(new TestAction( "New" ));
// set up Open menu item
JMenuItem openItem = fileMenu.add(new TestAction( "Open" ));
// add seperator bar
fileMenu.addSeparator();
// set up Save menu item
JMenuItem saveItem = fileMenu.add(new TestAction( "Save" ));
// set up Save As menu item
JMenuItem saveAsItem = fileMenu.add(new TestAction( "Save As" ));
// add seperator bar
fileMenu.addSeparator();
// set up Exit menu item
JMenuItem exitItem = new JMenuItem( "Exit" );
exitItem.setMnemonic( 'x' );
fileMenu.add( exitItem );
exitItem.addActionListener(
new ActionListener() { // anonymous inner class
// terminate application when user clicks exitItem
public void actionPerformed( ActionEvent event )
System.exit( 0 );
} // end anonymous inner class
); // end call to addActionListener
//* Edit menu and menu items
// set up the Edit menu
JMenu editMenu = new JMenu( "Edit" );
//JMenuItem editMenu = new JMenu( "Edit" );
// set up Cut menu item
Action cutAction = new TestAction("Cut");
cutAction.putValue(Action.SMALL_ICON, new ImageIcon("cut.gif"));
// set up Copy menu item
Action copyAction = new TestAction("Copy");
copyAction.putValue(Action.SMALL_ICON, new ImageIcon("copy.gif") );
// set up Paste menu item
Action pasteAction = new TestAction("Paste");
pasteAction.putValue(Action.SMALL_ICON, new ImageIcon("paste.gif") );
editMenu.add(cutAction);
editMenu.add(copyAction);
editMenu.add(pasteAction);
// add seperator bar
editMenu.addSeparator();
// set up Options menu, and it submenus and items
JMenu optionsMenu = new JMenu("Options");
readOnlyItem = new JCheckBoxMenuItem("Read-only");
readOnlyItem.addActionListener(
new ActionListener()
{ // anonymous inner class
public void actionPerformed( ActionEvent event)
saveAction.setEnabled(!readOnlyItem.isSelected());
saveAsAction.setEnabled(!readOnlyItem.isSelected());
} // end anonymous inner class
); // end call to addActionListener
optionsMenu.add(readOnlyItem);
// add seperator bar
optionsMenu.addSeparator();
// Work on Radio Buttons
ButtonGroup textGroup = new ButtonGroup();
JRadioButtonMenuItem insertItem = new JRadioButtonMenuItem("Insert");
insertItem.setSelected(true);
JRadioButtonMenuItem overTypeItem = new JRadioButtonMenuItem("Overtype");
textGroup.add(insertItem);
textGroup.add(overTypeItem);
optionsMenu.add(insertItem);
optionsMenu.add(overTypeItem);
editMenu.add(optionsMenu);
//* Help menu and menu items
// set up the Help menu
JMenu helpMenu = new JMenu( "Help" );
helpMenu.setMnemonic( 'H' );
// set up index menu item
JMenuItem indexItem = helpMenu.add(new TestAction( "Index" ));
indexItem.setMnemonic( 'I' );
helpMenu.add( indexItem );
// set up About menu item
JMenuItem aboutItem = new JMenuItem( "About" );
aboutItem.setMnemonic( 'A' );
helpMenu.add( aboutItem );
aboutItem.addActionListener(
new ActionListener() { // anonymous inner class
// display message dialog when user selects Open
public void actionPerformed( ActionEvent event )
JOptionPane.showMessageDialog( MenuTest.this,
"This is MenuTest.java \nVersion 1.0 \nMarch 15, 2004",
"About", JOptionPane.PLAIN_MESSAGE );
} // end anonymous inner class
); // end call to addActionListener
// create menu bar and attach it to MenuTest window
JMenuBar bar = new JMenuBar();
setJMenuBar( bar );
bar.add( fileMenu );
bar.add( editMenu );
bar.add( helpMenu );
setSize( 500, 200 );
setVisible( true );
} // end constructor
public static void main( String args[] )
MenuTest application = new MenuTest();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
// inner class to handle action events from menu items
private class ItemHandler implements ActionListener {
// process color and font selections
public void actionPerformed( ActionEvent event )
repaint();
} // end method actionPerformed
} // end class ItemHandler
// Prints to action name to System.out
class TestAction extends AbstractAction
public TestAction(String name) { super(name); }
public void actionPerformed( ActionEvent event )
System.out.println(getValue(Action.NAME) + " selected." );
} // end class TestAction
} // end class MenuTestalan, I've been trying to figure out a solution.
You can initialize it like this
private Action saveAction= new Action();
private Action saveAsAction=new Action();
THE ABOVE WILL NOT WORK.
because Action is an interface. An interface does not have constructors. However, interface references are used for polymorphic purposes.
Anyway, all you have to do is find some class that implemets Action interface.... I cant seem to find one. Or maybe this is not how its supposed to be done?
Hopefully, someone can shed some light on this issue.
FYI,
http://java.sun.com/products/jfc/swingdoc-api-1.1/javax/swing/Action.html -
Null Pointer Exception on stmt = conn.prepareStatement( query );
I configured the Tomcat 5.0.27 for using the connection pool feature and connecting to the Oracle. I am testing if I did the configuration correctly. Therefore, I try to retrieve some data from a table. I got the
'Null Pointer Exception" when executing the
stmt = conn.prepareStatement( query );I am not sure where the problem is from.
1. configuration is not done properly?
2. some bugs in my program?
I need your help to diagnose the problem. The messages in the Tomcat log are shown below my program coce.
The code for class where the 'Null Pointer Exception' occurred is like:
package org.dhsinfo.message.dao;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.SQLException;
import org.dhsinfo.message.MemberBean;
import org.dhsinfo.message.exceptions.MemberDAOSysException;
import org.dhsinfo.ConnectionPool.DBConnection;
public class OracleMemberDAO implements MemberDAO
// Here the return type is Collection
public Collection findMembers()
throws MemberDAOSysException
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
MemberBean memberBean;
Collection members = new ArrayList();
String query = "SELECT name FROM PersonType";
try
conn = DBConnection.getDBConnection();
stmt = conn.prepareStatement( query ); // line number 32
rs = stmt.executeQuery();
while( rs.next() )
memberBean = new MemberBean();
memberBean.setName( rs.getString( "name" ) );
members.add( memberBean );
return members;
catch (SQLException se)
se.printStackTrace( System.err );
throw new MemberDAOSysException("SQLException: " + se.getMessage());
finally
if ( conn != null )
try
rs.close();
rs = null;
stmt.close();
stmt = null;
conn.close();
catch( SQLException sqlEx )
System.out.println( "Problem occurs while closing " + sqlEx );
conn = null;
}java.lang.NullPointerException
at org.dhsinfo.message.dao.OracleMemberDAO.findMembers(OracleMemberDAO.java:32)
at org.dhsinfo.message.MemberService.getMembers(MemberService.java:18)
at org.dhsinfo.message.SendMessage.execute(SendMessage.java:29)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)Here is my DBConnection.java class. I have used it many times. I feel like going one by one. If it is not my DBConnection .java class, then the next thing to look at is my connection pool configuration. I have a feeling that it is my connection pool configuration.
package org.dhsinfo.ConnectionPool;
import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class DBConnection
public static Connection getDBConnection() throws SQLException
Connection conn = null;
try
InitialContext ctx = new InitialContext();
DataSource ds = ( DataSource ) ctx.lookup( "java:comp/env/jdbc/OracleDB" );
try
conn = ds.getConnection();
catch( SQLException e )
System.out.println( "Open connection failure: " + e.getMessage() );
catch( NamingException nEx )
nEx.printStackTrace();
return conn;
} -
Popup window null pointer exception
Hi,
I have created a web dynpro application like this: a first window with a button that calls a popup with user info and telephone number and a button OK.
When I click on OK, the popup window close perfectly, but if I click again on the button of the first page to see again the popup, I get a null pointer exception error:
The initial exception that caused the request to fail, was:
java.lang.NullPointerException
at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.handle(ApplicationWindow.java:258)
at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.handleWindowEvents(ApplicationWindow.java:239)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:149)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
The popup code:
IWDWindow myPopup = wdContext.currentPopupNodeElement().getPopupAttribute();
if (myPopup == null)
IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PopWin");
myPopup = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
myPopup.setWindowPosition(200, 200);
wdContext.currentPopupNodeElement().setPopupAttribute(myPopup);
wdContext.currentPopupNodeElement().setUserName("thibault");
wdContext.currentPopupNodeElement().setUserTelNumber("01010101");
myPopup.show();
The close function for the popup:
IWDWindow window = wdContext.currentPopupNodeElement().getPopupAttribute();
window.hide();
window.destroyInstance();
Has any one got any solution, I would really appreciate your help.
Thibault SchalckHi,
Try changing your code like this under popup.
IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PopWin");
IWDWindow myPopup = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
wdContext.currentPopupNodeElement().setPopupAttribute(myPopup);
myPopup.setWindowPosition(200, 200);
wdContext.currentPopupNodeElement().setPopupAttribute(myPopup);
wdContext.currentPopupNodeElement().setUserName("thibault");
wdContext.currentPopupNodeElement().setUserTelNumber("01010101");
myPopup.show();
Kiran -
IOS default native extension packaging null pointer exception
I have an ANE that currently has a specific implementation for Android and a default implementation. Packaging up the .apk for android works fine on my android devices and packaging up a windows destop version (I created a separate desktop air application to do this) that uses the default ANE implementation works fine.
The problem is when trying to packaging the ipa for iOS that uses the ANE. I get the following error when I try a "Export Release Build" of my mobile app for iOS. It should be using the default ANE implementation.
Error occurred while packaging the application:
Warning: Using default implementation for native extension '<my ane extension id here>'
unexpected failure: null
java.lang.NullPointerException
at com.adobe.png.PNGUtils.updatePNGMetadata(PNGUtils.java:60)
at com.adobe.air.ipa.IPAOutputStream.addFile(IPAOutputStream.java:557)
at com.adobe.air.ADTOutputStream.addFileFromStream(ADTOutputStream.java:299)
at com.adobe.air.ADTOutputStream.addFileFromStream(ADTOutputStream.java:292)
What is missing? I've successfully packaged IPAs before but they didn't use any ANEs. This app will eventually have it's own iOS ANE implementation but it should just use the default if there is no iOS implementation available.
RandyWhile using ipa-test-interpreter or ipa-debug-interpreter (and also removing the -platformsdk argument during IPA packaging) fixed ipa-test and ipa-debug builds, it did not fix ipa-ad-hoc or ipa-app-store builds. Our entire build automation system relies on ant based builds, so at the moment using Flex 4.6 and AIR 3.4 is basically out of the question because of the null pointer exception error that eckhoff_randy pointed out above.
Without AIR 3.4 we do not have iOS 6 support (meaning we don't have iPhone 5 support either).
This is a MAJOR problem. I'm not sure that 'waiting until the next release' is an acceptable answer at this point. If possible can you give me as much information as you have on this problem?
Here's what's my output looks like:
[exec] [Fatal Error] :1:1: Content is not allowed in prolog.
[exec] java.io.IOException: PLIST generation failed due to SAX error:org.xml.sax.SAXParseException: Content is not allowed in prolog.
[exec]
at com.adobe.air.Plist.newFromString(Plist.java:351)
[exec]
at com.adobe.air.Plist.newFromFile(Plist.java:325)
[exec]
at com.adobe.air.ipa.IPAOutputStream.setSDKVersion(IPAOutputStream.java:1067)
[exec]
at com.adobe.air.ipa.IPAOutputStream.setPlatformSDKLocation(IPAOutputStream.java:969)
[exec]
at com.adobe.air.ipa.IPAPackager.setDeviceSDKDirectory(IPAPackager.java:187)
[exec]
at com.adobe.air.ADT.parseFileAndPathArguments(ADT.java:1423)
[exec]
at com.adobe.air.ADT.parseDescriptorAndFileset(ADT.java:1474)
[exec]
at com.adobe.air.ADT.parseInput(ADT.java:929)
[exec]
at com.adobe.air.ADT.parsePackage(ADT.java:672)
[exec]
at com.adobe.air.ADT.parseArgsAndGo(ADT.java:570)
[exec]
at com.adobe.air.ADT.run(ADT.java:419)
[exec]
at com.adobe.air.ADT.main(ADT.java:469)
[exec] unexpected failure: null
[exec] java.lang.NullPointerException
[exec]
at com.adobe.air.ipa.IPAOutputStream.addExtensionAbc(IPAOutputStream.java:1031)
[exec]
at com.adobe.air.ipa.IPAPackager.addExtensions(IPAPackager.java:351)
[exec]
at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java:68)
[exec]
at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:245)
[exec]
at com.adobe.air.ADT.parseArgsAndGo(ADT.java:571)
[exec]
at com.adobe.air.ADT.run(ADT.java:419)
[exec]
at com.adobe.air.ADT.main(ADT.java:469) -
Null pointer Exception with Float.parseFloat
I need to assign a float value from a database to a variable recurrently throughout a while loop. but i am getting a null pointer exception error:
while ( rs.next() )
out.println("<TR>");
float corr = Float.parseFloat((String) request.getParameter("echo"));
out.println("<center><TD><b><font color = #990000>" + rs.getString("race_number") + "</b></TD>");
out.println("<center><TD><b><font color = #990000>" + rs.getString("sail_number") + "</b></TD>");
out.println("<center><TD><b><font color = #990000>" + rs.getString("finish_time_elapsed") + "</b></TD>");
out.println("<center><TD><b><font color = #990000>" + rs.getString("echo") + "</b></TD>");
out.println("</TR>");
I've also tried:
float corr = Float.parseFloat( String request.getParameter("echo"));
float corr = 0;
corr Float.parseFloat((String) request.getParameter("echo"));
corr = echo;
corr = request.getParameter("echo");
corr = rs.getString("echo");
corr = Float.parseFloat(request.getParameter("echo"));
temp = rs.getFloat("Problem_Description");
Any ideas Please!!!Null pointer exception means that the value you are trying to turn into a Float is null. Probably request.getParameter("echo") returns null.
Is "echo" a request parameter, or a field you want to get from the database?
request.getParameter() has nothing to do with a database query.
That is your http request coming from the form submission. It won't change.
If "echo" is meant to be a request parameter, then make sure the parameter is actually present.
If its a database field (stored as a number) then
float corr = rs.getFloat("echo");
should do the trick.
Can the value be null in the database?
Cheers,
evnafets
Maybe you are looking for
-
I added Icloud to join my calendar on my phone to another person. It erased all history date from previous months. how do I get that data back?
-
What is my computer worth today?
How much do you think my Power Mac G5 is worth? *Power Mac G5* Rev A Processor: Dual 1.8GHz Power PC G5 Memory: 4.5GB DDR400 (PC3200) RAM Hard Drive: 160GB Serial ATA 300GB Serial ATA Optical Drive: Super Drive (DVD-R/CD-RW) Graphics Support: ATI Rad
-
How do I get CTRL + 0 to work?
I just upgraded to PSE 11 and can't get CTRL + 0 (zero) to work. My OS is Windows Vista. I have friends who are using Windows 7 and it works for them. I use CTRL + 0 all the time and need it to work with PSE 11. Is there anyone out there who can
-
I have just completed a file. (1.3 hours long) I am using an Lacie external work from and save to. I can not share this file in order to make a DVD. One frame is saved not the entire file... Sugestions please. I've put in many hours to comeplete
-
Is there a way to attach multiple photos or any file attachment when sending an email with the iphone.