Facing issues with org.apache.jasper dependency. It would be great If someone can suggest what dependencies are needed for compiling JSP in java 11 with OSGI
It might help to provide your development environment and a bit more details about why the bundle is not enough?
There is prey weird behaviour that we are observing. When we import a class in JSP that does not have any string + operations, it is working fine. But when the imported class contains these operations, it is failing. For example:
Working class files:
public class App {
public string getName(){
String name = “test**”;
return name;
}
}
public class App {
public string getName(){
String name = “test**”;
return “test”.concat(name);
}
}
Non-working class file:
public class App {
public string getName(){
String name = “test**”;
return name + “fail”;
}
}
Stacktrace:
MESSAGE:Compilation error
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.(ClassFileReader.java:298)[44:org.apache.jasper:5.5.17.v200706111724]
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:197)[44:org.apache.jasper:5.5.17.v200706111724]
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:169)[44:org.apache.jasper:5.5.17.v200706111724]
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:119)[44:org.apache.jasper:5.5.17.v200706111724]
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)[44:org.apache.jasper:5.5.17.v200706111724]
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:415)[44:org.apache.jasper:5.5.17.v200706111724]
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:469)[44:org.apache.jasper:5.5.17.v200706111724]
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(CompilationUnitScope.java:333)[44:org.apache.jasper:5.5.17.v200706111724]
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:402)[44:org.apache.jasper:5.5.17.v200706111724]
OSGI based application
Java: Java 11.0.24 (tried with Java 11.0.18 as well)
Tomcat 9.0.89 using ecj-4.20.jar
In our current application, we are using equinox http registry, http servlet bridge and http helper jars
There is a class/VM version issue.
It looks like your code is of a version that the jdt compiler has no knowledge of. The String + might trigger this since they changed the way they handle this under the surface. It looks like you need a more recent version of the Eclipse Java Compiler.
The problem we are facing is there is no latest equinox http helper available anywhere in internet and where as with the latest versions of other versions we are facing issues with jsp and apache jasper dependency versions and none of these dependencies are available in maven as well. Is there an equivalent dependency of equinox http helper that we can make of?
Also for some reason application is using the JDT compiler from org.apache.jasper dependency rather than the compiler we have in eclipse though we put the scope of dependency as provided.
Will try to document the exact versions of all the dependencies we are using in our Java 8 applications and the one’s we are trying to use in our Java11 migration effort.
You seem to be in dependency hell … It sometimes helps to hire an external expert to fix these issues once …