Background
A common cause of the 'wrong name' error for JSP is case sensitivity on win32 platforms
when you are using the RequestDispatcher to forward to your JSP by name.
If you create a JSP with the name abcDef.jsp (note the capital 'D')and deploy it, the
servlet container will create a servlet with a name derived from your JSP name
(e.g. abcDef_jsp.java).
It will then compile the servlet and store the resulting class in its working area.
If you then change the case of the name of your JSP (e.g. to abcdef.jsp) and re-deploy
it, the servlet engine will again try to create a servlet with a name derived from your
JSP name and compile it.
On Unix platforms (which are case sensitive), the above scenario will result in another
servlet being created called abcdef_jsp.java because abcDef is different to abcdef.
However, on win32 platforms, the file name abcDef.jsp is the same as the file name abcdef.jsp
so the old servlet will be over-written and the old name (abcDef_jsp.java) will be preserved.
So originally using RequestDispatcher.forward("abcDef.jsp") to forward to the page was working
ok. However now, your code is changed to forward to RequestDispatcher.forward("abcdef.jsp")
but the servlet generated from your JSP is *still* called abcDef_jsp.java so the servlet
complains about the JSP having a 'wrong name'.
Cause in JCodeBox
The following is an example of how this problem could occur in applications generated by JCodeBox:
You have 2 BMP entity beans (and associated views sets) defined called customer and address. You define a 1:1 relationship
between the 2 beans and call it custAdd (this results in a JSP being automatically created named customercustAdd.jsp).
You generate and deploy the application. You then change the name of the relationship to custadd - now
with a lower case 'A' - and redeploy the application.
Now when you click on the link to retrieve the customer address information you get the 'wrong name'
error being thrown by the servlet container.
Solution
Delete all the generated files in you JCodeBox target output directory before re-generating and re-deploying
the application.
Delete the .java and .class generated servlet files in your servlet containers work area. The servlet container
will re-generate these files the next time the JSP is requested.
Additional Info
This problem can be spotted by an exception similar to the following one being thrown when you
try and forward to your JSP using RequestDispatcher
22:40:37,086 ERROR [Engine] ApplicationDispatcher[/TestAppOracle] Servlet.servic
e() for servlet jsp threw exception
javax.servlet.ServletException: org/apache/jsp/CUSTOMEREJBcustAdd_jsp (wrong nam
e: org/apache/jsp/CUSTOMEREJBcustadd_jsp)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:684)
Further down in the exception stack a root cause error similar to the following can also be found:
22:40:37,236 ERROR [Engine] ----- Root Cause -----
java.lang.NoClassDefFoundError: org/apache/jsp/CUSTOMEREJBcustAdd_jsp (wrong nam
e: org/apache/jsp/CUSTOMEREJBcustadd_jsp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.lang.ClassLoader.defineClass(ClassLoader.java:426)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:21
5)