# Glassfish Error: getIncludes() (Files from Tomcat 5.5)

## Kenji Miyamoto

I recently migrated a set of JSP files from an old Tomcat 5.5 server to a Glassfish server, and am getting some strange errors:

```
exception 

org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP

PWC6199: Generated servlet error:

string:///excel_005fimport_jsp.java:23: org.apache.jsp.tims.excel_005fimport_jsp is not abstract and does not override abstract method getIncludes() in org.apache.jasper.runtime.HttpJspBase

PWC6199: Generated servlet error:

Note: string:///excel_005fimport_jsp.java from  uses unchecked or unsafe operations.

PWC6199: Generated servlet error:

Note: Recompile with -Xlint:unchecked for details.
```

I don't have much experience here, and all I know about the Glassfish server is that it's a default install and of version 2.1.1.  Does anybody know how I could resolve this?

----------

## ryan221

Well assuming everything was copied over correctly and it's not a matter of a corrupt or missing file or something.

If these files worked fine before then that would be more likely , anyway , based solely on the error in your post, here's my opinion 

i don't know anything about glassfish or tomcat but JSP is like java and that i do know a little about that

 *Quote:*   

> string:///excel_005fimport_jsp.java:23: org.apache.jsp.tims.excel_005fimport_jsp is not abstract and does not override abstract method getIncludes() in org.apache.jasper.runtime.HttpJspBase

 

In java , this would mean that org.apache.jasper.runtime.HttpJspBase is probably one of 2 things. Either it's an interface that is implemented by excel_005fimport_jsp or it could be an abstract class, either way,excel_005fimport_jsp inherits this abstract method "getIncludes()". It needs to be overrriden in that class or that class needs to be declared abstract. 

It's refusing to compile that class because of that error 

There's a chance that nothing is even trying to use this method , especially since it wasn't overridden , Your fix could be as simple as finding the file " excel_005fimport_jsp.java " adding an empty method called getIncludes() to it.

Of course, it  could also be that another error is causing this one or at least causing it to think it has this error, but then that would require going throught the code.

----------

## timeBandit

 *ryan221 wrote:*   

> i don't know anything about glassfish or tomcat ... 

 ...which is problematic, here.  :Wink: 

 *Quote:*   

> ...excel_005fimport_jsp inherits this abstract method "getIncludes()". It needs to be overrriden in that class or that class needs to be declared abstract. ...

 The gap in your understanding is that excel_005fimport_jsp.java is generated code and any compilation errors cannot be "fixed" directly. GlassFish creates these classes by translating JSPs--in this case, excel_import.jsp--to Java, compiles them to create servlets and invokes the servlets to service requests for each JSP. The problem here is that the translation phase produced code which does not match the J2EE servlet API specification expected by the compilation phase. This is an internal problem in the appserver that cannot be corrected by tweaking JSP code.

Kenji, in all likelihood you have mismatched versions of the Jasper (JSP compiler) and JSP API JARs on your CLASSPATH. Somehow GlassFish is using one version of the specification to translate JSPs and a newer version (which requires getIncludes()) to compile them. Did the webapp you migrated from Tomcat include any JAR files, such as in a WEB-INF/lib directory? That is where I'd look first. The deployed application should not include any Tomcat JARs as GlassFish will provide its own implementations of the relevant API.

Also check the GlassFish domain CLASSPATH carefully for multiple occurrences of Jasper or other J2EE JARs, or JARs collected from any location outside the GlassFish installation root. The common/lib directory in Tomcat might provide a list of likely suspects. I am still new to GlassFish myself so I can't be more specific or certain. There is little doubt of the problem though: your JSP was translated according to one spec and compiled against another, and that points squarely to mismatched JARs. 

Once you've located and corrected the mismatch you will need to delete the previously generated classes before restarting the domain. You will find these under $GLASSFISH_ROOT/domains/${domain}/generated/jsp/j2ee-modules/${context}, where the variables represent the GlassFish installation directory, the domain where you deployed your app (probably domain1 if you are using the default) and the application name, respectively.

----------

