testing java ee 6 with junit 3 - java-ee-6

I have a short question: Can I test java ee 6 with junit 3, or do I have to use JUnit 4?

No, JUnit version 3.8 and earlier supports Java up to version 1.4.
Source: http://www.methodsandtools.com/tools/tools.php?junit

Related

Wicket 9 & Tomcat 10 Can't Cast jakarta.servlet.Filter

I'm trying to use the Wicket Project 'QuickStart' with
Netbeans 11, Java 11, Tomcat 10, Wicket 9, and Ubuntu 18.04.
When I install the WAR package and start it, it throws:
20-May-2020 09:23:37.067 GRAVE [] org.apache.catalina.core.StandardContext.filterStart Exception at start [wicket.quickstart]
java.lang.ClassCastException: class org.apache.wicket.protocol.http.WicketFilter cannot be cast to class jakarta.servlet.Filter (org.apache.wicket.protocol.http.WicketFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader)
Has anyone seen this issue before and if so, what can I do to resolve this?
The issue is that Tomcat 10 uses jakarta.** packages (Jakarta EE 9) while Wicket 9.x is still based on javax.** packages (Java EE 8).
The solutions are:
Use Tomcat 9.x
Use https://github.com/apache/tomcat-jakartaee-migration to migrate the Wicket application (the .war file) from javax to jakarta
Deploy the javax.** based application into $TOMCAT10_HOME/webapps-javaee/ folder. It will be automatically migrated to jakarta.** by Tomcat.
Don't use Tomcat 10 yet, it works with the new jakarta packages.
Switch to version 9 instead.
To make wicket 9 work with with jakarta, e.g. if using tomcat 10 or spring boot 3, you have to convert some jars. There is the tool jakartaee-migration which does this for a given jar. So apply it at least to these 4 jars and create new ones - I used -jakarta as appendix:
wicket-core -> wicket-core-jakarta
wicket-util -> wicket-util-jakarta
wicket-request -> wicket-request-jakarta
commons-fileupload -> commons-fileupload
Also create proper pom files put all together into your local/shared repository.
To use it, add the new dependencies and exclude the old ones where necessary. Run mvn dependency:tree until nothing bogus gets picked up.
Congrats - you now have wicket 9 for jakarta.

Scalatra throwing null pointer exception with java 8

I am running a web application with Scala version 2.9.0 and Scalatra version 2.1.0-SNAPSHOT. I build the application with Java 1.6. It runs fine when I run it with Java 1.7 but fails when ran with Java 1.8 with this error. What can be the issue?
It is important for me to run with java 1.8 is because I have some third party jars used in my application which are complied with java 1.8. I have other scala applications with I have built with java 1.6 and run fine with java 1.8 but I am only facing this issue with applications using scalatra.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.fusesource.scalate.TemplateException
org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:834)
org.fusesource.scalate.TemplateEngine.compileAndLoadEntry(TemplateEngine.scala:691)
org.fusesource.scalate.TemplateEngine.liftedTree1$1(TemplateEngine.scala:411)
org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:405)
org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:475)
org.scalatra.scalate.ScalateSupport$class.renderScalateErrorPage(ScalateSupport.scala:140)
org.scalatra.scalate.ScalateSupport$class.handle(ScalateSupport.scala:131)
root cause
java.lang.NullPointerException
scala.tools.nsc.Global$Run.compileLate(Global.scala:1043)
scala.tools.nsc.symtab.SymbolLoaders$SourcefileLoader.doComplete(SymbolLoaders.scala:303)
scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:111)
scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:85)
scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:732)
The release notes for Scala 2.9 list it's dependencies: "It requires the Java runtime version 1.6 or 1.7." Scala 2.11.1 announced support for Java 8 but called that "experimental." The experimental adjective was dropped from the release notes in Scala 2.11.2, but I've had problems with Java 8 in projects using later versions of Scala (probably 2.11.7).

Does Eclipse 4.4 (Luna) Require Java 1.7

I decided to update my eclipse to 4.4 (luna release). When I try to launch it however, I get an error stating that eclipse requires 1.7 or later of java jvm.
Just wanted to see if this is true and if it is possible to get it running with 1.6 (specifically 1.6.0_65)
If there is an explicit message stating that 1.7 or later is required when you run it with 1.6, I expect this to be a strong (ie blocking) minimum requirement. Eclipse Luna (4.4) is the first release requiring 1.7:
http://wiki.eclipse.org/Eclipse/Installation
And still, if you still doubt it you can verify for which version it was compiled. For every Eclipse classes run the following command:
javap -verbose EclipseClass.class
Look for Major Version. If value is 51 this means it was compiled for java 1.7, so you are out of luck for 1.6. The magic numbers for major versions are :
J2SE 8 = 52 (0x34 hex),
J2SE 7 = 51 (0x33 hex),
J2SE 6.0 = 50 (0x32 hex),
J2SE 5.0 = 49 (0x31 hex),
JDK 1.4 = 48 (0x30 hex),
JDK 1.3 = 47 (0x2F hex),
JDK 1.2 = 46 (0x2E hex),
JDK 1.1 = 45 (0x2D hex).
and are described here:
http://en.wikipedia.org/wiki/Java_class_file#Magic_Number
Thing is, each eclipse bundle have different minimum requirements, so this may not be a good option for a platform as big as Eclipse. Anyway, I mention it because its good to know.
I also had this problem during the IDE Luna installation. In my case, to solve this problem, I had that change the system variables in win 7. In my computer was the variable that was did referenced the jdk 6... after that I changed it, I could open it again.
This link helped me:
It is requesting to install latest JDK. This is the link
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I have installed jdk1.7.0_67 and its running successfully.

Troubles launching Kestrel

I am try to play with Kestrel 2.4.1 (http://robey.github.io/kestrel/). Unfortunately, it does not launch. I get the following exception when I run the devel.sh script. IOther scripts produce similar exception.
Starting kestrel in development mode...
May 17, 2014 2:26:06 PM java.util.logging.LogManager$RootLogger log
FATAL: Error in config file: %s
java.lang.UnsupportedOperationException: Position.line
at scala.tools.nsc.util.Position$class.line(Position.scala:173)
at scala.tools.nsc.util.NoPosition$.line(Position.scala:196)
at com.twitter.util.Eval$StringCompiler$$anon$1.display(Eval.scala:444)
at scala.tools.nsc.reporters.AbstractReporter.info0(AbstractReporter.scala:45)
Any help would be appreciated. I am using Java 8.
Scala support for Java 8 is experimental even in 2.11.0, and the github version has the last version of Scala being used as 2.9.2
From: Kestrel Build File
scalaVersion := "2.9.2",
From: SCALA 2.11.0 IS NOW AVAILABLE!
The Scala 2.11.x series targets Java 6, with (evolving) experimental support for Java 8. In 2.11.0, Java 8 support is mostly limited to reading Java 8 bytecode and parsing Java 8 source. Stay tuned for more complete (experimental) Java 8 support.
I would not expect this to work on Java 8 without having to fix compile issues for 2.10 and 2.11 and then Scala would need better support for Java 8.
Actually it's Logger can not init correctly.
Make sure queuePath and filename of development.scala are available.

Install the GlassFish 3 server adapter with Eclipse Helios 3.6, I got a problem

When I install the GlassFish 3 server adapter with Eclipse Helios 3.6 SR1 by here.
(Take care the third answer, I got the same problem.)
I got the wrong message:
Cannot complete the install because one or more required items could not be found.
Software being installed: GlassFish Java EE 5, Java EE 6 1.0.54 (com.sun.enterprise.jst.server.sunappsrv.feature.feature.group 1.0.54)
Missing requirement: GlassFish Java EE 5, Java EE 6 1.0.54 (com.sun.enterprise.jst.server.sunappsrv.feature.feature.group 1.0.54) requires 'org.eclipse.platform.feature.group [3.5.0,3.6.0)' but it could not be found
The main message is requires 'org.eclipse.platform.feature.group [3.5.0,3.6.0)', just like the third answer the way I followed.
Any suggestion ? Thank you.