java version Incompatibility issue

82 views
Skip to first unread message

aakash joshi

unread,
Aug 21, 2018, 8:42:42 AM8/21/18
to togglz-users
I am trying to use the Togglz latest API but getting getting below exception in after deploying it in an ear.
Looks like the togglz jars were compiled and packed with different version of java.
I am using Java 1.7 version and i checked with different version of togglz as well but all compiled with Java 1.8 version.


<Aug 21, 2018 5:57:15 PM IST> <Error> <Class Loaders> <BEA-2162500> <Class, org.togglz.console.TogglzConsoleServlet, was compiled with an incompatible version of Java. Make sure that all the classes needed by the application have been compiled with a compatible java version. java.lang.UnsupportedClassVersionError: org/togglz/console/TogglzConsoleServlet : Unsupported major.minor version 52.0
java.lang.UnsupportedClassVersionError: org/togglz/console/TogglzConsoleServlet : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:385)
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:344)

Christian Kaltepoth

unread,
Aug 21, 2018, 11:15:29 AM8/21/18
to togglz...@googlegroups.com
Togglz requires Java 8 starting with 2.6.0. Earlier versions should work fine with Java 7, although there are a few modules which already required Java 8 back then (appengine?). 

aakash joshi

unread,
Aug 22, 2018, 12:22:59 AM8/22/18
to togglz-users
I  checked the version till 2.4.1, all were compiled with 1.8 Java.
Can you please tell me which Togglz version i can use with 1.7 Java.

Christian Kaltepoth

unread,
Aug 22, 2018, 1:13:01 AM8/22/18
to togglz...@googlegroups.com
You should be able to use 2.5.0 with Java7. If this doesn't work, please share the exact stacktrace and the relevant part of your pom.xml.

aakash joshi

unread,
Aug 23, 2018, 3:59:49 AM8/23/18
to togglz-users
Hi Christian,

I am deploying the war in a weblogic ear and i can see in weblogic console that the war is deployed also.
But when i am hitting the url which is configured in the web.xml, it is not getting launched at all and getting "Error 403--Forbidden" error.





Web.xml is placed in a togglz.war and also the togglz-console.jar is also present inside the lib folder in togglz.war


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
   <welcome-file-list>
      <welcome-file>Index.html</welcome-file>
   </welcome-file-list>
   <servlet>
    <servlet-name>TogglzConsoleServlet</servlet-name>
    <servlet-class>org.togglz.console.TogglzConsoleServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>TogglzConsoleServlet</servlet-name>
    <url-pattern>/togglz/*</url-pattern>
  </servlet-mapping>
</web-app>


Please let me know what i have missed here.

Christian Kaltepoth

unread,
Aug 23, 2018, 4:35:48 AM8/23/18
to togglz...@googlegroups.com
So you are trying to access the Togglz Console? Did you configure a UserProvider as part of your Togglz configuration? 

aakash joshi

unread,
Aug 23, 2018, 7:26:03 AM8/23/18
to togglz-users
Yes, first i tried with the dummy UserProvider provided in the configurations then i tried with the custom provider also.


 @Override
    public UserProvider getUserProvider() {
    return new UserProvider() {
             
             @Override
             public FeatureUser getCurrentUser() {
             
                 HttpServletRequest request = HttpServletRequestHolder.get();
                 
                 String username = (String) request.getAttribute("username");
                 boolean isAdmin = "admin".equals(username);
                 
                 return new SimpleFeatureUser(username, isAdmin);
                 
             }
         };
    } 

Christian Kaltepoth

unread,
Aug 24, 2018, 12:18:45 AM8/24/18
to togglz...@googlegroups.com
You should really try a simpler UserProvider first like suggested by Rui.
--
Reply all
Reply to author
Forward
0 new messages