WAS 6.1 shows Java version 5, but its really 1.4 - java

I have a strange problem.
I have configured our Websphere Application Server to run Java 5. Its a really old application that I have migrated from Java 4.
If I in the jsp page print
System.getProperty("java.version")
System.getProperty("java.specification.version")
System.getProperty("java.vm.name")
I get
Java version: 1.5.0
java.specification.version: 1.5
java.vm.name: IBM J9 VM
However, If I in the jsp change the code from List to List<Object> I get the following exception:
The type ArrayList is not generic; it cannot be parameterized with arguments <Object>
JSPG0091E: An error occurred at line: 79 in the file: /jsp/archive/archiveoverview.jsp
JSPG0093E: Generated servlet error from file: /jsp/archive/archiveoverview.jsp
C:\SDP75\runtimes\base_v61\profiles\was61profile1\temp\CR122599Node01\server1\myifEAR\myif.war\jsp\archive\_archiveoverview.java : 199 : Syntax error, parameterized types are only available if source level is 5.0
How can this be???

The JVM used to run WebSphere Application Server is different from the compiler compliance level used to compile JSPs running within the server. See this technote: Using Java 5 language feature in a JSP targeting WebSphere Application Server v6.1.

Related

Using JDK15's JEP 378 text blocks in Tomcat JSP pages

Sample code:
String s = """
test
""";
%>
Getting.
org.apache.jasper.compiler.JDTCompiler.generateClass Unsupported target VM [15] requested, using [13]
/usr/local/tomcat/bin/version.sh reports:
Server version: Apache Tomcat/9.0.38
JVM Version: 15+36-1562
At http://tomcat.apache.org/tomcat-10.0-doc/changelog.html I see:
Add support for specifying Java 14 (with the value 14) and Java 15 (with the value 15) as the compiler source and/or compiler target for JSP compilation. If used with an ECJ version that does not support these values, a warning will be logged and the latest supported version will used. (markt)
Anyone had any success getting Text Blocks working on non-alpha Tomcat?

GWT RemoteServiceServlet Java 6

I need to deploy my GWT application to an OC4J server using Java 6.
I'm using GWT SDK 2.7.0 - according to the release notes while Java 7 is the default, this can be overridden using -sourceLevel 6 which in Eclipse I am adding as a compiler argument.
This has solved most of the problems the OC4J progress text gave me when deploying my war - but one seems to remain.
Operation failed with error: com/google/gwt/user/server/rpc/RemoteServiceServlet : unsupported classversion 51.0
Ignoring the specificity of OC4J, why is the RemoteServiceServlet a Java 7 class, when I have set the GWT compiler to use Java 6?
It sounds like you aren't using the right version of GWT - either that isn't 2.7.0, or you are using the wrong jar:
$ javap -cp /Users/colin/.m2/repository/com/google/gwt/gwt-servlet/2.7.0/gwt-servlet-2.7.0.jar -v com.google.gwt.user.server.rpc.RemoteServiceServlet
Classfile jar:file:/Users/colin/.m2/repository/com/google/gwt/gwt-servlet/2.7.0/gwt-servlet-2.7.0.jar!/com/google/gwt/user/server/rpc/RemoteServiceServlet.class
Last modified Nov 20, 2014; size 11978 bytes
MD5 checksum ef76115d101d7321764ed74a7d8c1d62
Compiled from "RemoteServiceServlet.java"
public class com.google.gwt.user.server.rpc.RemoteServiceServlet extends com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet implements com.google.gwt.user.server.rpc.SerializationPolicyProvider
minor version: 0
major version: 50
...
I just checked gwt-user also, and it too is 50.0, check that your gwt-servlet is actually the version you think you are using?

java 8 supported web service frameworks

What are the java 8 features supported web service frame works.
I tried with axis2 latest version, but it shows the below error,
org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: Error looking for paramter names in bytecode: unexpected bytes in file
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:441)
at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109)
at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:232)
at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:154)

"Bad major version" error when using Jasper-Reports on Websphere

When I try to fill a JasperReport in my Servlet running on Websphere 6.1 I get an UnsupportedClassVersionError: Bad major version at offset=6.
I guess that the compiled JasperReport has a different version (java 6?) than the jre on websphere can execute (which would be java 5), but I can not figure out why. Compiling the reports with maven or in the application (in the servlet) both leads to the error.
According to the demo which was provided with JasperReports, which also shows how to use it with Java 1.5, I added following config to the jasperreports.properties:
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.TargetPlatform=1.5
But the error still exists.
The language used in the report is Java, so which compiler is the correct one to use? net.sf.jasperreports.engine.design.JRJdtCompiler or net.sf.jasperreports.engine.design.JRJavacCompiler?
Unfortunately, the documentation does not explain the difference between those two compilers...
Edit: so fare I have been using the JRJavacCompiler. With the JRJdtCompiler I get a NullPointer Exception:
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at net.sf.jasperreports.engine.fill.JRFillTextField.getFormat(JRFillTextField.java:706)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:394)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2036)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:540)
at com.swissre.sod.jone.web.server.FileStreamingServlet.doGet(FileStreamingServlet.java:48)
It might be that you are using libraries in you application that are compiled in java 6.
You could check the MANIFEST information of your dependencies to find out more.

500 server error with servlet after deploy it on app engine

please take a look to my problem below i deployed my website (java) on my app engine account the url it work to show html and jsp pages but the servlet pages it make error rather than show it correctly this is what appear:
Error: Server Error The server encountered an error and could
not complete your request. If the problem persists, please report your
problem and mention this error message and the query that caused it.
notice :: that all work on localhost server but on app engine !! what can i
do to avoid this problem !!!!
web/ASS2webServlet : Unsupported major.minor version 51.0, java.lang.UnsupportedClassVersionError
Indicates that you are using a higher version of Java than GAE supports. Quoting from documentation of GAE:
"App Engine runs Java applications using the Java 6 virtual machine (JVM). The App Engine SDK supports Java 5 and later, and the Java 6 JVM can use classes compiled with any version of the Java compiler up to Java 6"
So can you check what version are you using on local Eclipse to compile your classes?

Categories