Page 1 of 1
Unsupported major.minor version 51.0 (unable to load class o
Posted: 22 Sep 2016, 11:43
by johanishaan
Hi,
I'm trying to run pf 6 on a jdk 6 but i got the following:
java.lang.UnsupportedClassVersionError: org/atmosphere/cpr/AtmosphereServlet : Unsupported major.minor version 51.0 (unable to load class org.atmosphere.cpr.AtmosphereServlet) (unable to load class org.primefaces.push.PushServlet)
i used the following in my pom:
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>2.4.6</version>
</dependency>
thx for the help,
johan
Re: Unsupported major.minor version 51.0 (unable to load cla
Posted: 22 Sep 2016, 13:16
by tandraschko
try to ask the atmosphere guys, it's not our servlet.
Re: Unsupported major.minor version 51.0 (unable to load cla
Posted: 22 Sep 2016, 16:05
by johanishaan
hi tandraschko,
So I had to downgrade atmosphere runtime to 1.0.19 so that i may run on servlet 2.5 wls.
I still get SEVERE: Servlet /tjsf2011 threw load() exception
java.lang.ClassNotFoundException: org.atmosphere.cpr.MetaBroadcaster$MetaBroadcasterCache
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2446)
at java.lang.Class.getConstructor0(Class.java:2756)
at java.lang.Class.newInstance0(Class.java:328)
at java.lang.Class.newInstance(Class.java:310)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4451)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4768)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:803)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:780)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:676)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:560)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1402)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:835)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:771)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:849)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:351)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
at java.lang.Thread.run(Thread.java:695)
I am guessing due to my web.xml:
Code: Select all
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<!--<async-supported>true</async-supported>-->
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
How should I use the pf push framework to utilize the 1.0.19 runtime? I don't mind using deprecated classes as long as they can just run.
I changed the code that was like so:
Code: Select all
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/browser", agents);
to :
Code: Select all
PushContext pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/browser", agents);
how do i correctly initialize the web.xml?
Thanks in advance.
BR,
Johan
Re: Unsupported major.minor version 51.0 (unable to load cla
Posted: 22 Sep 2016, 16:43
by tandraschko
I'm almost sure that you need a newer version of atmosphere as 1.0.x, so that it will work with PF6. So there is no solution for now, sry.
Also remember: Java6 is EOL since some years
So we won't do any hacks for you.
Re: Unsupported major.minor version 51.0 (unable to load cla
Posted: 22 Sep 2016, 17:43
by johanishaan
thats a bummer..lol
too bad i'm not the one whose making the calls in terms of server specs..
but if you've heard of a way to get back to 1.0.19 please fill me up
thanks for the effort already given thus far!
br,
johan
Re: Unsupported major.minor version 51.0 (unable to load cla
Posted: 22 Sep 2016, 18:15
by tandraschko
yep, i know but maybe should talk with your admins to get java7
You have one chance: create a issue on atmosphere side, so they can introduce java 1.6 compatible again. PF still compiles on java 1.6.
Re: Unsupported major.minor version 51.0 (unable to load cla
Posted: 31 Jan 2017, 15:42
by mqs24d
I had the same problem and just clone the git repo and checked out branch atmosphere-2.4.x and reset to the tag 2.4.3 (the version which is referenced by primefaces6). I only had to adjust the parent pom.xml and remove all the diamond operators <> inside the collection ctor calls. And in one class i wraped Exceptions in RuntimeExceptions (check the git patch below).
I needed that because my Websphere 8 runs on java 6. I didn't get it running on Websphere (because of another problem => annotation scanning might be not working correctly because no Atmosphere Handlers are created) but with Liberty Profile Server it works.
Here is the patch:
Code: Select all
diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java b/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java
index ed0c480..119ed7e 100644
--- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java
+++ b/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java
@@ -582,7 +582,7 @@
}
public LocalAttributes() {
- this.localAttributes = new ConcurrentHashMap<>();
+ this.localAttributes = new ConcurrentHashMap();
}
public LocalAttributes put(String s, Object o) {
diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java b/modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java
index 8a75db9..a07f307 100644
--- a/modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java
+++ b/modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java
@@ -56,7 +56,7 @@
private final LinkedList<Injectable<?>> injectables = new LinkedList<Injectable<?>>();
private final LinkedList<InjectIntrospector<?>> introspectors = new LinkedList<InjectIntrospector<?>>();
private final LinkedList<InjectIntrospector<?>> requestScopedIntrospectors = new LinkedList<InjectIntrospector<?>>();
- private final LinkedHashSet<Object> pushBackInjection = new LinkedHashSet<>();
+ private final LinkedHashSet<Object> pushBackInjection = new LinkedHashSet();
private final List<InjectionListener> listeners = new LinkedList();
private int maxTry;
@@ -135,7 +135,7 @@
// in META-INF/services/org/atmosphere/inject.Injectable
Set<Field> fields = new HashSet<Field>();
Object instance = null;
- final LinkedHashSet<Object> postponedMethodExecution = new LinkedHashSet<>(pushBackInjection);
+ final LinkedHashSet<Object> postponedMethodExecution = new LinkedHashSet(pushBackInjection);
while (!pushBackInjection.isEmpty() & maxTryPerCycle-- > 0) {
Iterator<Object> t = new LinkedList(pushBackInjection).iterator();
pushBackInjection.clear();
@@ -219,7 +219,7 @@
postMethodInjection(m, instance, (Class<U>) instance.getClass());
} catch (Exception ex) {
methodInjectionException(m, instance, (Class<U>) instance.getClass(), ex);
- throw ex;
+ throw new java.lang.RuntimeException(ex);
}
}
}
@@ -279,7 +279,7 @@
}
} catch (Exception ex) {
fieldInjectionException(field, instance, clazz, ex);
- throw ex;
+ throw new java.lang.RuntimeException(ex);
} finally {
field.setAccessible(false);
}
@@ -326,7 +326,7 @@
}
public void requestScoped(Object instance, Class defaultType, AtmosphereResource r) throws IllegalAccessException {
- Set<Field> fields = new HashSet<>();
+ Set<Field> fields = new HashSet();
fields.addAll(getInheritedPrivateFields(defaultType));
for (Field field : fields) {
@@ -353,7 +353,7 @@
}
public void requestScoped(Object instance, Class defaultType) throws IllegalAccessException {
- Set<Field> fields = new HashSet<>();
+ Set<Field> fields = new HashSet();
fields.addAll(getInheritedPrivateFields(defaultType));
for (Field field : fields) {
@@ -380,7 +380,7 @@
}
public boolean needRequestScoped(Class defaultType) throws IllegalAccessException {
- Set<Field> fields = new HashSet<>();
+ Set<Field> fields = new HashSet();
fields.addAll(getInheritedPrivateFields(defaultType));
for (Field field : fields) {
diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java b/modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java
index ec09409..f73cc21 100644
--- a/modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java
+++ b/modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java
@@ -76,7 +76,7 @@
logger.debug("Path: {}, targetPath: {}", pathLocal, paths[1]);
String[] inParts = paths[0].split("/");
String[] outParts = paths[1].split("/");
- Map<String, String> annotatedPathVars = new HashMap<>();
+ Map<String, String> annotatedPathVars = new HashMap();
int len = Math.min(outParts.length, inParts.length);
for (int i = 0; i < len; i++) {
String s = outParts[i];
diff --git a/modules/cpr/src/main/java/org/atmosphere/util/Utils.java b/modules/cpr/src/main/java/org/atmosphere/util/Utils.java
index d73f9f8..29e8838 100644
--- a/modules/cpr/src/main/java/org/atmosphere/util/Utils.java
+++ b/modules/cpr/src/main/java/org/atmosphere/util/Utils.java
@@ -280,7 +280,7 @@
}
public final static Set<Method> getInheritedPrivateMethod(Class<?> type) {
- Set<Method> result = new HashSet<>();
+ Set<Method> result = new HashSet();
Class<?> i = type;
while (i != null && i != Object.class) {
diff --git a/pom.xml b/pom.xml
index 2e50c6f..b4c791d 100755
--- a/pom.xml
+++ b/pom.xml
@@ -90,8 +90,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
- <source>1.7</source>
- <target>1.7</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
<plugin>