Protobufs - 'supposed to be overridden by subclasses' exception - java

I've got a problem with Google Protocol Buffers. The java class compiled using protoc throws exceptions during conversion to byte array.
Here is the example code:
byte[] raw = pbCard.toByteArray();
// PbCard.Card is an instance of a protoc-generated class.
This results in an exception:
Exception in thread "main" java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.
This kind of behaviour was diagnosed by many to be a problem with protoc versions. When using java classes generated using protoc < 2.5.0 and including a java library 2.5.0, this exception will be generated.
Links:
http://code.google.com/p/protobuf/issues/detail?id=493
error with serialization with protobuf
http://comments.gmane.org/gmane.comp.lib.protocol-buffers.general/9588
Protobuf 2.5.0 bug?
However, in my case both the protoc and java library are in version 2.5.0.
eipifi#vaio:~$ protoc --version
libprotoc 2.5.0
And the included jar:
eipifi#vaio:~$ sha1sum protobuf-java-2.5.0.jar
a10732c76bfacdbd633a7eb0f7968b1059a65dfa protobuf-java-2.5.0.jar
No older version of protobufs was ever present on my machine. All java classes were generated on this machine and were not moved from an older project.
What am I missing?
Thank you for your time.

Related

When I upgrade MatlabRuntime from 2019b to 2021b,I hava a proplem

When I upgrade MatlabRuntime from 2019b to 2021b and I hava a springboot service used matlab, I have a problem,I import newest javabulider.jar(2021b) into my springboot service, then I package and publish my service into server,then report an error,can someone help me,thank you
Caused by: java.lang.UnsatisfiedLinkError: Failed to find the required library libmwmclmcrrt.so.9.7 on java.library.path.
This library is typically installed along with MATLAB or the MATLAB Runtime. Its absence may indicate an issue with that installation or
the current path configuration, or a mismatch with the architecture of the Java interpreter on the path.
MATLAB Runtime version this component is attempting to use: 9.7.
Java interpreter architecture: glnxa64.
I need someone can help me
The message:
Failed to find the required library libmwmclmcrrt.so.9.7
Indicates that the application you are trying to execute was compiled with Matlab 2019b and that the corresponding MCR is not installed.

Can't acces com.sun.net.ssl.internal.ssl.Provider() Java MailApi

I am working at an EmailBot which sends lots of Emails. Today I installed Linux for developing. I am using the same IDE. But I'm getting this weird error
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The type com.sun.net.ssl.internal.ssl.Provider is not accessible
at de.EmeldemelTV.Nice.Packi.EmailSend.main(EmailSend.java:38)
(I'm using the Java Mail API)
I am not familiar with that class, but I would check version of java. Perhaps you have different jdk on linux and this class was removed in this version.

Use incompatible versions of JiBX Runtime

I want to use 2 libraries that have been built with different and incompatible versions of JiBX.
Lib #1 runs with JiBX Runtime 1.0.1
Lib #2 runs with JiBX Runtime 1.2.6
The current version number is coded in the interface : org.jibx.runtime.IBindingFactory#CURRENT_VERSION_NUMBER .
When calling org.jibx.runtime.BindingDirectory#getFactory(), there's a compatibility test.
If the generated class and the runtime are incompatible, we got an exception like this :
Caused by: org.jibx.runtime.JiBXException: Binding information for
class Xxxx must be
regenerated with current binding compiler at
org.jibx.runtime.BindingDirectory.getFactoryFromName(Unknown Source)
at org.jibx.runtime.BindingDirectory.getFactory(Unknown Source)
EDIT - 29/07/2015
Another possible exception :
Caused by: org.jibx.runtime.JiBXException: Binding information for
class
Yyyyy must
be recompiled with current binding compiler (compiled with jibx_1_0_1,
runtime is jibx_1_2_5_SNAPSHOT) at
org.jibx.runtime.BindingDirectory.getFactoryFromName(BindingDirectory.java:125)
at
org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:178)
at
org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:197)
Is it possible to make it work ?
I've looked at the doc about JiBX Runtime but didn't found anything.
JiBX Runtime on Maven Central Repo.

"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.

NoSuchMethodError when attempting to implicitly convert a java to scala collection

I started to receive this kind of error in my code:
Message:
java.lang.NoSuchMethodError:scala.collection.JavaConversions
$.asScalaSet(Ljava/util/Set;)Lscala/collection/mutable/Set
and then I see a long screen of stacktrace of uninteresting nature, which is triggered on this piece of code:
edited.authors.toSeq
where authors is a java.lang.Set. Does anybody know why is this happening? It's a runtime failure and not a compile one.
You are using a library which has been compiled with 2.8.1 from the 2.8.0 runtime

Categories