public static void main(String[] args) throws InterruptedException, InvocationTargetException { LOG.info("..."); // registering the server final String classPath = System.getProperty("java.class.path"); ComServerDescriptor serverDescriptor = new RegisterDispatchComServer.ComServerDescriptor( RTDServerSample.class, classPath, System.getProperty("jvm.path"), classPath, null, false);
List<Object> warnings = new ArrayList<Object>(); RegisterDispatchComServer.registerComServer(serverDescriptor, warnings); assert RegisterDispatchComServer .isRegistered(RTDServerSample.COM_SERVER_CLSID); LOG.info("Server registered.");
// client side. actually, this should be done in excel. Runnable client = new Runnable() { public void run() { IDispatch cDispatch = null; int count = 0; int maxTries = 3; while (true) { try {
// FAILING CALL cDispatch = new IDispatchImpl( CLSID.createFromProgID(RTDServerSample.PROG_ID .toLowerCase()), ClsCtx.LOCAL_SERVER); if (cDispatch != null) break; } catch (ComException e) { if (++count == maxTries) throw e; } }
IRtdServerImpl ci = new IRtdServerImpl(cDispatch); System.out.println("IID" + ci.getIID());
} }; OleMessageLoop.invokeAndWait(client); OleMessageLoop.stop();
// unregistering the server assert RegisterDispatchComServer .isRegistered(RTDServerSample.COM_SERVER_CLSID); RegisterDispatchComServer.unregisterComServer(serverDescriptor); assert !RegisterDispatchComServer .isRegistered(RTDServerSample.COM_SERVER_CLSID); LOG.info("Server unregistered."); }}
--
You are receiving this email because you have joined the "ComfyJ Forum" group or have been added by request. You may choose not to receive emails from this group or unsubscribe completely on "Edit my membership" page.
Go to http://links.teamdev.com/comfyj-forum, choose "Edit my membership" link on the right. Specify your email preferences in suggested options, or click "Unsubscribe" button.
---
You received this message because you are subscribed to the Google Groups "ComfyJ Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to comfyj-forum...@teamdev.com.
To post to this group, send email to comfyj...@teamdev.com.
Visit this group at http://groups.google.com/a/teamdev.com/group/comfyj-forum/.
For more options, visit https://groups.google.com/a/teamdev.com/d/optout.
// ...System.out.println("heartbeat = " + heartbeat);
// trying connecting dataSystem.out.println("trying connecting data");Int32 intIn = new Int32(12345);Variant topic1 = new Variant();topic1.setValue(new BStr("AAA"));Variant topic2 = new Variant();topic2.setValue(new BStr("10"));SafeArray safeArrayIn = new SafeArray(2, Variant.class);safeArrayIn.set(0, topic1);safeArrayIn.set(1, topic2);
VariantBool vBoolOut = new VariantBool(true);Variant result = rtdServer.connectData(intIn, safeArrayIn, vBoolOut);String resultValue = result.getBstrVal().getValue();System.out.println("Result: " + resultValue);
- Changing of AutoDelete from 'false' to 'true' detected - this may cause memory management issuejava.lang.Exception: Stack Trace at com.jniwrapper.win32.com.impl.IUnknownImpl.setAutoDelete(SourceFile:238) at com.jniwrapper.win32.com.server.IUnknownServer.doQueryInterface(SourceFile:238) at com.jniwrapper.win32.com.server.IUnknownServer.queryInterface(SourceFile:172) at com.jniwrapper.win32.com.server.IUnknownServer.create(SourceFile:298) at com.jniwrapper.win32.com.server.IClassFactoryServer.createIClassFactory(SourceFile:200) at rtdsample.RTDSererRegistration$1.run(RTDSererRegistration.java:70) at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run(MessageLoopThread.java:620) at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:562)Registering our IClassFactory instance...Our IClassFactory instance was successfully registered.Press 'Enter' to terminate server.
Revoking our IClassFactory instance...- Failed to invoke method: queryInterfaceAggregated; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt) (engl. Interface not supported)- Terminated thread Main message loopOur IClassFactory instance was successfully revoked.
--
--
RegisterDispatchComServer.ComServerDescriptor descriptor = new RegisterDispatchComServer.ComServerDescriptor(serverClass, serverLocation, jvmPath, classpath, VMParameters,runIndividualJVM);