Adam Hughes 2 Posted December 16, 2015 Share Posted December 16, 2015 I just upgraded to streambase studio 7.6, and when I try to run any of the classes in *sample_lv-java-clientapi* (eg. SimpleQuery.java), I get the following error: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/streambase/liveview/client/LiveViewException : 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 java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2615) at java.lang.Class.getMethod0(Class.java:2856) at java.lang.Class.getMethod(Class.java:1668) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) I have an instance of LiveView desktop running on localhost. I've also tried running the following method in netbeans: conn = LiveViewConnectionFactory.getConnection("lv://localhost"); And I get a similar error: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/filter/ClientFilter at com.streambase.liveview.client.LiveViewConnectionFactory.getConnection(LiveViewConnectionFactory.java:73) at com.streambase.liveview.client.LiveViewConnectionFactory.getConnection(LiveViewConnectionFactory.java:38) at bny.com.appserver.jclient.Controller.main(Controller.java:63) Caused by: java.lang.ClassNotFoundException: com.sun.jersey.api.client.filter.ClientFilter at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 3 more C:UsersXBBL2Q8AppDataLocalNetBeansCache8.1executor-snippetsrun.xml:53: Java returned: 1 BUILD FAILED (total time: 5 seconds) Any idea what this traceback might be referring to Are the rest of you able to run the examples in *sample_lv-java-clientapi* with to errors Link to comment Share on other sites More sharing options...
Steve Barber Posted December 16, 2015 Share Posted December 16, 2015 Will try it, and report back with more specifics. But in the meantime, those errors aren't similar at all! The first one means you ran a .class file compiled with a version of javac that your runtime JVM can't load -- generally a newer javac versus an older JVM. 52 corresponds to JDK 8. The second one is your basic classpath problem -- some library you need that you didn't tell NetBeans about. Link to comment Share on other sites More sharing options...
Adam Hughes 2 Posted December 16, 2015 Author Share Posted December 16, 2015 Hmm, I'm wondering if my streambase studio 7.6 could have had anything to do with the former. I have JDK 7 and 8 on my machine, and maybe studio 7.6 is using 8 while 7.5 used 7 I tried cleaning the project, and deleting and reimporting the sample, but not change. Probably is an issue on my end. In netbeans, I've imported lv-client.jar and sb-client.jar and the following imports are not yielding errors: import com.streambase.liveview.client.BeginDeleteEvent; import com.streambase.liveview.client.BeginSnapshotEvent; import com.streambase.liveview.client.EndDeleteEvent; import com.streambase.liveview.client.EndSnapshotEvent; import com.streambase.liveview.client.LiveViewConnection; import com.streambase.liveview.client.LiveViewConnectionFactory; import com.streambase.liveview.client.LiveViewException; import com.streambase.liveview.client.LiveViewQueryType; import com.streambase.liveview.client.Query; import com.streambase.liveview.client.QueryClosedEvent; import com.streambase.liveview.client.QueryConfig; import com.streambase.liveview.client.QueryExceptionEvent; import com.streambase.liveview.client.QueryListener; import com.streambase.liveview.client.TupleAddedEvent; import com.streambase.liveview.client.TupleRemovedEvent; import com.streambase.liveview.client.TupleUpdatedEvent; import com.streambase.sb.client.StreamBaseClient; import com.streambase.sb.StreamBaseException; import com.streambase.sb.Schema; import com.streambase.sb.StreamProperties; import com.streambase.sb.Tuple; Are there other jars that might need imported, but wouldn't be caught by the compiler Link to comment Share on other sites More sharing options...
Steve Barber Posted December 16, 2015 Share Posted December 16, 2015 OK, I just ran Studio 7.6.0 on Windows 7. I started up the sample_lv-helloliveview project as my Live Datamart server. Then I right-clicked on sample_lv-java-clientapi/java-src/com.streambase.liveview.sample.client/SimpleQuery.java and select Run As > Java Application from the context menu. It Worked On My Machine. What can I tell you One clue would be to look at the Studio Console view and look at the console output for SimpleQuery.java. The top line there tells what executable launched the console. Mine says C:tibcosb-cep7.6jdkbinjavaw.exe. I bet yours says something else, and that something else will be a clue. Link to comment Share on other sites More sharing options...
Steve Barber Posted December 16, 2015 Share Posted December 16, 2015 Probably worth pointing out, from the docs, Installation Guide > Supported Configurations page: "Starting with StreamBase release 7.6.0, JDK 8 is the required minimum Java version to run StreamBase Server and StreamBase Studio." and also "To compile your own StreamBase Java clients, custom functions, or custom operators with the StreamBase Java Client library, your development host must have Oracle JDK 1.7.0_75 or 1.8.0_40 or later versions. TIBCO recommends that you compile with the same JDK version as the one bundled with your StreamBase installation, described in the previous row." Link to comment Share on other sites More sharing options...
Steve Barber Posted December 16, 2015 Share Posted December 16, 2015 An SB schema as a bean class You mean like a JavaBean Never heard anyone ask for that before. It shouldn't be necessary as you can introspect the accessible schemas in a running app using the StreamBase Java APIs. A StreamBaseClient can do client.getStreamProperties("MyStream").getSchema() to get the Schema object directly. A plugin Operator or adapter can do getRuntimeInputSchema() or getRuntimeOutputSchema() on any operator port from within the processTuple() method. Yeah, you likely have some funky PATH and/or classpath settings on your machine, maybe JAVA_HOME is relevant. Usually it's pretty hard to fool the sbstudio.exe setup but it's not impossible. If you asked product support, they would ask you to send them the output of the sbhealth command and they would tell you exactly what to clean up. Start with a clean environment and work from there would be my advice -- open up a StreamBase Command Prompt and try running Studio from that instead of your Windows Desktop or menu, and even then maybe edit down your PATH and CLASSPATH to remove things Studio won't be using. Or have a look at your Windows environment settings in the Control Panel and do some housecleaning. Link to comment Share on other sites More sharing options...
Steve Barber Posted December 16, 2015 Share Posted December 16, 2015 For a LiveView Java client, have a look in sample_lv-java-clientapi Studio project and mimic what's on that project's Java Build Path properties. Specifically, we've predefined a LiveView Client library set that has the lv-client.jar and lv-client-wwwdeps.jar in it -- that jersey class your NetBeans is complaining about not finding is in that latter jar, so you probably are missing that one at least. Link to comment Share on other sites More sharing options...
Adam Hughes 2 Posted December 16, 2015 Author Share Posted December 16, 2015 Ok, thanks a lot I appreciate the help. I will dive in PS, regarding JavaBean, just want to be able to recycle some of my streambase-defined schema to clients which aren't using SB Studio. Link to comment Share on other sites More sharing options...
Adam Hughes 2 Posted December 16, 2015 Author Share Posted December 16, 2015 For the error I was getting in NetBeans, just FYI, I had to import the jar file lv-client-wwwdeps.jar Unless it was a coincidence that everything worked after I imported it... Link to comment Share on other sites More sharing options...
Hossam Deyab Posted November 9, 2017 Share Posted November 9, 2017 I faced a similar issue before. Below is the soluion if that will help. The error says: Custom Function Greeting: Unsupported major.minor Version 51.0 Cause: Tibco BW is using a different version of Java. That means, I am compiling my Java class (Greeting.java) by my default JDK which version is newer than the TIBCOs JRE version. Solution: There are many ways to use this issue, but I prefer the simplicity. You just need to compile your Java class using Tibcos Java The way to do that is: Example: C:UsersIBM_ADMINDesktop>C:tibcotibcojre641.6.0binjavac.exe C:UsersIBM_ADMINDesktopGreeting.java If you didn't reach to anything with my solution, you may have a look at this link, it provides anoher solution https://www.mkyong.com/java/java-unsupported-major-minor-version-51-0/ Link to comment Share on other sites More sharing options...
Steve Barber Posted November 9, 2017 Share Posted November 9, 2017 Well, OK, but I will note that this Question/Answer thread is specific to TIBCO Live Datamart and your Answer provides advice about how to overcome a Java version issue with BusinessWorks. So perhaps your generous information would be better as a separate Question/Answer thread tagged with BusinessWorks. Link to comment Share on other sites More sharing options...
filler Mark Posted October 30, 2019 Share Posted October 30, 2019 It is because of Java version mismatch. Unsupported major.minor version error happens when you compile your projects on higher version of java(e.g. jdk 1.8) and then run it on a lower version (e.g. jdk 1.7). Depending on your situation, you have two ways to resolve this error: compile your code for an earlier version of Java, or run your code on a newer Java version. Sometimes you may have more than one version of Java SDK installed in your machine. Make sure the application you are running is pointing to the right or highest version available . It is better you need to install both JRE/JDK with the same version. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now