Source not found exception - java

In my application i have a JSP file named "Transferdatanew.jsp". When I am going to use my application, I am getting an exception as numberformatexception, but when I clicked there I am getting a message as "source not found for org.apache.jsp._Transferdatanew".
What does this mean? Please help me. I am new to Java.

Its pretty clear that there is a problem in the 'Transferdatanew.jsp'. I'd venture so far as to say that the jsp is receiving an input that is not in the numerical format it expects.
You should not be worried about 'Source not found exception' unless you want to see the source .... which will be in one of the $TOMCAT_HOME/work subfolders.

Related

Running a java application (JAR file) on commandline, have errors that I don't understand

Not sure what these errors mean as I have searched some of them such as "Exception NO enum constant" but only "no enum const class" comes up answered on google. Can anyone examine the error at the bottom of command prompt and tell me what the error might be from? Image of the cmd error attached below.
As requested I have put the source code for org.evosuite.Properties.Algorithm which showed that there was an enum error. The entire class is too big but innside algorithm I have alreayd put "CELLULARGA" and the rest of the types of algorithms run so I'm unsure why there is that exception error when I run with cellularGA
// ---------------------------------------------------------------
// Search algorithm
public enum Algorithm {
STANDARDGA, MONOTONICGA, ONEPLUSONEEA, STEADYSTATEGA, RANDOM, NSGAII, MOSA, CELLULARGA
}
It's an IllegalArgumentException, which means you have passed in wrong arguments (probably due to type mismatch) to some method in your code. And it says it's on line 238 so you should start there.
You should practice catching exceptions with code that you can understand and which gives you a clearer picture of where the problem is instead of just printing a stacktrace you clearly can't interpret.
Except it's a runtime exception, in which case you might just have to study them.
Also, you would get more help here if you showed us some source code...

Getting error with ImageIO.read(getClass().getResourceAsStream (input==NULL)?

I keep getting this error when I use the following code:
try
{
image=ImageIO.read(getClass().getResourceAsStream("build/classes/javaproject/Space.gif"));
}
catch (IOException ex)
{
lastException=ex;
}
It gives keeps giving me the "input==null" error.
I have already tried to find a solution to this (several answered questions already had the solution actually, but those didn't work for me) but I haven't had any luck. This one for example was very similar to my problem, but I can't seem to find out exactly where to put my image file in.
I noticed most of them were solved by simple file placement, and so it's all the more confusing when some people have 'bin' while I have 'build' and 'src' on NetBeans.
Also, I realize the path is probably erroneous, but I already tried it many different ways and it hasn't seemed to work with any of them. I would really appreciate any help...
I am assuming, from the name, that build/classes/ is a folder on your classpath; so what you probably need to write is:
image=ImageIO.read(getClass().getResourceAsStream("/javaproject/Space.gif"));
Edit for comment below: Since javaproject/ is not actually inside build/classes/, I guess you actually need:
image=ImageIO.read(getClass().getResourceAsStream("/Space.gif"));
(I know the context here is a bit different, but it should be clear that this system is modeled somewhat on a filesystem. If your build/classes/ directory doesn't contain a javaproject/ directory, then why would it ever occur to you to write build/classes/javaproject/?)
The promblom is that its A system file so you got too do this:
ClassLoader.getSystemResourceAsStream

ifstream error readings characters from string

so, I've written programs using ifstream in the past, successfully. yet this time, I can't seem to correct this "cannot read characters from string" error shown in the image. I basically declare ifstream inputFileStream in the class header, then try stating inputFileStream("text.txt"); and I already have that given error in the debugger.
More specifically, I construct an instance of the given class in the main method, and call (from the main method,) the public method which contains the statement inputFileStream("text.txt");.
I've made sure that the given text file is actually in the same folder as the project. Anybody familiar with this error?
I looked up the cccccccc error code and it has to do with an uninitialized stack something, but why would that be relevant to this?
The closest post to this was here, but im still trying to decipher the problem How to end up with a pointer to 0xCCCCCCCC
so, I got it working. I'm using visual studio 2013. all I had to do was copy the code into a new project, and compile it there. no idea why this worked as such

Java Netbeans error

I've been following the 'Netbeans E-Commerce tutorial', and have am currently on this step:
http://netbeans.org/kb/docs/javaee/ecommerce/entity-session.html
I have fully configured my Window 7 account as per that page, with NetBeans 6.9.1, Glassfish server and MySQL.
I'm getting an error 500 when executing 'Category' page (log extract below). The error manifests itself when I complete step 3 in the 'selected category' sub-section of the 'Accessing Data with EJBs' this page. The line in question is:
// get selected category
selectedCategory = categoryFacade.find(Short.parseShort(categoryId));
If I comment this line out, the bug goes away.
The log file snippet is here:
[#|2010-09-29T18:32:32.570+0100|WARNING|glassfish3.0.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=http-thread-pool-8080-(2);|StandardWrapperValve[Controller]: PWC1406: Servlet.service() for servlet Controller threw exception
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5119)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5017)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4805)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
at $Proxy355.find(Unknown Source)
at session.__EJB31_Generated__CategoryFacade__Intf____Bean__.find(Unknown Source)
at controller.ControllerServlet.doGet(ControllerServlet.java:68)
Line 68 in the ControllerServlet code is the one identified above.
My experience with both Java and Netbeans is sufficiently light that I'm not even sure how to go about starting to debug this. I've followed the tutorial pretty closely, so it should not be something I've missed - but mistakes do happen.
I understand an outright solution based on the information contained would be difficult. If there is any further information required, please ask. Failing that, if anyone has any suggestions on how I can further investigate this on my own, I'd be very grateful.
I always think cracking problems is the best way to learn, but it is pretty frustrating as well.
Update:
I've been running through the NetBeans debugger. It appears that the problem is with the cast code (Short.parseShort(categoryId)). When I replace this with a simple numeral it works.
e.g. this code works
// get selected category
selectedCategory = categoryFacade.find(1);
Does anyone have any ideas why the cast is failing? categoryId is confirmed as a string with a value of "1" in the debugger...
Okay, I've cracked this. It was obviously my fault...
The table identity should have been set up as a short, instead I set it up as an integer. Therefore by casting the 'categoryId' string to short and passing it into the find method, I was passing in the wrong data type.
Replacing the 'Short.parseShort(categoryId)' argument with a 'Integer.parseInt(categoryId)' fixed the problem.
For those that took the time to read this; thank you.

Don't understand why I am getting this - 'Error: Value storage corrupted: negative offset'

I just started using IntelliJ-IDEA, and I don't know if the problem resides with the IDE or not. I'm assuming not but I have no idea. I've spent quite a lot of time googling this error to no avail.
The error comes about at compile time. The weird thing is that I returned my code to the way it was before the error was showing up and it is still being thrown. Here is a little bit of my code that I believe is causing the problem. But I think it might be something besides my code.
import org.joda.xpath.XPath;
private XPath componentXPath;
private List list;
this.componentXPath = XPath.newInstance("(//rss/channel/item)");
Document doc = jiraAdapter.fetch("path to XML file");
list = componentXPath.selectNodes(doc);
The componentXPath.selctNodes(doc) is somehow causing the problem. If i remove this line, then it compiles fine, but I need to get a list of all the nodes to work with.
The error shows up in the messages pane: Error: Value storage corrupted: negative offset
Any help would be greatly appreciated.
What IDEA version do you use? Try File | Invalidate Caches and then rebuild the project.

Categories

Resources