CLOB.createTemporary gives Nullpointer Exception
Hello,
I'm trying to create a temporary clob in my java code, but when I run the program I get the following exception.
java.lang.NullPointerException
at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1354)
at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)
at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)
at oracle.sql.CLOB.createTemporary(CLOB.java:527)
at org.tennet.utils.bc4j.ApplicationModuleImpl.createClob(ApplicationModuleImpl.java:278)
at org.tennet.utils.bc4j.ApplicationModuleImpl.createClobDomain(ApplicationModuleImpl.java:299)
at org.tennet.nevada.loader.ResultLoader.executeProcedure(ResultLoader.java:243)
at org.tennet.nevada.loader.ResultLoader.process(ResultLoader.java:77)
at org.tennet.nevada.broker.processor.RequestProcessor.processResult(RequestProcessor.java:374)
at org.tennet.nevada.broker.processor.LoadFlowVAProcessor.process(LoadFlowVAProcessor.java:132)
at org.tennet.nevada.broker.RequestHandler.processRequest(RequestHandler.java:289)
at org.tennet.nevada.broker.RequestHandler.run(RequestHandler.java:137)
This error started when I began using Data Sources instate of direct JDBC Connections.
The problem is there is no source available for this class so I cant look what is causing the Nullpointer Exception.
Can someone tell me what is causing this problem?
Regards,
Dennis Labordus
Hi Dennis,
I have had the same problem as this. I am going to get onto Oracle via Metalink about it.
However - there is a work around.
We are using OC4J with its data sources.
There is a method on the OC4J Connection called getCoreConnection(Connection). This returns the underlying Oracle connection.
If you then pass this underlying oracle connection to CLOB.createTemporary() it works.
We had to use reflection to call the method as I couldn't seem to cast it statically.
Paul McHugh
* getOracleConnection
* Derive oracle connection from DataSource connection
private static OracleConnection getOracleConnection (Connection connection) throws SQLException
System.err.println ("UserTypeImpl.getOracleConnection: " + connection);
* Check for an existing oracle connection
* This should be the case in a database deployment
if (connection instanceof oracle.jdbc.driver.OracleConnection)
System.err.println (" Connection is already the base Oracle Connection" + connection);
return (OracleConnection) connection;
* Check for an OC4J deployment
else
System.err.println (" Searching for core connection ...");
Object conObj = (Object) connection;
Class conclass = conObj.getClass();
OracleConnection coreCon = null;
Method meth = null;
// Locate method getCoreConnection on Orion data source
try {
Class[] parameterTypes = new Class[] {java.sql.Connection.class};
meth = conclass.getMethod("getCoreConnection", parameterTypes);
} catch (NoSuchMethodException e)
e.printStackTrace();
throw new SQLException ("UserTypeImpl.getOracleConnection: No such method: getCoreConnection: " + e);
// Invoke method getCoreConnection on orion data source
try {
Object[] args = new Object[] {connection};
coreCon = (OracleConnection) meth.invoke(conObj, args);
catch (InvocationTargetException e)
e.printStackTrace();
throw new SQLException ("UserTypeImpl.getOracleConnection: Invoke: getCoreConnection: " + e);
catch (IllegalAccessException e)
e.printStackTrace();
throw new SQLException ("UserTypeImpl.getOracleConnection: Invoke: getCoreConnection: " + e);
if (coreCon != null)
System.err.println (" Core connection found: " + coreCon);
return coreCon;
} else
System.err.println (" Unable to locate core connection.");
throw new SQLException ("UserTypeImpl.getOracleConnection: Unable to locate core oracle connection.");
Similar Messages
-
CLOB.createTemporary throws SQL Exception
The following statement:
tempClob = CLOB.createTemporary(fDataConn, true, CLOB.DURATION_SESSION);
causes the following exception in jdev 10.1.2.0.0 Build 1811, but did not cause this exception in the jdev version in download jdev9052.zip
05/09/07 17:59:08 java.sql.SQLException: Invalid argument(s) in call
05/09/07 17:59:08 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
05/09/07 17:59:08 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
05/09/07 17:59:08 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:294)
05/09/07 17:59:08 at oracle.sql.CLOB.createTemporary(CLOB.java:527)
The only thing thats changable in the Connection object.
I've verified that the Connection object has the correct info inside.
I create the Connection object via a context lookup with JNDI.
Does createTemporary care how I create the Connection object?
Thanks
JimThe following statement:
tempClob = CLOB.createTemporary(fDataConn, true, CLOB.DURATION_SESSION);
causes the following exception in jdev 10.1.2.0.0 Build 1811, but did not cause this exception in the jdev version in download jdev9052.zip
05/09/07 17:59:08 java.sql.SQLException: Invalid argument(s) in call
05/09/07 17:59:08 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
05/09/07 17:59:08 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
05/09/07 17:59:08 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:294)
05/09/07 17:59:08 at oracle.sql.CLOB.createTemporary(CLOB.java:527)
The only thing thats changable in the Connection object.
I've verified that the Connection object has the correct info inside.
I create the Connection object via a context lookup with JNDI.
Does createTemporary care how I create the Connection object?
Thanks
Jim -
NullPointer when calling CLOB.createTemporary()
Hi all,
I am trying to insert an xml of size more than 4k into an xml type table. Given below is the code i am using to create the CLOB to insert the same.
I am getting a NullPointerException while creating the CLOB.
Please help me out here!!
CODE
private CLOB getCLOB(String xmlData, Connection conn) throws SQLException {
CLOB tempClob = null;
try {
System.out.println("xml : ### : " + xmlData);
// If the temporary CLOB has not yet been created, create new
tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_CALL);
// Open the temporary CLOB in readwrite mode to enable writing
tempClob.open(CLOB.MODE_READWRITE);
// Get the output stream to write
Writer tempClobWriter = tempClob.getCharacterOutputStream();
// Write the data into the temporary CLOB
tempClobWriter.write(xmlData);
// Flush and close the stream
tempClobWriter.flush();
tempClobWriter.close();
// Close the temporary CLOB
tempClob.close();
} catch (SQLException sqlexp) {
// tempClob.freeTemporary();
sqlexp.printStackTrace();
} catch (Exception exp) {
// tempClob.freeTemporary();
exp.printStackTrace();
return tempClob;
STACK TRACE
java.lang.NullPointerException
at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1354)
at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)
at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)
at oracle.sql.CLOB.createTemporary(CLOB.java:527)
at com.cx.hcm.ams.slatingms.impl.dao.SlatingDAOImpl.getCLOB(SlatingDAOImpl.java:1359)
at com.cx.hcm.ams.slatingms.impl.dao.SlatingDAOImpl.insertXML(SlatingDAOImpl.java:1327)
at com.cx.hcm.ams.slatingms.impl.ejb.SlatingMgmtSessionBean.insertXML(SlatingMgmtSessionBean.java:855)
at SlatingMgmtRemote_StatelessSessionBeanWrapper16.insertXML(SlatingMgmtRemote_StatelessSessionBeanWrapper16.java:3782)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:536)Hi all,
I am trying to insert an xml of size more than 4k into an xml type table. Given below is the code i am using to create the CLOB to insert the same.
I am getting a NullPointerException while creating the CLOB.
Please help me out here!!
CODE
private CLOB getCLOB(String xmlData, Connection conn) throws SQLException {
CLOB tempClob = null;
try {
System.out.println("xml : ### : " + xmlData);
// If the temporary CLOB has not yet been created, create new
tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_CALL);
// Open the temporary CLOB in readwrite mode to enable writing
tempClob.open(CLOB.MODE_READWRITE);
// Get the output stream to write
Writer tempClobWriter = tempClob.getCharacterOutputStream();
// Write the data into the temporary CLOB
tempClobWriter.write(xmlData);
// Flush and close the stream
tempClobWriter.flush();
tempClobWriter.close();
// Close the temporary CLOB
tempClob.close();
} catch (SQLException sqlexp) {
// tempClob.freeTemporary();
sqlexp.printStackTrace();
} catch (Exception exp) {
// tempClob.freeTemporary();
exp.printStackTrace();
return tempClob;
STACK TRACE
java.lang.NullPointerException
at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1354)
at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)
at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)
at oracle.sql.CLOB.createTemporary(CLOB.java:527)
at com.cx.hcm.ams.slatingms.impl.dao.SlatingDAOImpl.getCLOB(SlatingDAOImpl.java:1359)
at com.cx.hcm.ams.slatingms.impl.dao.SlatingDAOImpl.insertXML(SlatingDAOImpl.java:1327)
at com.cx.hcm.ams.slatingms.impl.ejb.SlatingMgmtSessionBean.insertXML(SlatingMgmtSessionBean.java:855)
at SlatingMgmtRemote_StatelessSessionBeanWrapper16.insertXML(SlatingMgmtRemote_StatelessSessionBeanWrapper16.java:3782)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:536) -
1 View linked to 2 CompCont: NullPointer Exception
Hi,
Here is the architecture of my app :
MainView --> CompContA --> ModelA (RFC function A)
........|
........|---> IntCompB --> CompContB --> Model B (RFC function B)
And here is the content of the MainView :
AdviceNumber : [
Z2_I_Rechercher_Avis_Input.AdviceNumber) | RefreshButton1
UserId : [Z2_I_Rechercher_Bottin_Input.UserId) | RefreshButton2
Name : [Z2_I_Rechercher_Avis_Input.Output.It_Infos_Bottin.Name)
Now, my application works when I populate an AdviceNumber and press the RefreshButton1. At the return, the name field is refreshed and I use some Java code to move the UserId that my function returned to the UserId of the screen. This works well.
Then if I change the value of the UserId in the screen and press the RefreshButton2, the second function returns me another name, and I use some Java code to move this name into the Name field of the screen. This works well too.
The problem is that I can't use the refreshButton2 first! I get a NullPointer exception.
And I know why, it's because the « Output » structure of my Z2_I_Rechercher_Avis_Input is not initialized (since the refreshButton1 has not been used yet).
But I can't find the right way to code it.
Can you help me, thanks!
Message was edited by:
Emanuel ChampagneI want the user to click on the button he wants.
I just need to know how to initialize the Output.Struc1 when the user decides to click on the RefreshButton2 First.
It's the line in bold that give me the error (but that line works well when the RefreshButton1 is used first!)
public void onActionRafraichirAvis(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionRafraichirAvis(ServerEvent)
//$$begin ActionButton(-775562010)
wdThis.wdGetAvisCompController().executeZ2_I_Rechercher_Avis_Input();
//$$end
// At the return, we need to refresh the values of the screen with the ones returned by the function.
// Access to the structure showed on the screen
IIt_Infos_BottinElement AvisInfosBottinEl = wdContext
.nodeIt_Infos_Bottin()
.currentIt_Infos_BottinElement();
// Access to the structure received by the RFC function
IIt_Z2I053TElement BottinEl = wdContext
.nodeIt_Z2I053T()
.currentIt_Z2I053TElement();
<b>AvisInfosBottinEl.setName(BottinEl.getName());</b>
Message was edited by:
Emanuel Champagne -
JUTreeNodeBinding question (nullpointer exception in getAttribute)
Hi,
I've got a question about a piece of code. I've used a JTree which displays a recursive tree, which is working fine. I want to do something when a node is selected. I have the following piece of code:
jTree1.addTreeSelectionListener(
new TreeSelectionListener()
public void valueChanged(TreeSelectionEvent e)
DefaultMutableTreeNode node = (DefaultMutableTreeNode)jTree1.getLastSelectedPathComponent();
if (node != null)
JUTreeNodeBinding tnb = (JUTreeNodeBinding)(node.getUserObject());
if (tnb!=null)
});this code is taken from some example I've read on this forum and slightly modified (I can't find the original posting).
Now, according to the sourcecompletion feature, tnb has methods like getAttribute, getAttributeDef. But when I call one of these methods on tnb (where the '...' is in the example above), I always get a nullpointer exception , somewhere inside the getAttribute call. (the variable 'tnb' itself is not null)
Why wouldn't this work? Shouldn't the getAttribute calls give me access to the attributes of the row from the view that corresponds the selected element?
The logwindow shows this for the nullpointer exception:
Exception occurred during event dispatching:
java.lang.NullPointerException
oracle.jbo.AttributeDef[] oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDefs()
JUCtrlValueBinding.java:173
oracle.jbo.AttributeDef oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDef(int)
JUCtrlValueBinding.java:239
void mypackage.PMyData$1.valueChanged(javax.swing.event.TreeSelectionEvent)
PMyData.java:332
void javax.swing.JTree.fireValueChanged(javax.swing.event.TreeSelectionEvent)
JTree.java:2269
void javax.swing.JTree$TreeSelectionRedirector.valueChanged(javax.swing.event.TreeSelectionEvent)
JTree.java:2575
void javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(javax.swing.event.TreeSelectionEvent)
DefaultTreeSelectionModel.java:612
void javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(java.util.Vector, javax.swing.tree.TreePath)
DefaultTreeSelectionModel.java:1006
void javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(javax.swing.tree.TreePath[])
DefaultTreeSelectionModel.java:288
void javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(javax.swing.tree.TreePath)
DefaultTreeSelectionModel.java:171
void javax.swing.JTree.setSelectionPath(javax.swing.tree.TreePath)
JTree.java:1088
void javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(javax.swing.tree.TreePath, java.awt.event.MouseEvent)
BasicTreeUI.java:2117
void javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(java.awt.event.MouseEvent)
BasicTreeUI.java:2683
void java.awt.Component.processMouseEvent(java.awt.event.MouseEvent)
Component.java:3712
void java.awt.Component.processEvent(java.awt.AWTEvent)
Component.java:3544
void java.awt.Container.processEvent(java.awt.AWTEvent)
Container.java:1164
void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)
Component.java:2593
void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
Container.java:1213
void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
Component.java:2497
void java.awt.LightweightDispatcher.retargetMouseEvent(java.awt.Component, int, java.awt.event.MouseEvent)
Container.java:2451
boolean java.awt.LightweightDispatcher.processMouseEvent(java.awt.event.MouseEvent)
Container.java:2210
boolean java.awt.LightweightDispatcher.dispatchEvent(java.awt.AWTEvent)
Container.java:2125
void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
Container.java:1200
void java.awt.Window.dispatchEventImpl(java.awt.AWTEvent)
Window.java:926
void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
Component.java:2497
void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)
EventQueue.java:339
boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)
EventDispatchThread.java:131
void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)
EventDispatchThread.java:98
void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)
EventDispatchThread.java:93
void java.awt.EventDispatchThread.run()
EventDispatchThread.java:85Bit of a coincidence.. I was just running into the same problem. But if you check getAttributeDefs(), you'll see that there only is one attribute available, namely the one that is being displayed in the tree. (the 'description'-attribute)
Or at least, that's the case with my sitation.
I would love to be able to address all available attributes, eg. foreign key fields, but that doesn't seem possible.
At the moment, I'm using the following work-around, which of course is far from ideal:
Key key = tnb.getRowKey();
ViewObject vo = panelBinding.getApplicationModule().findViewObject("SomeVO");
Row[] rows = vo.findByKey(key);
if (rows == null || rows.length != 1)
System.out.println("Notice: not 1 rows");
return;
Row row = rows[0];
// now you can fetch all the attributes -
URGENT !! ClassCastException in CLOB.createTemporary
Oracle 9iAS and CLOB. ClassCastException.
I get oracle Connection from websphere datasource.
The connection object is of type com.ibm.ejs.cm.proxy.OracleConnectionProxy
This is not compatible with CLOB.createTemporary
The code I execute is:
CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); It gives me ClassCastException.
I saw these kind of problems but have not seen any solution!
Any help is appreciated.
Thanks
NadeemThat is not the issue. The problem is that,
CLOB.createTemporary requires OracleConnection instead of just java.sql.Connection.
When we are in a application server, the connection object cannot be OracleConnection as the DataSouce retrieved from JNDI cannot return OracleConnection. The websphere data source wraps the Connection Pool and physical connection to control the Database Transactions.
Currently, the only way out 3 step process. First step will write empty_clob
for example insert/update (someClob) values (empty_clob)
read the same record
retrive empty_clob pointer
Update values
Commit changes
This is definitely not a scalable solution to the problem.
Hope someone has already done something about it and have a solution for this problem?
Nadeem -
URGENT !! ClassCastException in CLOB.createTemporary Feb
I get oracle Connection from websphere datasource.
The connection object is of type com.ibm.ejs.cm.proxy.OracleConnectionProxy
This is not compatible with CLOB.createTemporary
The code I execute is:
CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); It gives me ClassCastException.
I saw these kind of problems but have not seen any solution!
Any help is appreciated.
Thanks
NadeemThat is not the issue. The problem is that,
CLOB.createTemporary requires OracleConnection instead of just java.sql.Connection.
When we are in a application server, the connection object cannot be OracleConnection as the DataSouce retrieved from JNDI cannot return OracleConnection. The websphere data source wraps the Connection Pool and physical connection to control the Database Transactions.
Currently, the only way out 3 step process. First step will write empty_clob
for example insert/update (someClob) values (empty_clob)
read the same record
retrive empty_clob pointer
Update values
Commit changes
This is definitely not a scalable solution to the problem.
Hope someone has already done something about it and have a solution for this problem?
Nadeem -
If image file not exist in image path crystal report not open and give me exception error problem
Hi guys my code below show pictures for all employees
code is working but i have proplem
if image not exist in path
crystal report not open and give me exception error image file not exist in path
although the employee no found in database but if image not exist in path when loop crystal report will not open
how to ignore image files not exist in path and open report this is actually what i need
my code below as following
DataTable dt = new DataTable();
string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
using (SqlConnection con = new SqlConnection(connString))
con.Open();
SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
foreach (DataRow dr in dt.Rows)
FileStream fs = null;
fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] imgbyte = new byte[fs.Length + 1];
imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
dr["Image"] = imgbyte;
fs.Dispose();
ReportDocument objRpt = new Reports.CrystalReportData2();
objRpt.SetDataSource(dt);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
and exception error as belowFirst: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
Second : Drag And drop this image Filed Where I want.
private void LoadReport()
frmCheckWeigher rpt = new frmCheckWeigher();
CryRe_DailyBatch report = new CryRe_DailyBatch();
DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
DataTable dt = GetImageRow(table, "Footer.Jpg");
report.SetDataSource(dt);
crv1.ReportSource = report;
crv1.Refresh();
By this Function I merge My Image data into dataTable
private DataTable GetImageRow(DataTable dt, string ImageName)
try
FileStream fs;
BinaryReader br;
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
else
// if photo does not exist show the nophoto.jpg file
fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
// initialise the binary reader from file streamobject
br = new BinaryReader(fs);
// define the byte array of filelength
byte[] imgbyte = new byte[fs.Length + 1];
// read the bytes from the binary reader
imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
dt.Rows[0]["Image"] = imgbyte;
br.Close();
// close the binary reader
fs.Close();
// close the file stream
catch (Exception ex)
// error handling
MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
return dt;
// Return Datatable After Image Row Insertion
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP] -
Hi
I have one full working application (containing WAR + JAR) files.
Right now this application is working absolutely fine in weblogic 6.0 sp1 on
WINNT & Solaris.
In this application, we accept events to save data from external
applications like excel files.
Now code in JSP is -->
Line 1: String Data = request.getParameter("data");
Line 2: Data.indexof(........);
Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
but I am NOT getting any exception in case of weblogic 6.0sp1.
To my surprise, I am also printing request obj parameters values, whenever
jsp get called from external source, there it is printing value of "data".
I am totally clueless!!
Any idea plz?
Ashish JainLooking very closely at request object contents..
Wht i am sending (posting) from excel file-->
xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet bu="SHKXXX"
report="PBrandContr" sheet=
"PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId="PIC"
opt="P" ></reportSheet>
But 6.1 interprets like this ---->
key is --------> xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet
bu="SHKXXX" report="PBrandContr" sheet=
"PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId
And Value is -------> "PIC" opt="P" ></reportSheet>
This thing is causing all problems.
I am not observing this kinda behaviour in 6.0sp1.
Thanks
Ashish Jain
"Ashish Jain" <[email protected]> wrote in message
news:[email protected]..
Hi
I have one full working application (containing WAR + JAR) files.
Right now this application is working absolutely fine in weblogic 6.0 sp1on
WINNT & Solaris.
In this application, we accept events to save data from external
applications like excel files.
Now code in JSP is -->
Line 1: String Data = request.getParameter("data");
Line 2: Data.indexof(........);
Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
but I am NOT getting any exception in case of weblogic 6.0sp1.
To my surprise, I am also printing request obj parameters values,whenever
jsp get called from external source, there it is printing value of "data".
I am totally clueless!!
Any idea plz?
Ashish Jain -
Nullpointer exception... any help would be appreciated
In advance, I apologize for any ignorance which I may obviously have... I'm in the process of learning Java, and am used to C/C++... In any case, I'm running into a nullpointer exception while 'compiling', which I'm having trouble figuring out... I'll list everything below, but this message will be rather long, as I will try to include everything I can. For this reason, I will ask my questions here, at the top:
1) A null pointer exception, I believe, is generated when something is being referenced which is currently null, for example "a=null; a.b;" yields a null pointer exception. However, is there any other way that one is generated?
2) Are there methods to figure out what/why something is null other than simply looking at it? As shown below, it seems that just looking at it runs you in a circle from line to line, file to file, which leads you back to the beginning where nothing is actually null... (I'm probably just not seeing it, but that seems to be what's happening to me)
So now, on to the actual code:
The following is a printout of the debugging info:
~/bin/jdk*/bin/java -classpath classes jamie.Main
java.lang.NullPointerException
at jamie.Main.Sys_Log(Main.java:110)
at jamie.Main.Setup(Main.java:142)
at jamie.Main.main(Main.java:54)
Exception in thread "main" java.lang.NullPointerException
at jamie.Main.Sys_Log(Main.java:110)
at jamie.Main.Shutdown(Main.java:182)
at jamie.Main.main(Main.java:92)And a short excerpt of each. (*) indicates line which error originates:
20 ) private static Log sys_log;
108 ) static void Sys_Log(String msg)
109 ) {
110*) sys_log.Log(msg);
111 ) }
142*) Sys_Log("Server warming up...");
182*) Sys_Log("Server shutting down...");
50 ) public static void main(String[] args)
51 ) {
52 ) try
53 ) {
54*) Setup();
85 ) catch(Exception e)
86 ) {
87 ) e.printStackTrace(System.out);
88 ) err_log.Log(e.toString());
89 ) }
90 ) finally
91 ) {
92*) Shutdown();
93 ) }Now, various things that I have tried, and their result (you can probably skip this section, as these were mostly futile efforts):
What seems odd to me is that the initial error is on line 110, which is the logging function Sys_Log. Since it's a null pointer exception, I would assume that sys_log is null? and thus in calling Log we're generating that error... I'm not entirely sure that that makes sense, though. Additionally, and what I find odd, is that if I change it to what I will list below, I get a slew of other seemingly unrelated problems:
20 ) private static Log sys_log;
108 ) static void Sys_Log(String msg)
109 ) {
110#) if (sys_log!=null)
111 ) sys_log.Log(msg);
112 ) }This results in a problem with function Err_Log, which I change the same way, resulting in the following:
java.lang.NullPointerException
at jamie.Area_LUL.Load(Area_LUL.java:23)
at jamie.Main.Setup(Main.java:161)
at jamie.Main.main(Main.java:55)
Exception in thread "main" java.lang.NullPointerException
at jamie.Main.Shutdown(Main.java:186)
at jamie.Main.main(Main.java:93)In Main.java the following lines are generating the error:
160 ) lul = new Area_LUL();
161*) lul.Load();And in Area_LUL.java I also have the following:
14 )class Area_LUL implements LoaderUnloader
15 ){
16 ) public void Load()
17 ) {
18 ) try
19 ) {
20 ) areadir = new File("./areas/");
21 ) SAXParser p = SAXParserFactory.newInstance().newSAXParser();
22 )
23*) for(File curr : areadir.listFiles(new Area_Filter()))
24 ) {
25 ) p.parse(curr, new XMLParser());
26 ) }
27 ) }Where in the above, the for statement is generating the null pointer exception... which would tell me that areadir is null, however it is defined as new File("./areas/"); Also, lul (defined as new Area_LUL(); is generating the same error, though it is clearly defined in Area_LUL.java at the top of the last excerpt.
Also, LoaderUnloader is defined in another file as follows:
interface LoaderUnloader
void Load();
void Unload();
}which are defined in Area_LUL in Area_LUL.java .
A major theory which I currently have is that the compiler is beginning with my main.java file, and not seeing the class definition in another file, and thus attributing the class obj I create as null, which is causing the error, but I also am not sure if this is possible...
My imports for Main.java are as follows:
package jamie;
import java.io.*;
import java.util.*;I'm not entirely sure what the package is including, however I do have a jamie.jar file in another directory (../../dist) (could be referencing that?). Also, to compile the source I am using the following command:
~/bin/jdk*/bin/java -classpath classes jamie.MainHowever my classpath (I believe) isn't set to include all my files in the given directory. I wouldn't believe that this would be an issue, however if it could possibly be causing this, I can figure out how to set it properly. Also, this should mean I'm starting with Main.java, and perhaps I am right in concluding that it isn't referencing Area_LUL in another file properly, which is setting it as null?
In any case... Any help would be greatly appreciated. This has been a bit of a struggle for about a month now, trying various resources, moving things around, etc... Thanks so much for your time in reading,
-JessI'm not able to follow the program flow from your post. Please create a small standalone program that exhibits the problem and post that back here.
Your assumption re a NPE is correct, that's the only way they're generated.
There are no "canned" methods to resolve NPEs. The best solution is to put System.out.println statements for all of the involved objects and variables immediately preceeding the error line (in this case, 110) and something will show null. Usually that's enough info to backtrace to the real cause. -
Java.lang.NullPointer Exception in File-RFC-File wtihout BPM scenario
Hi All,
I have implemented scenario File - RFC - File without BPM in PI7.1 according to below link by bhavesh
[File - RFC - File without a BPM - Possible from SP 19.;
but I am getting error java.lang.NullPointer Exception in Audit log of sender communication channel when it enters in ResponseOnewayBean.
I had implemented the same in PI 7.0 but there it was working fine.
Is there any limitations on the use of the above beans in PI7.1 as I could see two more threads on the same unanswered yet.
Please help me in resolving as it is priority task for me
Thanks,
AmitSometime back I saved this SAP Note 1261159 for this error. Not sure if it is still valid. Try to get it implemented.
Regards,
Prateek -
Interaction Record cannot be displayed, instead it gives an exception error
Hi Folks,
In the Web IC, when I click on "Interaction Record" in the Navigation bar, the page is not displayed, instead it gives an exception error:
Component ICCMP_BT_INR cannot be displayed
An exception has occurred Exception Class CX_BOL_EXCEPTION - Access Previously Deleted Entity
Method: CL_CRM_BOL_CORE=>GET_TRANSACTION
Source Text Row: 10
Can someone tell me where to correct this situation.
Thanks,
JohnHi,
please check this setting:
SPRO->IMG->Customer Relationship Management->Transactions->Basic Settings->Define Transaction Type
Define 0010 as default for IR.
Denis -
Help with nullPointer exception
Hi,
I would like some help identifying and error in the code below. Im getting a nullPointer exception at the location specified in the code. Im adding elements to a tableModel. What puzzles me is that the strings I add to the model does contain values. And it does not complain about adding them. Perhaps this is just a simple error, and you more experinced programmars are probably loughing at me ;)
void getTests() {
String[] idNummer = getDirectory(); //gets filenames from a directory
for (int i = 0; i < idNummer.length; i++) {
idNummer[i] = idNummer.substring(idNummer[i].lastIndexOf(dataSeparetor) + 1, idNummer[i].length());
// just sorts out specific parts of the filenames
for (int i = 0; i < idNummer.length; i ++) {
System.out.println(idNummer[i]); //I print the sorted filenames and they not null
testModel.addElement(idNummer[i]); //I add them to the table model
testNr.setModel(testModel); //and gets a nullPoint exception here??I'm sorry, you mean testNr. Don't pay any attention to the above post. it is also declared directly in the class:
public class GUI extends JFrame implements EventListener {
JList testModel;
}and creates an instance here:
public GUI {
testModel = new DefaultListModel();
getTests();
testNr = new JList(testModel);
testNr.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
testNr.setLayoutOrientation(JList.VERTICAL);
testNr.setPreferredSize(new Dimension(80, 80));
testNr.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent event) {
leftPanel.add(testNr, BorderLayout.EAST);
} -
ArrayList nullpointer exception
I'm creating a game called bubblebreaker in Java, with the principle off model, view and controller classes.
In my model class I create a list of bubble objects. In the view I make these bubbles visible and in the controller class I react on external events (mouseclicks, ...)
My design is almost finished but I'm having some troubles removing my selected bubbles.
When I have selected my bubbles I want to remove them with another click on that bubble.
In the method deleteBub(Bubble delete) I will use the "set" method from the arraylist and make the bubble object "null":
protected void deleteBub(Bubble delete) {
bubbleList.set(delete.getNumber(), null);
}This is the error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
+ at Model.deleteBub(Model.java:69)+
It also points to this method:
In the view class I check if the object is null:
protected void drawBub(Bubble bubb, Graphics g) {
if(bubb!=null) {
g.setColor(bubb.getColor());
g.fillOval(20*bubb.getX(), 20*bubb.getY(), 20*model.getRadius(), 20*model.getRadius());
else System.out.println(bubb.getNumber() + " is null");
}There are no compilation errors. I just get a nullpointer exception when I click the second time on a bubble, so when it should be made null.
Edited by: Lektroluv on May 5, 2009 2:22 AMI think I'm not on the same level as you.
The set command replaces the original bubble object with null, wright?
So for example the list changes from this:
new Bubble(.....)
new Bubble(.....)
new Bubble(.....)
new Bubble(.....)
...to this:
new Bubble(.....)
null
new Bubble(.....)
null
new Bubble(.....)
new Bubble(.....)
...The second list isn't good, because it has "nulls" in it?!?!? --> nullpointer exception?
What I've done next is in stead off replacing it with null, replacing it with new Bubble(BLACK ...)
new Bubble(.....)
new Bubble(BLACK ...)
new Bubble(.....)
new Bubble(BLACK ...)
new Bubble(.....)
new Bubble(.....)
...Edited by: Lektroluv on May 5, 2009 8:37 AM
Edited by: Lektroluv on May 5, 2009 8:37 AM -
Getting nullpointer exception in Tomcap using getRealPath()
Hi,
I have the following code snippet, but getting nullpoint exception when I try to read a file in jsp.
String realPath = this.getServletConfig().getServletContext().getRealPath("//AUDIT_TRAIL.xml");
File fileDef = new File(realPath);
Can someone tell me what I am doing wrong, or how i can read a file in jsp that works in tomcat 5why the double slash? / is not a special character ( b]backslash is, and so you would need \\)
The file is sitting in the root of your web app?
String realPath = this.getServletConfig().getServletContext().getRealPath("/AUDIT_TRAIL.xml");
// and if it doesn't work, try this to see what it IS looking up
String realPath1 = this.getServletConfig().getServletContext().getRealPath("/");
System.out.println(realPath1);If you ware loading a file, you might consider using the getResourceAsStream() method.
Cheers,
evnafets
Maybe you are looking for
-
How do I turn off password at login?
I'm using OS X Mavericks 10.9 Every time my machine goes to sleep, upon waking it prompts me for a password. I have selected in System Preference / Security & Privacy that it should ask my for my password after 1 hour. It doesn't wait 1 one hour. And
-
Hello, I am currently in the process of upgrading my OBIEE 11.1.1.5 application to 11.1.1.6 in a Windows 7 environment. My current weblogic version is 10.3.5. I have successfully upgraded the OBIEE portion of the upgrade. I know try to run the psa.ba
-
Windows Update fails: KB2957189 is not applicable to your computer
Hello, I am having trouble with some Windows Updates on a Win2012R2 Server. We have two servers which will become nodes in a 2-node-cluster. The Cluster Configuration Wizard complains about four updates not present on Server A but ok on Server B. Bot
-
HT1589 my iTunes library in my external drive
I followed the steps in 'HT1589: How to open an alternate iTunes Library file or create a new one', but when I try to play a song I receive the error message "the song --- could not be used because the original file could not be found. Would you like
-
When I plug my Ipad into a wall circut it will not fully charge, It only charges up to 66% does anyone no why?