RxThreadFactory doesn't implement interface concurrent - java

When calling
Observable.interval(10, TimeUnit.MILLISECONDS)
in my target environment (works great on standard JVM) I'm getting:
java.lang.IncompatibleClassChangeError: Class
rx.internal.util.RxThreadFactory does not implement the requested
interface java.util.concurrent.ThreadFactory at
java.util.concurrent.ThreadPoolExecutor$Worker.(ThreadPoolExecutor.java:610)
at
java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:924)
at
java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1590)
at
java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:333)
at
java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:594)
at
rx.schedulers.CachedThreadScheduler$CachedWorkerPool.(CachedThreadScheduler.java:62)
at
rx.schedulers.CachedThreadScheduler.start(CachedThreadScheduler.java:150)
at
rx.schedulers.CachedThreadScheduler.(CachedThreadScheduler.java:145)
at rx.schedulers.Schedulers.(Schedulers.java:48) at
rx.schedulers.Schedulers.(Schedulers.java:34) at
rx.Observable.interval(Observable.java:1293)
What does it mean? What can I do about it?
P.S.: I'm using proguard on final jar. Could it be the reason?

From looking at your error in the Java API it's a JVM runtime check thingy that checks if the classes dependable on the current executing method have been changed since last executed.
Just try stopping all processes executing (shut everything down). Save, clear cache and recompile everything and then try running it again so everything is on the same page.

Related

How stop execution of the staging process in KIT DataManager?

I would like to know how to stop the Processor in Staging phase (e.g. this processor in member performPreTransferProcessing).
Repo on GitHub: https://github.com/kit-data-manager/base
Not sure how to find out what should be changed to go on with the next Processor (if any).
I imagine something like Context.status = CONSTANTS.stopped but lack to find the context.
The question was answered by the main contributor of the project … I will answer a bit more excessive still.
performPreTransferProcessing(TransferTaskContainer pContainer) throws StagingProcessorException;
// signature for AbstractStagingProcessor
The exception StagingProcessorException is located in package
import edu.kit.dama.staging.exceptions.StagingProcessorException;
and can be raised e.g. simply with a message
throw new StagingProcessorException("this ends the processor and renders it unsuccessful");
and of course this should only be raised conditionally, e.g. from one of the two pre-processing members.
But:
data still is first uploaded before the Processor runs
there is no cleanup swiping it from cache

Using Inline::Java in perl with threads

I am writing a trading program in perl with the newest Finance::InteractiveBrokers::TWS
module. I kick off a command line interface in a separate thread at the
beginning of my program but then when I try to create a tws object, my program
exits with this message:
As of Inline v0.30, use of the Inline::Config module is no longer supported or
allowed. If Inline::Config exists on your system, it can be removed. See the
Inline documentation for information on how to configure Inline. (You should
find it much more straightforward than Inline::Config :-)
I have the newest versions of Inline and Inline::Java. I looked at TWS.pm and it doesn't seem to be using Inline::Config. I set 'SHARED_JVM => 1' in the 'use Inline()' and 'Inline->bind()' calls in TWS.pm but that did not resolve the issue...
My Code:
use Finance::InteractiveBrokers::TWS;
use threads;
use threads::shared;
our $callback;
our $tws;
my $interface = UserInterface->new();
share($interface);
my $t = threads->create(sub{$interface->runUI()});
$callback= TWScallback->new();
$tws = Finance::InteractiveBrokers::TWS->new($manager); #This is where the program fails
So is Inline::Config installed on your system or not? A cursory inspection of the code is not sufficient to tell whether Perl is loading a module or not. There are too many esoteric ways (some intentional and some otherwise) to load a package or otherwise populate a namespace.
The error message in question comes from this line of code in Inline.pm:
croak M14_usage_Config() if %main::Inline::Config::;
so something in your program is populating the Inline::Config namespace. You should do what the program instructs you to do: find out where Inline/Config.pm is installed on your system (somewhere in your #INC path) and delete it.

interface exception

i have these codes
UserAgentContext uAgent=new SimpleUserAgentContext();
DocumentBuilderImpl docBuild=new DocumentBuilderImpl(uAgent);
docBuild.parse(new InputSourceImpl("http://dic.amdz.com/"));
when i run , it gives me the following error:
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface sun.font.FontManager, but class was expected
at org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:210)
at org.lobobrowser.util.gui.FontFactory.createFont_Impl(FontFactory.java:180)
at org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:127)
at org.lobobrowser.util.gui.FontFactory.getFont(FontFactory.java:98)
at org.lobobrowser.html.style.StyleSheetRenderState.<clinit>(StyleSheetRenderState.java:43)
at org.lobobrowser.html.domimpl.NodeImpl.<clinit>(NodeImpl.java:39)
at org.lobobrowser.html.parser.DocumentBuilderImpl.createDocument(DocumentBuilderImpl.java:143)
at org.lobobrowser.html.parser.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:97)
at cobratest2.Cobratest2.main(Cobratest2.java:21)
then pointing me to the last line. so the question is, what to do?
The problem is at
org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:210)
That class was compiled against an old version of the libraries in whichsun.font.FontManager was a class, but you are trying to run it with newer libraries in which it is now an interface. You will probably have to recompile all of the org.lobobrowser package against current libraries.
And BTW, the link What causes java.lang.IncompatibleClassChangeError? mentioned by e-zinc does contain all the information you need to have figured this out yourself.

When creating a custom Toolkit, why does createFrame fail on OSX?

We are trying to extend the UISpec4j testing framework to display the user interface when running tests. So we have a custom toolkit that wraps around the native toolkit for the relevant platform. We managed to get everything working well on windows XP, however when testing our changes on OSX, our extension of createFrame appears to behave oddly:
public FramePeer createFrame(Frame target) {
FramePeer resultc = new UISpecFramePeer(target);
//super.createFrame(target);
return resultc;
}
Essentially with the above, we want to create a UISpecFramePeer as an interception class... So that UISpec4j can interrogate what is happening within the UI. But in our changes, we also want to display the UI. So we attempt this by creating a frame using the native toolkit and wrapping it in the UISpecFramePeer (not shown in the code above).
When we run the above code, the tests run (as we expect) but obviously nothing is displayed. However, when we include super.createFrame(target). We get the following exception:
SEVERE: Application class org.openshapa.OpenSHAPA failed to launch
java.lang.ClassCastException: org.uispec4j.interception.toolkit.UISpecFramePeer
at apple.awt.CWindow$8.convertJComponentToTarget(CWindow.java:236)
at apple.awt.CWindow$8.convertJComponentToTarget(CWindow.java:233)
at apple.awt.ClientPropertyApplicator.attachAndApplyClientProperties(ClientPropertyApplicator.java:24)
at apple.awt.CWindow$1.propertyChange(CWindow.java:190)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:341)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
at java.awt.Component.firePropertyChange(Component.java:7277)
at javax.swing.JComponent.addNotify(JComponent.java:4479)
at javax.swing.JRootPane.addNotify(JRootPane.java:680)
at java.awt.Container.addNotify(Container.java:2544)
at java.awt.Window.addNotify(Window.java:467)
at java.awt.Frame.addNotify(Frame.java:501)
at java.awt.Window.pack(Window.java:485)
at org.jdesktop.application.SingleFrameApplication.initRootPaneContainer(SingleFrameApplication.java:216)
at org.jdesktop.application.SingleFrameApplication.show(SingleFrameApplication.java:463)
at org.openshapa.OpenSHAPA.startup(OpenSHAPA.java:444)
at org.jdesktop.application.Application$1.run(Application.java:171)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-2" java.lang.Error: Application class org.openshapa.OpenSHAPA failed to launch
at org.jdesktop.application.Application$1.run(Application.java:177)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.ClassCastException: org.uispec4j.interception.toolkit.UISpecFramePeer
at apple.awt.CWindow$8.convertJComponentToTarget(CWindow.java:236)
at apple.awt.CWindow$8.convertJComponentToTarget(CWindow.java:233)
at apple.awt.ClientPropertyApplicator.attachAndApplyClientProperties(ClientPropertyApplicator.java:24)
at apple.awt.CWindow$1.propertyChange(CWindow.java:190)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:341)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
at java.awt.Component.firePropertyChange(Component.java:7277)
at javax.swing.JComponent.addNotify(JComponent.java:4479)
at javax.swing.JRootPane.addNotify(JRootPane.java:680)
at java.awt.Container.addNotify(Container.java:2544)
at java.awt.Window.addNotify(Window.java:467)
at java.awt.Frame.addNotify(Frame.java:501)
at java.awt.Window.pack(Window.java:485)
at org.jdesktop.application.SingleFrameApplication.initRootPaneContainer(SingleFrameApplication.java:216)
at org.jdesktop.application.SingleFrameApplication.show(SingleFrameApplication.java:463)
at org.openshapa.OpenSHAPA.startup(OpenSHAPA.java:444)
at org.jdesktop.application.Application$1.run(Application.java:171)
... 7 more
Why would simply using the native toolkit to create a frame (but not return it) create an exception, when it would otherwise behaves as normal when the super.createFrame is commented?
I havent worked on OSX, but the same problem would occur on Windows too and the reason would be this:
When you do super.createFrame(), you are essentially creating the native peer which ends up trying to show and hence addNotify methods are called. Now inside there are lot of methods that directly cast the peer to WFramePeer(this is incase of Windows, OSX it may be CWindowPeer or whatever), hence the ClassCastException. In your case, my guess is, the class CWindow is trying to cast your UISpecFramePeer to WFramePeer(or CFramePeer or whatever). Just check the CWindow code by decompiling and check. Please don't forget to post your findings.

Confusion over class resolution in Oracle java stored procedures

I'm trying to use a third-party java library within oracle. The library seems compatible with the same 1.4 version of the jvm that our Oracle 10g server hosts, since it runs fine outside of Oracle, so I feel like I should be able to get this to work. This library ends up making SOAP-based http requests, and I get class resolution errors when I run in Oracle.
Here's a line that shows the difference:
Class msgfact = Class.forName("com.sun.xml.messaging.saaj.soap.MessageFactoryImpl");
I tried to register these libraries into Oracle with the loadjava utility, and I got what I thought was a successful result:
C:\>loadjava -verbose -schema MYUSER -user MYUSER/MYPWD#dbinstance -force saaj-impl.jar
It looks like everything gets loaded, and I can see this MessageFactoryImpl class in that list. But then I try to run this line of code from Oracle SQL (inside another class I wrote and loaded with loadjava), this line throws a ClassNotFoundException (java.lang.ClassNotFoundException: com/sun/xml/messaging/saaj/soap/MessageFactoryImpl).
Then I went back and tried to add the "-resolve" switch at the loadjava command line. It acts like these saaj classes are getting registered, but they aren't resolving properly.
How can I successfully get these saaj classes into Oracle, or if for some reason Oracle already has these loaded, how can I convince my own code to successfully use the existing class?
FWIW, I already took the steps to make sure that the appropriate socket permissions were granted and my code can successfully make a generic http request to the target url. It just has trouble using the library's SOAP stack to make it happen.
EDIT:
Here is a sample of my loadjava result. This seems to be showing exactly what's failing, but I'm confused as to why these particular classes aren't being resolved when they seem to be handled properly in the pre-resolution steps. I've eliminated about 80% of the file here, but there are other classes that show the same class resolution issues.
arguments: '-verbose' '-schema' 'MYSCHEMA' '-user' 'MYSCHEMA/MYSCHEMA#actest' '-resolve' '-force' 'saaj-impl.jar'
[snip]
creating : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/EnvelopeFactory
loading : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/EnvelopeFactory
creating : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/GifDataContentHandler
loading : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/GifDataContentHandler
creating : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/JpegDataContentHandler
loading : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/JpegDataContentHandler
creating : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageFactoryImpl
loading : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageFactoryImpl
creating : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl
loading : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl
[snip]
resolving: class MYSCHEMA.com/sun/xml/messaging/saaj/soap/AttachmentPartImpl
resolving: class MYSCHEMA.com/sun/xml/messaging/saaj/soap/Envelope
resolving: class MYSCHEMA.com/sun/xml/messaging/saaj/soap/EnvelopeFactory
errors : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/EnvelopeFactory
ORA-29534: referenced object MYSCHEMA.com/sun/xml/messaging/saaj/soap/SOAPPartImpl could not be resolved
resolving: class MYSCHEMA.com/sun/xml/messaging/saaj/soap/GifDataContentHandler
resolving: class MYSCHEMA.com/sun/xml/messaging/saaj/soap/JpegDataContentHandler
resolving: class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageFactoryImpl
errors : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageFactoryImpl
ORA-29534: referenced object MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl could not be resolved
errors : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl
ORA-29534: referenced object MYSCHEMA.com/sun/xml/messaging/saaj/soap/impl/EnvelopeImpl could not be resolved
errors : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl$1
ORA-29534: referenced object MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl could not be resolved
skipping : class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl$2
[snip]
The following operations failed
class MYSCHEMA.com/sun/xml/messaging/saaj/soap/EnvelopeFactory: resolution
class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageFactoryImpl: resolution
class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl: resolution
class MYSCHEMA.com/sun/xml/messaging/saaj/soap/MessageImpl$1: resolution
[snip]
exiting : Failures occurred during processing
First of all, verify outside of Oracle that the class you are looking for is actually in that jar file. I expect it is, but it doesn't hurt to check.
Then, I would check what classes have been loaded and whether they have valid statuses.
SELECT object_name, dbms_java.longname(object_name), status
FROM user_objects
WHERE object_type='JAVA CLASS'
ORDER BY 1
You might want to limit this somewhat if there are a lot of classes, e.g.:
WHERE dbms_java.longname(object_name) LIKE '%MessageFactoryImpl'
If the class is not there, or it is there with the wrong package name, then the problem is with the loadjava command.
If the class is there but its status is INVALID, then check USER_ERRORS to see what the errors are. I don't recall if I've done dynamic class loading within Oracle, but I recall that static linking would give errors that implied a class didn't exist when it really existed but had errors.
New info after loadjava output posted
The loadjava output seems inconsistent with your attempt to find the class in the database. If it is being loaded but not resolved, it should still be listed, but with an INVALID status.
I got the JAR and tried it myself in an empty schema. The class loads but is invalid as expected:
dev> select object_name, dbms_java.longname(object_name),status
2 from user_objects
3 where object_name like '%MessageFactoryImpl';
OBJECT_NAME
--------------------------------------------------------------------------------
DBMS_JAVA.LONGNAME(OBJECT_NAME)
--------------------------------------------------------------------------------
STATUS
-------
/3e484eb0_MessageFactoryImpl
com/sun/xml/messaging/saaj/soap/MessageFactoryImpl
INVALID
I then checked what the error were on the class:
dev> alter java class "com/sun/xml/messaging/saaj/soap/MessageFactoryImpl" resolve;
dev> /
Warning: Java altered with compilation errors.
dev> show error
Errors for JAVA CLASS "/3e484eb0_MessageFactoryImpl":
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 ORA-29521: referenced name javax/xml/soap/MessageFactory could
not be found
0/0 ORA-29521: referenced name javax/xml/soap/SOAPMessage could not
be found
0/0 ORA-29521: referenced name javax/xml/soap/MimeHeaders could not
be found
0/0 ORA-29521: referenced name javax/xml/soap/SOAPException could not
be found
(These errors would also be listed in USER_ERRORS, assuming resolution was attempted at least once.)
So clearly this class references classes from the base SOAP library. You would have to load that too -- have you done that?
FYI, when I write some code to do the Class.forName() call, I do get the ClassNotFoundException. Which may seem counter-intuitive since the class object does exist in the schema. However, an invalid class doesn't really "exist" from the point of view of the class loader in Oracle; and in order for the class to be valid Oracle has to be able to resolve all of its references to other classes.
Is this the first time your executing Java on the database? Here is hello world implementation to make sure your Oracle JVM is running properly and you have the necessary permissions. You said "my database schema, so I can do whatever I want" -doesn't mean you have the proper grants.
SQL> create or replace and compile java source named "Hello" as
public class Hello{
public static String world() {
return "Hello World ";
}
};
/
Java created.
Now the wrapper function
SQL> create or replace function Hello RETURN VARCHAR2
as LANGUAGE JAVA NAME 'Hello.world() return String';
/
Function created.
Now test it
SQL> select Hello from dual;
HELLO
-----------------------------------
Hello World
Do this:
try
{
System.out.println("Class.forName returned: " +
Class.forName("com.sun.xml.messaging.saaj.soap.MessageFactoryImpl"));
}
catch(final Throwable ex)
{
ex.printStackTrace();
System.exit(1);
}
Just to be 100and10% sure that it is not throwing an exception that is somehow being hidden and that it is really returning null. If it is still the case please let me know (interesting problem if the code above works, but returns null).
Try # 3 :-) (I don't use Oracle... but this is a neat problem to debug...)
Does the info here on Class.forName in Oracle help?
http://download.oracle.com/docs/cd/B14117_01/java.101/b12021/appover.htm#i1006547
This presents as a ClassLoader issue, so hoepfully the solution is along the same lines as what happens in the "real, non-Oracle" world :-)
Edit... another try...
Ok looking at it some more... what is the output of the following:
System.out.println("vm vendor: " + System.getProperty("java.vendor"));
System.out.println("vm version: " + System.getProperty("java.version"));
System.out.println("class version: " + System.getProperty("java.class.version"));
I am wondering if there is an issue with the class file version - do the class files have a version that cannot be run on the Oracle VM?
Class resolution and loading are complex operations handled by the VM. The algorithm to be used by these 2 operations as described in the spec is left open for VM implementors.
My feeling is that in your case the resolution works as the operation checks only the availability of the class itself, while it is failing later when trying to effectively load the class (most probably due to missing dependencies: when loading the class, the VM needs to resolve at least all direct references to other classes).
You'll have to make sure that all classes are available to Oracle and performing a quick Google search for ORA-29534 shows tons of people having this problem (and I'm pretty sure somebody figured it out).
./alex
The saaj-impl.jar is part of the SAAJ component of the Web Services Developer Pack. It has dependencies on other JARs that ship with SAAJ, for instance, it definitely depends on saaj-api.jar and activation.jar, to my knowledge. Of course, saaj-api.jar is bound to depend on a lot of other JARs as well.
As far as JWSDP 1.5 is concerned, you could find the information in JWSDP 1.5 Release Notes to be useful. JWSDP 1.6 has different JARs in SAAJ I havent found the JWSDP 2.0 Release Notes to be particularly useful in this regard. BTW, JWSDP 2.0 would have different JARs to be placed in the classpath; so the scope of your problem eventually depends on the version of saaj-impl.jar that you use.
Just in case you might need it, some documentation is already available on how to load the SOAP client JARs into an Oracle database and to utilize them, in the following pages. I presume these to be different from the SAAJ JARs that comes with your library though.
Calling a webservice from the database.
How to install the SOAP client stack in the Oracle database.
Install JAR files in the database

Categories