Unable to read pdf file in Marathi text in Java program - java

I am getting this exception in thread "AWT-EventQueue-0"
java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DEREncodable
at com.lowagie.text.pdf.PdfEncryption.(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDecryptedDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
at com.lowagie.text.pdf.PdfReader.(Unknown Source)
at com.lowagie.text.pdf.PdfReader.(Unknown Source

It looks like you're following the Getting started with iText Guide. I daresay you will find the answer to this question very useful.

Related

FileNotFoundException while trying to write an image using thread in java

I am trying to write an image using ImageIO.write() inside run() method of a thread in java. But it is throwing FileNotFoundException and not allowing me to write the image. It is showing stack trace as
java.io.FileNotFoundException: C:\abc\pqr\abc.jpg (Access is denied)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(Unknown Source)
at javax.imageio.stream.FileImageOutputStream.<init>(Unknown Source)
at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(Unknown Source)
at javax.imageio.ImageIO.createImageOutputStream(Unknown Source)
at javax.imageio.ImageIO.write(Unknown Source)
at answerdetection.AnswerDetection.getId(AnswerDetection.java:286)
at getResult.Threader.run(Threader.java:95)
at java.lang.Thread.run(Unknown Source)
Exception in thread "t1" java.lang.NullPointerException
at javax.imageio.ImageIO.write(Unknown Source)
at answerdetection.AnswerDetection.getId(AnswerDetection.java:286)
at getResult.Threader.run(Threader.java:95)
at java.lang.Thread.run(Unknown Source)
Please suggest some solution. Thank You.
Run the Command Prompt or whatever IDE you are using as an Administrator and execute the program again. Else, change the path to a place when you have appropriate writing permissions.
It looks ike you have not the permission to write the file in C:\abc\pqr\

JNLP Parse exception

I am seeing below errors in java console when trying to launch an applet. We are running on Apache 2.2 and WebSphere application server 7.0.0.27. any pointers please?
JNLParseException[ Could not parse launch file. Error at line 26.]
at com.sun.javaws.jnl.XMLFormat.throwNewException(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$300(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: JNLParseException[ Could not parse launch file. Error at line 26.], bail out
There is a neat tool for checking jnlp errors: JaNeLA (available on my share drive).
According to the Exception, you have a XML Syntax error in your jnlp file.
You could use a XML Editor to validate the file (as XML Copy Editor). Also you can put the JNLP file in your question.

Issue while starting WLDF Console Extension

Any fix to avoid this exception while starting WLDF Console? Thanks.
java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/bea/diagnostics/dashboard/ChartPanelApplet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/bea/diagnostics/dashboard/ChartPanelApplet
There is an earlier Sun bug report on this issue, with JDK 1.4
you are mostly running JDK 1.6 but take a look at the bug report.
Short Summary (gleaned from this forum) :
The Java plug-in of your browser tries
to get some .class file from the
current location (your server) and
fails because your server returns some
custom 404 page. Let's try to check
the Java console to see what really is
requested. Please, run the Java
console, set the trace level to 5
(highest level).
Enable the Java console on Windows for IE browser and see if it gives a detail on which URL is giving the 404 or some other error.
Further Reading
Oracle forum question

Access restriction on JARs (what is the proper way to get VecMath?)

I need Vecmath, so I went to Oracle to get the latest version of Java 3D. I didn't see a place to download a JAR, but it had an installer. I downloaded and ran it. I assume that the installer added the JAR as a JDK extension
I restarted Eclipse, and it sees that VecMath is present. However, it still complains:
Access restriction: The type Vector3f
is not accessible due to restriction
on required library C:\Program
Files\Java\jre6\lib\ext\vecmath.jar
Bummer. I am able to change it from a compiler error to a warning, but it crashes as soon as I try to run it. Although, I'm using this in conjunction with OpenGL, and the crash could have nothing to do with vecmath. I'm not sure. Here is the exception:
Exception in thread "Timer-0" javax.media.opengl.GLException: java.lang.RuntimeException: javax.imageio.IIOException: Can't read input file!
at com.jogamp.opengl.impl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:101)
at com.jogamp.opengl.impl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:192)
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:164)
at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:591)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:301)
at com.jogamp.opengl.util.AnimatorImpl.display(AnimatorImpl.java:50)
at com.jogamp.opengl.util.Animator.display(Animator.java:154)
at com.jogamp.opengl.util.FPSAnimator$1.run(FPSAnimator.java:95)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: java.lang.RuntimeException: javax.imageio.IIOException: Can't read input file!
at cs4620.nth23.assignment1.GraphicsApp.loadTextures(GraphicsApp.java:98)
at cs4620.nth23.assignment1.GraphicsApp.init(GraphicsApp.java:65)
at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:111)
at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:124)
at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:643)
at com.jogamp.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:273)
at javax.media.opengl.awt.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:674)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(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)
Caused by: javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(Unknown Source)
at cs4620.nth23.assignment1.GraphicsApp.loadTextures(GraphicsApp.java:95)
... 14 more
I'm using:
x84 Windows 7
Eclipse Helios
JavaSE-1.6
JDK 1.6
What am I doing wrong here?
The exception was caused by being unable to find a file referenced in the code - it has nothing to do with VecMath.
The app runs fine, despite the access restrictions. I don't know if it'll come back to bite me later or what.

SAX Parser In Applet Failure

I have a very simple line of code in my source:
XMLReader xmlReaderFactory = XMLReaderFactory.createXMLReader();
This works flawlessly from an application, however, from an applet, it attempts to load a ".class" file from the server (no classname, just the extension just as you see) and then fails to give me a parser.
Exception in thread "Thread-13" java.lang.ClassFormatError: Incompatible magic value 218762506 in class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
What could be the problem?
It looks as if you are attempting to configure the use of a SAX implementation other than that in the JRE. The configuration is pointing to a Windows text files starting with at least two empty lines. SAX implementations may be configured through the system property org.xml.sax.driver or contained in a file within a jar of the name META-INF/services/org.xml.sax.driver.
You might be getting back a 404 error from the server for that class file. See this bug report for details.

Categories