Local class incompatible: stream classdesc serialVersionUID
The following code is being executed from the configFile class:
if(configFileIn != null)
try
ourConfigItemsAL = (ArrayList)alInObjectStream.readObject();
catch(Exception e)
configIsValid = false;
System.out.println("Error: Can't read (readObject ourConfigItemsAL) from \"" + theFileName + "\". (" + e.toString() + ")");
configItemsAL = theDefList;
I get the following error when trying to run. It worked with an older version of the jre.
Creating new NewConfigFile object.
About to read configuration from "c:/Program Files/HearingRecorder/HearingRecorder.cfg" file.
Error: Can't read (readObject ourConfigItemsAL) from "c:/Program Files/HearingRecorder/HearingRecorder.cfg". (java.io.InvalidClassException: javax.swing.JComponent; local class incompatible: stream classdesc serialVersionUID = -7908749299918704233, local class serialVersionUID = 7917968344860800289)
java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at HearingRecorder.ConfigFile.readConfig(ConfigFile.java:150)
at HearingRecorder.ConfigFile.<init>(ConfigFile.java:92)
at HearingRecorder.HearingRecorder.<clinit>(HearingRecorder.java:4462)
Exception in thread "main"
The Java TutorialEssential Java Classes I/O: Object Serialization
Lightweight persistence--the archival of an object for use in a later invocation of the same program.
Serlization does not play nice between VM versions. It tells you this in the APIs for JComponent
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.
Similar Messages
-
Hi,
I recently create a webservice application.
It work fine when the server is implemented as java application. But when rewritten as web application( *.war), the deploiement work on WLS.
However it throws java.io.InvalidClassException: org.eclipse.persistence.internal.indirection.DatabaseValueHolder; local class incompatible: stream classdesc serialVersionUID = -6893195210780291759, local class serialVersionUID = 1128857921468654749 error when the client start consumming the web service methods.
I add both eclipselink-javax.persistence-2.0.jar and eclipselink-2.0.2.jar(which are also used in the server side) in $WL_HOME/wlserver_10.3/common/deployable-libraries, that doesn't solve the problem yet.
Any help will be appreciated, cheers.Abenk,
This looks like a serial version mismatch due to multiple Eclipselink.jar files. Check if you have any under server/internal/ext folder.
What are you putting in your classpath? Is there a "jrf.jar" and is it getting picked up first? Does this Jrf.jar have an entry of Eclipselink jar?
Try to check the classpath of the jars used by Weblogic and remove any redundant Eclipselink/Toplink jars.
What is the complete version of your Weblogic Server ? -
Ava.io.InvalidClassException: local class incompatible: stream classdesc
Hi,
When I am testing a scnerio in my application, I am getting the following error. When I am trying to do again, I am not getting this error. Basically when first time serializable object creation, I am getting this error I guess. Pls reply as its really disturbs our application in Production.
22 Apr 2005 14:27:12,442 ERROR [service-j2ee] model.TopsFileManager - java.io.InvalidClassException: com.gepower.gees.tops.data.JobCtxtMgr; local class incompatible: stream classdesc serialVersionUID = 7011266017804180214, local class serialVersionUID = 1299119170608910687
java.io.InvalidClassException: com.gepower.gees.tops.data.JobCtxtMgr; local class incompatible: stream classdesc serialVersionUID = 7011266017804180214, local class serialVersionUID = 1299119170608910687
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at com.gepower.gees.tops.model.TopsFileManager.getValue(TopsFileManager.java:159)
at com.gepower.gees.tops.control.PlanJobAssocCtrl.process(PlanJobAssocCtrl.java:181)
at com.gepower.gees.tops.control.LeafCommand.perform(LeafCommand.java:93)
at com.ge.dialect.cb.DefaultController.processInteraction(DefaultController.java:790)
at com.ge.dialect.cb.DefaultController.handleInteraction(DefaultController.java:607)
at com.ge.dialect.cb.DefaultController.service(DefaultController.java:490)
at com.ge.casper.servlet.CasperServlet.service(CasperServlet.java:231)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:309)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
22 Apr 2005 14:27:12,445 ERROR [service-j2ee] control.ProcessJobCtrl - com.gepower.gees.tops.data.JobCtxtMgr; local class incompatible: stream classdesc serialVersionUID = 7011266017804180214, local class serialVersionUID = 1299119170608910687
Thanks in advanceHello
I am using Netbeans5.5, JBoss 4.0.4 with hibernate3. I have a simple Entity bean (UserProfile), which i mapped from the database table.
In the session bean, i am using EntityManager to find my Entity bean i.e. UserProfile. But i am getting the following exception:
java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
java.io.InvalidClassException: org.hibernate.collection.PersistentBag; local class incompatible: stream classdesc serialVersionUID = -992182677146982163, local class serialVersionUID = 2819117614876030537
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:133)
at $Proxy1.findUser(Unknown Source)
at anapro.Main.main(Main.java:34)
Caused by: java.io.InvalidClassException: org.hibernate.collection.PersistentBag; local class incompatible: stream classdesc serialVersionUID = -992182677146982163, local class serialVersionUID = 2819117614876030537
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
... 14 moreSince netbeans creates an EJB module and a client module, I have added hibernate-entitymanager.jar to the class path of both the client and ejb module but this exception exists. can anyone please help me in this?
thanks -
Local class incompatible: different serialVersionUID
Hi!
I wrote an Object of type X to a file (in the server) and am sending the file to a client. This is done using:
FileOutputStream fo = new FileOutputStream (filename);
ObjectOutputStream so = new ObjectOutputStream (fo);
so.writeObject(x); //x is of Object type X
so.flush();
so.close();
fo.close();
The file 'filename' is sent to the client and I read it as follows:
FileInputStream in = new FileInputStream(filename);
ObjectInputStream s = new ObjectInputStream(in);
xobject = (X) x.readObject(); //xobject is of Object type X
This is throwing an error as follows:
java.util.Vector; local class incompatible:stream classdesc serialVersionUID = -2804478835259887871, local class serialVersionUID = -2767605614048989439
Can anyone tell me what to do to be able to type cast the object and use it? I did go thro' some @serial documentation, but, couldn't understand it.
Please help,
Thanks,
x86...or, alternatively, maintain the X class in one package, the one where your server-side classes are compiled, say, and import it into the second, client side source code, which presumably lives in a separate package or this problem probably wouldn't have come up. The goal is never to have more than one copy of the compiled class file.
You may have to modify your classpath.
Hi!
I wrote an Object of type X to a file (in theserver)
and am sending the file to a client. This is done
using:
<snip>
>
This is throwing an error as follows:
java.util.Vector; local class incompatible:stream
classdesc serialVersionUID = -2804478835259887871,
local class serialVersionUID = -2767605614048989439Hi
try using one copy of the compiled class for the
server
and the client, I had this happen many times until I
figured out
the server compiled its version of the serialiable
class and the client compiled its version of the
serialiable class,
then got class incompatable exceptions..among others
easy way around this is to compile the code of botht
he client and server, then copy the class code across
to the client side
Boris -
Oracle.jbo.domain.Number; local class incompatible
Hi Forum,
Development Tool : Jdeveloper 9.0.4 (part of Oracle 10g Suite)
Target Application Summary:
A simple application which displays the content of a database table and allows it to be modified both through a web interface as well as a Swing standalone client.
A Workspace having three projects:
1) A Business layer defined by using BC4J(Business Components For Java) provided with Jdeveloper 10g.
2) A Swing/JClient application for BC4J which accesses the BCJ4 layer using a Business component client data model.
3)A JSP application using JSP for business components which accesses the BC4j layer
Target Deployment:
1) Light-weight swing interface at machine 1
2) Business components and JSP part in an application server on Machine 2
3) Oracle DB on Machine3
Problem Statement
We deployed the BC4J Middle tier on OC4J standalone as a session bean. Then the client jar was deployed as a remote application(using Swing/JClient for business componments), the following error comes:
(oracle.jbo.PiggybackException) JBO-28300: Piggyback read error
----- LEVEL 1: DETAIL 0 -----
(java.io.InvalidClassException) oracle.jbo.domain.Number; local class incompatible: stream classdesc serialVersionUID = -6507359405709672486, local class serialVersionUID = -592084144037230518
Can the forum help me with the problem (i am using the library BC4JOracleDomains which has oracle.jbo.domain.Number class)
Thanking you in advance.Firstly, good job on describing your problem/situation. Some people just don't bother to be verbose.
Secondly, I have to note that I don't do any development in this way so I have no 1st hand experience with this excpetion. But, it appears as though you are using different versions of the jar files (which in turn contain different versions of the classes). Maybe you should take a look at that? -
Help!: local class incompatible exception
Hi!, im new in the ejb tech, I'm using jboss 3.2.3, windows 2000, j2ee 1.4 and jdk 1.4.1.
I already deploy the ejb in the app server, but at the Context.lookup statement from the client i get a local class incompatible exception!!, could anyone help me with this??? the client and the ejb are running in different machines, but the classes are the same ( I map the network drive and put it in my classpath to ensure im using the same classes with the same serial uid).
Thanks a lot!!!
The complete Stack trace is
javax.naming.CommunicationException. Root exception is java.io.InvalidClassException: org.jboss.proxy.ejb.GenericEJBInterceptor; local class incompatible: stream classdesc serialVersionUID = 3844706474734439975, local class serialVersionUID = 4582256576523491346
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:459)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:104)Sorry, i already found the problem!!! . I was running the client within the forte 4 ee ide, and it seems that forte assigns the objects their own serial uid. When I execute the client from a terminal, it executes ok =)
-
Oracle.jdbc.pool.OracleDataSource; local class incompatible
I want to place a DataSource in a InitialContext with the following code
public void getEnvironment() throws Exception{ try{ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); /*System.setProperty(Context.PROVIDER_URL, "t3://127.0.0.1:7001"); System.setProperty(Context.SECURITY_PRINCIPAL, "weblogic"); System.setProperty(Context.SECURITY_CREDENTIALS, "password");*/ InitialContext ic = new InitialContext(); ic.createSubcontext("java:"); ic.createSubcontext("java:/comp"); ic.createSubcontext("java:/comp/env"); ic.createSubcontext("java:/comp/env/jdbc"); // Construcvt Datasource OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource(); ds.setURL("jdbc:oracle:thin:@cdcehr29:14985"); ds.setUser("user"); ds.setPassword("pwd"); //Connection conn = ds.getConnection(); ic.bind("java:/comp/env/jdbc/test", ds); System.out.println("see?"); Context envIc = (Context) ic.lookup("java:/comp/env"); envIc.bind("THIS_SERVICE_CD", ""); envIc.bind("THIS_SERVICE_VER", ""); envIc.bind("SERVICE_DATA_SOURCE_JNDI", "jdbc/test"); envIc.bind("ALS_PROJECT_CD", ""); envIc.bind("ALS_SYSTEM_CD", ""); envIc.bind("EHR_CONFIG_DATA_SOURCE_JNDI", ""); envIc.bind("SGR_PATH", ""); envIc.bind("AUDIT_TABLE_NAME", ""); envIc.bind("DEBUG_TABLE_NAME", ""); }catch(NamingException ex){ ex.printStackTrace(); }catch(Exception ex){ ex.printStackTrace(); } }
but the following error is shown (but not catch in catch block, very strange)
>
<Jun 26, 2012 6:17:02 PM CST> <Error> <RJVM> <BEA-000503> <Incoming message header or abbreviation processing failed
java.io.InvalidClassException: oracle.jdbc.pool.OracleDataSource; local class incompatible: stream classdesc serialVersionUID = 8680830911645568991, local class serialVersionUID = 3349652938965166731
java.io.InvalidClassException: oracle.jdbc.pool.OracleDataSource; local class incompatible: stream classdesc serialVersionUID = 8680830911645568991, local class serialVersionUID = 3349652938965166731
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1316)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
Truncated. see log file for complete stacktrace
>
what is the problem come from?>
but the following error is shown (but not catch in catch block, very strange)
>
<Jun 26, 2012 6:17:02 PM CST> <Error> <RJVM> <BEA-000503> <Incoming message header or abbreviation processing failed
java.io.InvalidClassException: oracle.jdbc.pool.OracleDataSource; local class incompatible: stream classdesc serialVersionUID = 8680830911645568991, local class serialVersionUID = 3349652938965166731
java.io.InvalidClassException: oracle.jdbc.pool.OracleDataSource; local class incompatible: stream classdesc serialVersionUID = 8680830911645568991, local class serialVersionUID = 3349652938965166731
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1316)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
Truncated. see log file for complete stacktrace
what is the problem come from?
>
You didn't post the part of the stacktrace that shows the line number that the problem occured on. (Truncated. see log file for complete stacktrace)
Are you sure the problem occured in the code you posted? If so did this line execute and print on the console?
System.out.println("see?");That error can occur when the code used to deserialize an object uses a different version of the class than the version it was serialized with. The code you posted doesn't shown anything that appears to do any deserialization.
Have their been any changes to the environment lately? Upgrades to Java version, WebLogic or the JDBC driver? -
Java.io.InvalidClassException:local class incompatible?
hello everyone:
I deploy a J2EE application called A in a weblogic domain called A, it can run correctly;
then I deploy another J2EE application called B, which is a new edition of A, in another weblogic domain called B, it can also run correctly;
The two domains use the same server. I don't know whether this will cause problems like this.
But the previous A can't run correctly and throw exceptions as follows in Java Console:
java.io.InvalidClassException: com.longzhou.oa.docnet.dto.abstractdto.DnBaseRole; local class incompatible: stream classdesc serialVersionUID = 1264764439065723117, local class serialVersionUID = -6834466395328850197
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at com.longzhou.oa.applet.util.EjbLocator.getInputStream(EjbLocator.java:18)
at com.longzhou.oa.applet.DnIO.getDnAllByID(DnIO.java:63)
at com.longzhou.oa.applet.DnIO.loadGraph(DnIO.java:33)
at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:185)
at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
at org.enhydra.jawe.JaWE.init(JaWE.java:195)
at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at com.longzhou.oa.applet.DnIO.getDnFromDto(DnIO.java:731)
at com.longzhou.oa.applet.DnIO.loadGraph(DnIO.java:34)
at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:185)
at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
at org.enhydra.jawe.JaWE.init(JaWE.java:195)
at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Object
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at com.longzhou.oa.applet.util.EjbLocator.getInputStream(EjbLocator.java:18)
at com.longzhou.oa.applet.InitModel.initEmpGroupList(InitModel.java:353)
at org.enhydra.jawe.DnDefine._$1(Unknown Source:241)
at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:186)
at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
at org.enhydra.jawe.JaWE.init(JaWE.java:195)
at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.NotSerializableException: java.lang.Object
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at com.longzhou.oa.util.EgovServlet.service(EgovServlet.java:332)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
at java.lang.Thread.startThreadFromVM(Unknown Source)
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Object
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at com.longzhou.oa.applet.util.EjbLocator.getInputStream(EjbLocator.java:18)
at com.longzhou.oa.applet.InitModel.initSysRoleList(InitModel.java:371)
at org.enhydra.jawe.DnDefine._$1(Unknown Source:242)
at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:186)
at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
at org.enhydra.jawe.JaWE.init(JaWE.java:195)
at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.NotSerializableException: java.lang.Object
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at com.longzhou.oa.util.EgovServlet.service(EgovServlet.java:332)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
at java.lang.Thread.startThreadFromVM(Unknown Source)
Can anyone tell me the reason? Thanks"local class incompatible" error is due to the retrieving of serialized object, which might be dumping from memory to somewhere like database, file etc., that is of different edition of the class. Maybe an object A of AClass was stored in a database and lately the AClass changed to a new edition, let's call it A'Class, and they have something different, especially the serialVersionUID field. When the object A is retrieved from the database, which should be compatible with A'Class (be ware of that A'Class and AClass has the same name but of different edition), unfortunately, they don't, the error mentioned above occurs.
So, I guess that although the app A and B uses different domain, if they uses the same database to store and retrieve something (here may refers to objects) of different edition and are run one after another, the compatible issues are going to occur.
Separating app A from B as much as possible is not a good solution, but you could have a try.
Hoping helpful, good luck! -
InvalidClassException: JComponent; local class incompatible - JVM Version?
Iam having trouble deserializing some old objects.
My object header is
public class SoundMatrix extends AbstractTableModel implements Serializable
So i happend to save some swing components :(
Now i got the problem of deserializing them again. What can i do to recover the data?
The serialVersionUID is the same, none has changed.
java.io.InvalidClassException: javax.swing.JComponent; local class incompatible: stream classdesc serialVersionUID = -2514362798440941654, local class serialVersionUID = -1030230214076481435
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at javax.swing.event.EventListenerList.readObject(EventListenerList.java:255)
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 java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at dk.tigermedia.Prog.main(Prog.java:119)
I guess its a JVM Versioning problem, the version may have changed over time, the application have been used.
I know the problem is, that i have serialized Swing objects- the docs even warn against this. Great :)
Can i see which version was used to make the files? Can take control over the deserializing process?
Tryed overwriting the readObject - but it dont seem to get that far.
Any help is much appreciated. Thanks.Update versions don't matter, just 1.3, 1.4, 1.5 etc.
You don't need to recompile except backwards, e.g. if you're using JDK 1.3 you need binaries produced by 1.3 or with -target 1.3. But I'd advocate writing a new mini application for this conversion task, using 1.3 or whatever the JDK version actually was when the data was serialized.
You also need to inform management about this debacle and the reasons for it. The warnings about serialization-incompatibility of Swing classes have been right there in the Javadoc since the beginning. No competent IT professional should have perpetrated this act. Make sure it doesn't happen again. -
InvalidClassException ImageIcon.$AccessibleImageIcon class incompatible
Greetings,
I cannot seem to find a solution for this problem, so I am turning to you - your help is greatly appreciated.
Below is a snippet of some legacy code that has been deployed in an app running JRE 1.4.2.
class NodeImage implements Serializable {
final static long serialVersionUID = 2606889903904458364L;
public Dimension dim;
public transient Image img;
public ImageIcon ii; //VERY PROBLEMATIC NOW!!!!
public String name;
public String description;
}Now, with the application having been modified and upgraded to run on JRE 1.5.0, old serialized objects can no longer be read into the above class, because the ImageIcon.$AccessibleImageIcon serialVersionUID has changed. The exception being thrown is as follows:
java.io.InvalidClassException: javax.swing.ImageIcon$AccessibleImageIcon;
local class incompatible: stream classdesc serialVersionUID = -3994512798706967451,
local class serialVersionUID = -1903458698681874148
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:468)
at javax.swing.ImageIcon.readObject(ImageIcon.java:389)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...The object has no explicit readObject or writeObject methods.
I have tried a variety of things - e.g. writing a new readObject method, and using java.io.ObjectInputStream.GetField fields = in.readFields(); but I cannot seem to find a way to read the offending field without the exception being thrown and the rest of the read process aborted.
Is there ANY way around this?
I don't care if the end result makes the ImageIcon ii field null. But because this is just one object in a serialized hierarchy, I just want to be able to get the dim, name, and description attributes and then continue loading the remainder of the object hierarchy.
Thanks in advance for your help! Any insight would be great.
.Your developers should have read the warning in the javadoc for javax.swing.ImageIcon before serializing ImageIcons across JDK versions.
You may have to use JDK 1.4 to read these streams and write them out again using something other than classes with this warning when they occur.
The only other thing I can suggest is a custom readObject method which doesn't call defaultReadObject() and instead picks apart the serialization protocol itself for the offending class(es), calling readObject() for all non-offending members. -
Hi,
Can you any one help me to resolve this exception below. The conext is I
have successfully deplyed a bean and when i call the bean remot method I am
getting the following exception.
Can you any one help me in what situations we will get this type of
exception. I am using jdk1.3
Thanks
Kumar
*************** EXCEPTIN IS BELOW *****************************
PayDateRespondRequestBean lookup successful
creating session bean instance
Calling operation operation
java.io.InvalidClassException: javax.ejb.EJBException; Local class not
compatible: stream classdesc serialVersionUID=-9219910240172116449 local
class serialVers
ionUID=796770993296843510
at
java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:523)
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:936)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:29)
at
java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1212)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:66)
at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:38)
at
weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.j
ava:175)
at
weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.j
ava:154)
at
weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:582)
at
weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:454)
at
weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java:311)
at
weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:225)
at
weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Exception
creating response stream ] - with nested exception:
[java.io.InvalidClassException: javax.ejb.EJBException; Local class not
compatible: stream classdesc serialVersionUID=-9219910240172116449 local
class serialVersionUID=796770993296843510]
at
weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.j
ava:184)
at
weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.j
ava:154)
at
weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:582)
at
weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:454)
at
weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java:311)
at
weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:225)
at
weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Error accessing PayDateRespondRequest bean
weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: ***** ASSERTION FAILED
****[ Exception
creating response stream ] - with nested exception:
[weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Exception
creating
response stream ] - with nested exception:Yes, this solved my problem. I was having two versions of javax.ejb package.
--Sajith
"Nils Winkler" <[email protected]> wrote in message
news:[email protected]...
Hi,
it looks like you have two different versions of the same class in the
classpath. Your client is expecting version A, but the server is
returning an instance of version B. Make sure that you only have one
version of the class in your classpath. If you're starting the client as
a separate app, also make sure that it's using the same classes as the
server.
Hope that helps,
Nils
Sajith wrote:
Hi,
Can you any one help me to resolve this exception below. The conext is I
have successfully deplyed a bean and when i call the bean remot method I
am
getting the following exception.
Can you any one help me in what situations we will get this type of
exception. I am using jdk1.3
Thanks
Kumar
*************** EXCEPTIN IS BELOW *****************************
PayDateRespondRequestBean lookup successful
creating session bean instance
Calling operation operation
java.io.InvalidClassException: javax.ejb.EJBException; Local class not
compatible: stream classdesc serialVersionUID=-9219910240172116449 local
class serialVers
ionUID=796770993296843510
at
java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:523)
atjava.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:936)
atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:29)
at
java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1212)
atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:66)
at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:38)
at
weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.j
ava:175)
at
weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.j
ava:154)
at
weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:582)
at
weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:454)
at
weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java:311)
at
weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:225)
at
weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Exception
creating response stream ] - with nested exception:
[java.io.InvalidClassException: javax.ejb.EJBException; Local class not
compatible: stream classdesc serialVersionUID=-9219910240172116449 local
class serialVersionUID=796770993296843510]
at
weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.j
ava:184)
at
weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.j
ava:154)
at
weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:582)
at
weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:454)
at
weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java:311)
at
weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:225)
at
weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Error accessing PayDateRespondRequest bean
weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: ***** ASSERTION FAILED
****[ Exception
creating response stream ] - with nested exception:
[weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Exception
creating
response stream ] - with nested exception:--
============================
[email protected] -
Is there a way to create a structure or a local class inside of another?
In VB you can create a private type I believe in C++ it's called a struct I was wondering is there a way with Java to create a local class or structure to store variables in a group inside of another class. I'd rather have them in an structure for readability.
you can do something like this.
public class MyStruct {
public String name;
public int number;
public double value;
public class Test {
private MyStruct struct = new MyStruct();
private void setValue() {
struct.name = "my name";
struct.number = 1;
struct.value = 20.0;
public void setStruct(MyStruct newStruct)
struct = newStruct;
}; -
Getting cl_abap_structdescr for method parameters of LOCAL classes?
Hi guys
I have a bit of a of a problem with getting an instance of the cl_abap_structdescr class for a method parameter type of a local class. The RTTI structure abap_parmdescr can only be used to diffrentiate between the basic built-in ABAP types and whether types are structures, tables or references. The question now arrives that once you have diffentiated that the parameter is a structure how do you determine the actual structure TYPE name for local classes to create an instance of the cl_abap_structdescr to continue your run-time analysis. For dictionary classes the parameter type name can be retrieved from the seosubcodf table, to me it looks as if one would have to resort to scanning the source code of local classes to arrive at the actual structure type name, but before I go to THAT kind of trouble I was wondering whether somebody out there might have a better solution for me. Your help would be grreatly appreciated and rewarded ;).
Kind regards
Ettienne HugoHello Uwe
Thanks for your reply, I checked out the CL_OO_LOCAL_CLASSES class, unfortunately the class actually operates on the local classes declared for a dictionary class. I think to clarify my question I should point out that the parameters I'm trying to process are parameters that belong to classes that are defined and implemented using include programs, these include programs would then typically be used in Function Groups to construct applications so the classes that I refer to are actually not in any way related to dictionary classes. The cl_abap_classdescr class works fine on these types of classes when you refer to them using the "\PROGRAM=my_program\CLASS=my_class" format with the describe_by_name method, unfortunately the class just does not provide sufficient information for structure type parameters to actually construct them during run-time...
Stay well
Ettienne -
Problem with local class, static private attribute and public method
Hello SDN,
Consider the following situation:
1) I have defined a LOCAL class airplane.
2) This class has a private static attribute "type table of ref to" airplane (array of airplanes)
3) A public method should return the private static table attribute
Problems:
a) The table cannot be given as an EXPORTING parameter in the method because TYPE TABLE OF... is not supported and I get syntax errors. I also cannot define a dictionary table type because it is a local class.
b) The table cannot be given as a TABLES parameter in the method because TABLES is not supported in the OO context.
c) The table cannot be given as an EXPORTING parameter in the method defined as LIKE myStaticAttribute because my method is PUBLIC and my attribute is PRIVATE. ABAP syntax requires that all PUBLIC statements are defined before PRIVATE ones, therefore it cannot find the attribute to reference to with LIKE.
I see only 2 solutions:
a) Never ever use local classes and always use global classes so that I might define a dictionary table type of my class which I can then use in my class.
b) Make the attribute public, but this goes against OO principles, and isn't really an option.
Am I missing anything here, or is this simply overlooked so far?Hello Niels
Since your class is local and, thus, only know to the "surrounding" application is does not really make sense to make it public to any other application.
However, if you require to store instances of your local classes in internal tables simply use the most generic reference type possible, i.e. <b>OBJECT</b>.
The following sample report shows how to do that. Furthermore, I believe it also shows that there are <u><b>no </b></u>serious inconsistency in the ABAP language.
*& Report ZUS_SDN_LOCAL_CLASS
REPORT zus_sdn_local_class.
" NOTE: SWF_UTL_OBJECT_TAB is a table type having reference type OBJECT
* CLASS lcl_airplane DEFINITION
CLASS lcl_airplane DEFINITION.
PUBLIC SECTION.
DATA: md_counter(3) TYPE n.
METHODS: constructor,
get_instances
RETURNING
value(rt_instances) TYPE swf_utl_object_tab.
PRIVATE SECTION.
CLASS-DATA: mt_instances TYPE swf_utl_object_tab.
ENDCLASS. "lcl_airplane DEFINITION
* CLASS lcl_airplane IMPLEMENTATION
CLASS lcl_airplane IMPLEMENTATION.
METHOD constructor.
APPEND me TO mt_instances.
DESCRIBE TABLE mt_instances.
md_counter = syst-tfill.
ENDMETHOD. "constructor
METHOD get_instances.
rt_instances = mt_instances.
ENDMETHOD. "get_instance
ENDCLASS. "lcl_airplane IMPLEMENTATION
DATA:
gt_instances TYPE swf_utl_object_tab,
go_object TYPE REF TO object,
go_airplane TYPE REF TO lcl_airplane.
START-OF-SELECTION.
" Create a few airplane instance
DO 5 TIMES.
CREATE OBJECT go_airplane.
ENDDO.
gt_instances = go_airplane->get_instances( ).
CLEAR: go_airplane.
LOOP AT gt_instances INTO go_object.
go_airplane ?= go_object.
WRITE: / 'Airplane =', go_airplane->md_counter.
ENDLOOP.
END-OF-SELECTION.
Regards
Uwe<u></u> -
Get a reference of a local class at another program
Hello experts! Sorry if this has been asked before, but I couldn't find exactly what I'm searching for.
Within function-pool MIGO (main program of transaction MIGO), there's a local class LCL_MIGO_KERNEL. This class has the private attribute PT_CHANGE_TAKEIT (which is an internal table).
During the execution of MIGO, for a certain criteria, I would like to clear the contents of PT_CHANGE_TAKEIT. Since it's a private attibute, I have managed to create a new public method that just clears it. This method was defined and inplemented within ENHANCEMENT SPOTS available all over SAPLMIGO. My method is ZZ_CLEAR_PT_CHANGE_TAKEIT. So far so good.
Now, I have to call this method. I have found no other ENHANCEMENT SPOTS in SAPLMIGO at a place where I would me able to make the call (eg, don't know if the criteria fits yet).
Inside BADI MB_MIGO_BADI, method LINE_MODIFY, I have just what I need to know if I should clear PT_CHANGE_TAKEIT.
However, inside here I don't have access to the instance of class LCL_MIGO_KERNEL (the instance itself is (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL)
So far I have managed to get a pointer to the instance with:
FIELD-SYMBOLS: <lfs_kernel> TYPE ANY.
ASSIGN ('(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL')
TO <lfs_kernel>.
So I have the instance of the class, but how can I call my method ZZ_CLEAR_PT_CHANGE_TAKEIT?
The command call method <lfs_kernel>->zz_clear_pt_change_takeit.
can't be done because ""<LFS_KERNEL>" is not a reference variable" as the sintax check tells me.
I have tried stuff like
CREATE DATA dref TYPE REF TO
('\FUNCTION-POOL=MIGO\CLASS=LCL_MIGO_KERNEL').
ASSIGN dref->* TO <ref>.
but nothing works so far.
I know if LCL_MIGO_KERNEL was a class from SE24 (not a local one), I could just create a field-symbol of that type instead of type ANY and it would work.
Does anyone have an idea how that can be done?
Thank you very much!I have managed to do what I needed by calling my method from other ENHANCEMENT SPOTS within SAPLMIGO and some extra coding on MB_MIGO_BADI, but unfortunately I couldn't do what I originaly wanted which was to call a method of a local class from another program, something that could be handy in other situations.
If it's not lack of knowledge by myself and it really can't be done, I think the ABAP OO framework fell just short of having that flexibility, since I can get the field-symbol to point to the instance of the class, but just can't call the method because of syntax issues.
Thanks!
Well it seems you already solved, but I got curious and knew how this could be done, so I wanted to prove it and here it is:
* This would be inside the Function group
CLASS lcl_kernel DEFINITION.
PUBLIC SECTION.
METHODS:
zz_clear_pt_change_takeit.
ENDCLASS. "lcl_kernel DEFINITION
CLASS lcl_kernel IMPLEMENTATION.
METHOD zz_clear_pt_change_takeit.
WRITE 'Dummy! I do nothing!'.
ENDMETHOD. "zz_clear_pt_change_takeit
ENDCLASS. "lcl_kernel IMPLEMENTATION
START-OF-SELECTION.
* This is just to create the reference. It corresponds to
* (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL in your example
DATA: kernel TYPE REF TO lcl_kernel.
CREATE OBJECT kernel.
*----------------- Now your program (which supposedly does not have
*----------------- access to kernel or even lcl_kernel def)
*----------------- would begin
FIELD-SYMBOLS: <lfs_kernel> TYPE ANY.
DATA: generic_ref TYPE REF TO object.
ASSIGN ('KERNEL')
TO <lfs_kernel>.
generic_ref = <lfs_kernel>.
TRY.
CALL METHOD generic_ref->('ZZ_CLEAR_PT_CHANGE_TAKEIT').
CATCH cx_sy_dyn_call_illegal_method .
ENDTRY.
Apart from that, I wouldn't access a local class this way. There's a reason for blocking the access, one of them being that SAP could change local classes without notice thus breaking your program.
Maybe you are looking for
-
Need help with PS CS5 crashing while openinng specific document!
Good morning all, I am the network admin at my company, and i have a user expereicneing a strange issue. I do not know much about PS, other than how to install it, so i am at a loss to troublshoot this issue. Any help would be greatly appreciated.
-
Window randomly becomes inactive
My macbook air occasionally gets in the mode where the current window randomly becomes inactive while typing. What causes this and how do i fix it?
-
BAPI_MATERIAL_SAVEDATA doesn't save sales data of material
Hi, The problem is that function module BAPI_MATERIAL_SAVEDATA doesn't create or change sales data of material (table MVKE). It doesn't return an error message either. However, it creates successfully some other data (like MARA table data). I use BAP
-
How configure password sync connector in OIM cluster environmet
Hi, i want some inputs to configure password sync connector in OIM cluster environmet. Thanks,
-
How i can send an email with attachement of any type format file in form10
I developed an application in forms 10g my application send an email via outlook but i want to attach any type of PDF or WORD document how i can attach the file and send this email via outlook if any one know please share your valuable experience wit