Whatz java.lang. NullPointer Exception.(Unknown Source)??
Hi All,
In my application, i am getting java.lang. NullPointer Exception.
Is it thatthe application not finding the above Action Class at Runtime??
Any help would be highly appreciated..
Thanks in Advance..
Shridhar..
Read the fucking API.
Thrown when an application attempts to use null in a case where an object is required. These include:
- Calling the instance method of a null object.
- Accessing or modifying the field of a null object.
- Taking the length of null as if it were an array.
- Accessing or modifying the slots of null as if it were an array.
- Throwing null as if it were a Throwable value.
Applications should throw instances of this class to indicate other illegal uses of the null object.
Similar Messages
-
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 -
Java.Lang.NullPoint.Exception in OWB Mapping
Hello Everybody
We are building Data Warehouse using OWB Repository 9.2.0.2.0. When we are validating or deploying the created map we are getting Java.Lang.NullPoint.Exception. This leads to blank screen. We are unable to recover the map. Sometimes, synchronization works to recover the map, but not all the times.
Is there any solution to it?Mark
Is it possible to solve the problem without migrating? I have the details of error as follows --
java.lang.NullPointerException
java.lang.NullPointerException
at oracle.wh.service.impl.mapping.metadata.WBMappingGraphImpl.<init>(WBMappingGraphImpl.java:43)
at oracle.wh.service.impl.mapping.metadata.WBMappingGraphHelper.createMappingGraph(WBMappingGraphHelper.java:31)
at oracle.wh.ui.mapping.MappingGraphNew.drawStage(MappingGraphNew.java:2660)
at oracle.wh.ui.mapping.MappingGraphNew.setStage(MappingGraphNew.java:484)
at oracle.wh.ui.mapping.MappingEditorCanvas.refresh(MappingEditorCanvas.java:287)
at oracle.wh.ui.common.WhFolderEditor.refreshCanvas(WhFolderEditor.java:951)
at oracle.wh.ui.common.WhFolderEditor.refresh(WhFolderEditor.java:604)
at oracle.wh.ui.common.WhFolderEditor$1$MyRefresh.run(WhFolderEditor.java:424)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
I appreciate your feedback.
Cheers, Bana -
Java.lang.NullPointer Exception error in webi
Hi All,
When a opening a webi report a user is getting java.lang.NullPointer Exception error in webi for a single report.
Other reports which were build from same universe are working fine. The issue is only with one user and one report.
Environment:
Business Objects XIR3
Java 6 ,update 3
IE version 7
Web Application Server - Apache Tomcat
Thanks in Advance....Hi,
Check whether the same user is able to open the report in some other machine?
What happens when the user is trying to open other reports? Does he gets the error again?
If the reports is working with other machine, check the java version of the machines.
If the report is working with other users, it not possible that the universe is damaged.
This issue cannot be a rights issue. It has to be something with the report, java, or the universe.
Please check the above details and let me know.
Regards,
Shreyash. -
Java.lang.NullPointer exception
We have a report which fetches large amount of data and this report is inviked from JSP page using Crystal JRC.
Now if we run report and click "next" or "prvious" button befor the rpeort page is rendered with data (or finishesh fetching data). It throws "Java.Lng.NullPOinter Exception".
Can somebody please point out the problem behind this. are we doing anything wrong?
Do we need to set any paramter for report
Thanks,
Kuldeepdid you solve your problem .I have the same .
Thanks -
Java.lang.nullpointer exception in leave request
Hi folks,
I am getting null pointer exception when I am trying to access leave request in working time module in ess. The stack trace shows as below
The initial exception that caused the request to fail, was:
java.lang.NullPointerException
at com.sap.xss.hr.lea.form.edit.VcFormEdit.setVisibleFields(VcFormEdit.java:477)
at com.sap.xss.hr.lea.form.edit.VcFormEdit.onBeforeOutput(VcFormEdit.java:330)
at com.sap.xss.hr.lea.form.edit.wdp.InternalVcFormEdit.onBeforeOutput(InternalVcFormEdit.java:1092)
at com.sap.xss.hr.lea.form.edit.VcFormEditInterface.onBeforeOutput(VcFormEditInterface.java:135)
at com.sap.xss.hr.lea.form.edit.wdp.InternalVcFormEditInterface.onBeforeOutput(InternalVcFormEditInterface.java:192)
Pl let me know why I am facing this error.
Thanks,
PriyankaHi,
Please find the following setting for configuration .
Goto SPRO then follow following path
Personnel Management - > Employee Self-Service -> Service-Specific Settings -> Working Time -> Leave Request -> Processing Processes
Create Rule Groups
1st you need to create the role group ( following is E.g )
Role group : 00000001
Name of Role group : SAP Standard
Define Processing Processes for Each Rule Group (following is E.g)
Role group : 00000001
Name of Role group : SAP Standard
Start Date : 01.01.1800
End Date : 31.12.9999
Specify Processing Processes for Types of Leave ( for E.g )
(click up on new entry )
Role group : 00000001
Name of Role group : SAP Standard
PSG : 01
A/AType : 0420
Type Text : Seminar/course/training
Start Date : 01.01.1800
End Date : 31.12.9999
then once you make entri here you need to click up on details ( select that row then Ctrl + Shift + F2 )
then it will open change view of Processing Processes for Types of Leave ( here this screen for absene type 0420 )
in this screen
Start date in the Past
Put radio button on "Processing Permited to Rec. limit".
start date is the current date
Put radio button on "Processing is perminted"
Start date in the Future
put radio button "unrecstrikt processs is perminted"
tick mark at Display field next ....
tick makk to request may ..........
system response
tick mark "request has to be aproved'
like this you can make the SPRO setting for other leave othere than 0420 ..in the "Specify Processing Processes for Types of Leave" -
Read file gives java.lang.Nullpointer exception
I am reading to read a ".txt" file created by "python code" and stored in my directory.
If i comment the python code and store the file ("statusfile.txt') in the directory, the code is able to read the file. but when i uncomment and run the python code to generate the file ..it gives java.lang.NullPointerException.
the two functions for reading the file and running the python code are separate but in the same class and are also called in one JSP. Does anyone have any suggestions.
Someone did suggest me to use getResourceAsStream.. but i do not understand where to use it .. in the class (where i am doing the readfile function or where in the runpython function which basically generates the file) I did tried using it in JSP and also in the class.. but nothing seems to work. Also as i saw the examples.. getResourceAsStream is used for uploading properties or config files. I just want to simplying read the simpel text file which is already stored in the directory and return a boolean to JSP if reading file was a success.
in short the algo is
ON JSP:
1) call class function to run python code
2) call class function to read the generated in step 1.
CLASS
1) function runpython()
// store generated files in the specified directory
2) function readFile()
//read file from specified directory
//return boolean
Any suggestions
ThanxThe problem is where is "your directory"?
Creating a file by new File("myFile.txt") just puts it in the current working directory.
Sometimes this is something like the bin directory.
Most web applications use ServletContext.getRealPath("/")
This turns a website relative reference into a file reference on the local machine.
So you can say getRealPath("/index.html") and it will return the file (for example) C:\tomcat\webapps\root\index.html
On to suggestions:
Null pointer exception?
Where is it coming from? Catch the exception and print a stack trace, to see if you can determine which line of code is causing it - which variable is null. Is it the actual file, or something you use to create the file? -
Java.lang.nullpointer exception in Xcelsius
Hi,
i am using following platform
Crystal Xcelsius 2008,
Bo Xir2 SP3 Fix Pack 3.3, SP3 Productivity Pack
While using QAAWS , i am getting java.lang.nullpointerexception error in Xcelsius.Due to this i am not getting data in Xcelsius.
Please help me
Thanks in Advance
SandeepHi Sandeep,
I have a solution through which i have resolved in one of my projects.
Just incresase the heap size on Tomcat server and restart it. Say if it is 256 make it double as per your requirment.
This issue occurs when your QaaWS tries to get more data .
Hope this may solve your issue.
Let me know if the problem is not resolved.
Regards,
AnjaniKumar C.A. -
Java.lang.NullPointer exception and operating systems
Do different operating systems handle the NullPointer exception differently? I have an application that has a screen come up when you click a button. However, the app attempts to process some data before bring up the screen. Sometimes the data is null. The application works fine on linux red hat. However, the screen does not come up on HP Unix. I am not looking to fix the code (even though it may need fixed), but I am looking for an explanation why app works differently in this regard.
Do different operating systems handle the NullPointer
exception differently? Nope.
My guess is that the different OSes have different threading models. In one case X amount of work gets done in the non-GUI thread before the GUI thread tries to do its thing. In the other OS, X+1 amount of work gets done, leading to different states for the GUIs to act on. This is almost certainly a bug in your app. -
Uncaught exception:java.lang.nullpointer exception
i recently upgraded to os 4.5 on my 8310 it works fine .but when i 1st turn on my phone i get this message .does anyone know what this means ?
Did you installed any application after upgrading the OS? If yes then remove and have a restart to your device. If that too doesn't solve the issue than reinstall the OS again.
tanzim
If your query is resolved then please click on “Accept as Solution”
Click on the LIKE on the bottom right if the post deserves credit -
FindClass() throws java.lang.UnsatisfiedLinkError exception
Hi All,
I am using a JNI to make my C program to communicate with the GUI developed in Java Swings. In my C program I have used FindClass() method to find the java class. While exececuting my C program, I got the following exception,
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jre1.5.0_04/lib/i386/libawt.so: /usr/java/j2sdk1.4.2_08/jre/lib/i386/libmlib_image.so: version `VER_1.1' not found (required by /usr/java/jre1.5.0_04/lib/i386/libawt.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sun.security.action.LoadLibraryAction.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(Unknown Source)
at sun.awt.DebugHelper.<clinit>(Unknown Source)
at java.awt.Component.<clinit>(Unknown Source)
I have ensured that the libawt.so and ibmlib_image.so paths are set in LD_LIBRARY_PATH. Inspite of that I am not able to access the java class because of the above mentioned exception. Please help me out in this.
For your reference, I am attaching the code with this,
#include <jni.h>
int main()
JavaVMOption options[2];
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
long status;
jclass cls;
jobject obj;
jmethodID mid;
jstring jstr;
char str[25];
options[0].optionString = "-Djava.class.path=/home/maniyan/work/Dhruv_proj/vers/v5";
options[1].optionString = "-verbose:jni";
memset(&vm_args, 0, sizeof(vm_args));
vm_args.version = JNI_VERSION_1_4;
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.ignoreUnrecognized = 1;
status = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
printf("status %d\n",status);
if (status != JNI_ERR)
printf("Exception %d\n",(*env)->ExceptionCheck(env));
cls = (*env)->FindClass(env, "frame_main_v1");
printf("Exception %d\n",(*env)->ExceptionCheck(env));
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
if(cls !=0)
//printf("am here\n");
mid = (*env)->GetStaticMethodID(env, cls, "display_message", "(Ljava/lang/String;)V");
printf("Method %d\n",mid);
if(mid !=0)
{ strcpy(str,"Hello world");
(*env)->CallStaticCharMethod(env, cls, mid, (*env)->NewStringUTF(env, str));
(*jvm)->DestroyJavaVM(jvm);
return 0;
else {
printf("some error\n");
return -1;
Thanks in adv,
Cool Dudethis is like a classpath issue, but for a native library
basically you need to include the library file in your path info to the JVM -
Getting a java.awt.Window.pack(unknown source) error
Hello,
This is the exact error stack:
ERROR: 10:48:21,503 - TcLogger$IC_PrintStream.println:?
java.lang.NullPointerException
java.lang.NullPointerException
at com.teamcenter.rac.util.PropertyLayout.askRowPreferredSize(Unknown Source)
at com.teamcenter.rac.util.PropertyLayout.preferredLayoutSize(Unknown Source)
at com.teamcenter.rac.util.PropertyLayout.layoutContainer(Unknown Source)
at java.awt.Container.layout(Unknown Source)
at java.awt.Container.doLayout(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validate(Unknown Source)
at java.awt.Window.pack(Unknown Source)
at com.honda.ergo.pergo.ProcErgoJDialog.createProcErgoDialog(ProcErgoJDialog.java:789)
at com.honda.ergo.pergo.ProcErgoJDialog.<init>(ProcErgoJDialog.java:328)
at com.honda.cme.actions.ErgoAssessmentAppAction.run(ErgoAssessmentAppAction.java:139)
at java.lang.Thread.run(Unknown Source)
I'm sure it has something to do with the PropertyLayout (Layout Manager) that I'm using but I don't know what. It works fine on one system but does not work or another.
Thanks,dumas9 wrote:
at java.awt.Window.pack(Unknown Source)
at com.honda.ergo.pergo.ProcErgoJDialog.createProcErgoDialog(ProcErgoJDialog.java:789)
at com.honda.ergo.pergo.ProcErgoJDialog.<init>(ProcErgoJDialog.java:328)
at com.honda.cme.actions.ErgoAssessmentAppAction.run(ErgoAssessmentAppAction.java:139)
at java.lang.Thread.run(Unknown Source)It looks like you're not running the Swing GUI on the EDT and since your problem is intermittent it's a likely cause of the problem. Search on "java swing concurrency tutorial" for more information. -
when click Model-><table>->control->error
com.sunopsis.graphical.frame.j: Wrapped exception java.lang.NullPointerException said:
at com.sunopsis.graphical.frame.bl.c(bl.java)
at com.sunopsis.graphical.r.p.b(p.java)
at com.sunopsis.graphical.r.x.actionPerformed(x.java)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)faint!
it is ok again after restart -
Java.lang.thread exception while using Xalan 2.0 in WLS 6.0
Hi, I'm trying to use Xalan 2.0 in a servlet hosted by WLS. Ive
modified Xalan's SimpleTransform sample to be a servlet. I
create a Transformer with the .xsl, then call tranform() to
print the tranformed xml to the response stream. The xml is
tranformed correctly, but it throws a java.lang.thread
exception. The standalone Xalan sample doesn't do this. Anyone
else seen this problem?
Here's the code of interestest, I apologize if its not formatted very well:
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException
PrintWriter out = res.getWriter();
res.setContentType("text/html");
out.println("<html><head><title>XalanTest<title></head>");
out.println("<body><h1>XalanTest</h1>");
try{
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamSource ss = new StreamSource("file:\\\\My-path\\birds.xsl");
Transformer transformer = tFactory.newTransformer(ss);
StreamResult SR = new StreamResult(out);
transformer.transform(new StreamSource("file:\\\\My-path\\birds.xml"), SR );
catch(Exception e){
out.println("<p>" + e.toString() + "</p>");
e.printStackTrace(out);
out.println("<p>Exception</p>");
out.println("</body></html>");It also looks like the workaround suggested does not work.
I put the following code as workaround:
response.setContentType("text/html");
response.setHeader ("Pragma", "no-cache");
Transformer transformer;
TransformerFactory factory = TransformerFactory.newInstance();
String stylesheet = "config\\closs\\applications\\webroot\\jsp\\example\\Load2.xsl";
String sourceId = "config\\closs\\applications\\webroot\\jsp\\example\\Load2.xml";
String outputFile = "config\\closs\\applications\\webroot\\jsp\\example\\Load2.html";
String outputDirectFile = "config\\closs\\applications\\webroot\\jsp\\example\\Load2_Direct.html";
try
PrintWriter fout = new PrintWriter (new FileOutputStream (outputFile));
OutputStream os = new ByteArrayOutputStream();
transformer = factory.newTransformer(new StreamSource(stylesheet));
transformer.transform(new StreamSource(sourceId), new StreamResult(outputDirectFile));
transformer.transform(new StreamSource(sourceId), new StreamResult(os));
os.flush ();
os.close();
out.print(os.toString());
fout.print (os.toString ());
fout.flush ();
fout.close ();
catch (Exception e)
// Error Handler
e.printStackTrace();
The two .html files produced look exactly the same, which is good.
However, the screen output to my html browser (Internet Explorer 5.50 sp1) produces
different output.
That is strange, but that shows that this bug does not have a known workaround
"Rabinowitz" <[email protected]> wrote:
>
I have the same problem with java sun xml parser (jaxp 1-1)
It is interesting to know that all this perfectly works under weblogic
5.1, so
I cannot migrate my application to 6.0
So, the functionality of weblogic 6.0 degraded since 5.1.
I cannot buy the explanation that that is not bea's fault, because it
perfectly
worked with the same version of xml parser.
Now, their customer support is saying they have not decided whether this
is a
bug or a feature.
Interesting to know that degradation of functionality could be a feature!
It is now June 21, 3 months since this bug was reported, sp2 was shipped
since
that time, and this bug is still there.
"Chuck H. Zhao" <[email protected]> wrote:
I am having the exact same problem you are having. If we analyze the
stack
trace:
javax.xml.transform.TransformerException: java.lang.Thread
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1212)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
java.lang.ClassCastException: java.lang.Thread
at
weblogic.servlet.internal.ResponseHeaders.setDateHeader(ResponseHeaders.java
:273)
at
weblogic.servlet.internal.ServletResponseImpl.setDateHeader(ServletResponseI
mpl.java:449)
at
weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseIm
pl.java:637)
at
weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamI
mpl.java:124)
at
weblogic.servlet.internal.WLOutputStreamWriter.flush(WLOutputStreamWriter.ja
va:124)
at java.io.PrintWriter.flush(PrintWriter.java:120)
at
org.apache.xalan.serialize.SerializerToXML.flushWriter(SerializerToXML.java:
1431)
at
org.apache.xalan.serialize.SerializerToXML.endDocument(SerializerToXML.java:
629)
at
org.apache.xalan.transformer.ResultTreeHandler.endDocument(ResultTreeHandler
..java:180)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1194)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
What happened is: to support incremental output, Xalan-Java performs
the
transformation in a second thread while building the source tree inthe
main
thread. So Transformer.transform() creates a new thread to run the
transformer.run() method, which will write to weblogic's internal
ServletOutputStreamImpl, and in the end calls flush() on it.
ServletOutputStreamImpl determines that the headers haven't been written
yet, and the headers need to be written before any servlet output, so
it
calls ServletResponseImpl.writeHeaders(), which eventually calls
ResponseHeaders.setDateHeader(). The last method assumes the thread
is
weblogic's internal ExecuteThread and tries to cast the thread as such,
maybe to get the date from it. But the thread is a plain java.lang.Thread
created by xalan, thus we get the java.lang.ClassCastException:
java.lang.Thread
This suggests a second workaround: call ServletResponse.flushBuffer()
before any xalan stuff, which will force the headers to be written in
weblogic's ExecuteThread. The shortcoming of this is that this will
cause
the response to be commited, and if the xalan stuff throws exception
you can
not forward to another page.
Another thing is that xalan should not directly call flush() on
ServletOutputStreamImpl at all. I will report it to xalan and see if
they
consider that a bug. If they fix that then we have a third workaround:
set
the buffer size of ServletResponse big enough to accomodate everything
including the xslt outputs, so the ServletOutput does not need to be
flushed
during xalan code.
I do not consider this problem a weblogic bug, since the servlet container
has to right to expect any thread inside it to be its own. Serlvet2.2
spec
says:
1.2 What is a Servlet Container?
A Servlet Container may place security restrictions on the environment
that
a servlet executes in. In
a Java 2 Platform Standard Edition 1.2 (J2SE) or Java 2 Platform Enterprise
Edition 1.2 (J2EE)
environment, these restrictions should be placed using the permission
architecture defined by Java 2
Platform. For example, high end application servers may limit certain
action, such as the creation of
a Thread object, to insure that other components of the container are
not
negatively impacted.
Weblogic should explicitly warn the developers that creating threads
inside
the servlet container may have adverse effects, the same kind of problem
we
are having. (or maybe they already did somewhere in their documentation?)
On the xalan side, I would suggest them to either give the option to
switch
the two threads, or to give the option to buffer the output and write
it out
in the main thread, which is exactly what you did in your first workaround.
Any comments or thoughts on the subject are welcome.
-- Chuck Zhao
"MK Parini" <[email protected]> wrote in message
news:[email protected]...
I found, what I think to be a bug, and a work-around for it.
When doing an XSLT Transformation, you must specify a StreamResult
to which to write the output. I was doing my transformation in
a
servlet so I was writing my output to the HttpResponse
(The variable res is a javax.servlet.http.HttpServletResponse
object)
StreamResult htmlTarget = new StreamResult(res.getWriter());
If I use this, when I perform the transformation using the TRAX
APIs,
InputStream xslFile = context.getResourceAsStream(fileName);
TransformerFactory tFactory = TransformerFactory.newInstance();
Templates xslTemplates = tFactory.newTemplates(new StreamSource(xslFile));
transformer = xslTemplates.newTransformer();
transformer.transform(xmlSource, htmlTarget);
I receive the ClassCastException from the class
weblogic.servlet.internal.ResponseHeaders.setDateHeader(ResponseHeaders.java
:273),
as seen in my previous posting.
I discovered, if I write my output to a StringBuffer, and then
I write
the StringBuffer to the HttpResponse, I do not get the ClassCastException.
For example,
StringWriter myWriter = new StringWriter(2400);
StreamResult htmlTarget = new StreamResult(myWriter);
<Same transformation code as above>
myWriter.close();
PrintWriter out = res.getWriter();
out.print(myWriter.toString());
Is this a bug in the weblogic internal servlet class or am I just
missing something?
Also, one concern that I have with the workaround is that it might
hurt performance.
Any comments or thoughts on the subject are welcome. -
Java.lang.NoClassDefFoundError: Exception in thread "main"
Hello People,
I am aware that this topic has been raised before. I have browsed through all the postings of this particular question, but i have not found the solution.
While compilign i get no errors but this is what i get when i run the java program.
java.lang.NoClassDefFoundError: Exception in thread "main"
Tool completed with exit code 1
The following is my path and classpath files under autoexec.bat
SET PATH=%PATH%;C:\j2sdk1.4.0_03\bin
SET CLASSPATH=.;%CLASSPATH%;C:\j2sdk1.4.0_03\bin
These are the settings i have in MY COMPUTER properties/environments
SYSTEM VARIABLES
Variable - classpath
Value - C:\Program Files\TextPad 4
USER VARIABLES
Variable - PATH
Value - C:\j2sdk1.4.0_03\bin
SYSTEM VARIABLES
Variable - path
Value - C:\PROGRA~1\PVCS\VM\win32\bin;C:\WINNT4\system32;C:\WINNT4;C:\WINNT4\system32\nls\ENGLISH;C:\WINNT4\system32\nls;C:\Program Files\Rational\common
USER VARIABLES
Variable - PATH
Value - C:\j2sdk1.4.0_03\bin
I hope this infromation will help.
Thanks
Regards,
ShahSET PATH=%PATH%;C:\j2sdk1.4.0_03\bin
SET CLASSPATH=.;%CLASSPATH%;C:\j2sdk1.4.0_03\bin
These are the settings i have in MY COMPUTER
properties/environments
SYSTEM VARIABLES
Variable - classpath
Value - C:\Program Files\TextPad 4I am concerned that the classpath in the autoexec.bat is different from what you posted under System variables. What version of Windows are you running? autoexec.bat is used by 98. Others use the system variables. The classpath you show for autoexec.bat looks OK but the classpath you show for system variables looks wrong. It should be the same as what you show for autoexec.bat You do not need the sdk\bin directory in your classpath unless you plan to put classes there.
The NoClassDefFound error means that the java.exe command could not find the class that you specified. You did not post the command that you entered. You may have specified the class wrong. Otherwise, it is probably a classpath problem. -
Java.lang.indexoutofbound Exception
HI all
i am trying to convert multiple jpg images to single tiff image..i am getting an exception that is
"java.lang.indexoutofbound Exception"..can anyone help me
import com.sun.media.imageio.plugins.tiff.TIFFImageWriteParam;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
public class mergeImages
public void execute(ArrayList<File> imageFiles , File newTIFF)
throws IOException
Iterator iterator = imageFiles.iterator();
Iterator writers = ImageIO.getImageWritersByFormatName("tif");
ImageWriter writer = (ImageWriter)writers.next();
ImageOutputStream ios = ImageIO.createImageOutputStream(newTIFF);
writer.setOutput(ios);
TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.US);
tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
tiffWriteParam.setCompressionType("JPEG");
boolean firstImage = true;
while (iterator.hasNext())
File imageFile = (File) iterator.next();
ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
Iterator readers = ImageIO.getImageReaders(iis);
ImageReader reader = (ImageReader)readers.next();
reader.setInput(iis);
try
for(int i = 0;i<imageFiles.size();i++)
IIOMetadata iioImageMetadata = reader.getImageMetadata(i);
int imageHeight = reader.getHeight(i);
int imageWidth = reader.getWidth(i);
tiffWriteParam.setTilingMode(ImageWriteParam.MODE_EXPLICIT);
tiffWriteParam.setTiling(imageWidth, imageHeight, 0, 0);
BufferedImage bi = reader.read(i, null);
IIOImage image = new IIOImage(bi, null, iioImageMetadata);
if(firstImage==false)
writer.writeInsert(-1,image, tiffWriteParam);
else {
writer.write(null, image, tiffWriteParam);
firstImage = false;
catch (Exception e)
System.out.println("Exxxxxxxxx"+e);
reader.dispose();
writer.dispose();
public static void main(String[] args)throws IOException
ArrayList filesList=new ArrayList();
File destFile = new File("c:\\TEST.tif");
//your logic to get the list of files.
// set the file list to 'filesList'
File in1 = new File("c:\\a.jpg");
File in2 = new File("c:\\b.jpg");
filesList.add(0,in1);
filesList.add(1,in2);
mergeImages mI=new mergeImages();
mI.execute(filesList,destFile);
}To expand on that a little, so that you get better information next time:
This line tells you what, ultimately, failed.
java.lang.IndexOutOfBoundsExceptionYou then get the stack trace from most recent method called to least recent method called. The most recent method will contain the line of code that actually failed, but as here may be in an external library:
at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:448)The last external package after your own code will be the method call that failed. Here you were calling the getImageMetadata() method of the com.sun.imageio.plugins.jpeg.JPEGImageReader class. Documentation on this class is available from the [Sun API documentation|http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/ImageReader.html] .
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getImageMetadata(JPEGImageReader.java:851)The next entry indicates which line of your own code failed. Here it was line 45 which is within a method called execute (mediocre name - it should describe what it's doing, execute is too abstract) of your own class called mergeImagesHCL (also a poor name - classes should always start with a capital letter):
at mergeImagesHCL.execute(mergeImagesHCL.java:45)The rest of the stack trace tells you how you got there - here by calling mergeImagesHCL at line 84 of the main method of the same class:
at mergeImagesHCL.main(mergeImagesHCL.java:84)Stack traces tell you exactly what line of code your error is on, what you were calling when it failed, and why it failed. Use them.
Maybe you are looking for
-
Error while creating Transport role
Hi, I have created a new transport role - " Transport manager" but unfortunately the import function of that doens,t work. It gives Error: "Unexpected Error. See System log for more details...." In the NWA i see: ' ( ' com.sapportals.portal.transpo
-
I keep getting " The song**** could not be used because the original file c
Ok, I'll try not to get my problem too confusing or complicated. Had a virus and had pc repair store wipe and reload my operating system. They backed everything up and put it in a folder on my desktop. I reinstalled i-tunes. Opened i-tunes. checked m
-
How to configure DPM2012R2 to use a private cloud
Hi, I have configure a private cloud over several MS 2012 R2 servers. I have the storage and all required network done. I then installed DPM 2012 R2 and would like to use the "long term" storage function with the private cloud that I created. Has any
-
Hi, I have a video presentation on DVD from work that I'd like to put onto my Mac (I'm a new convert to Mac - only a few weeks ago!). The DVD has 3 "chapters". It seems that it's made up of three types of files (.bup .ifo & .vob) How to I copy the DV
-
When I attempt to apply a lens profile in the Develop module the only choices are for the Fujifilm X100/S/T even though in the Library module the EXIF data correctly shows the camera as the X-T1 and the precise lens used to take the picture. How do I