How to solve java issue of Mathcad Integration Node in ModeFrontier? - java

I'm testing the modeFrontier with a simple multi-objective optimization problem
from ESTECO A simple multi-objective optimization problem
The ModeFrontier gives random values to the input variables h and r but it can't get values for the output variables b, l and v
Then I test the mathcad configuration. This was the output message:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Exception starting the process; nested exception is:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Initialization error; nested exception is:
com.jacob.com.ComFailException: Can't co-create object
Preferences of Mathcad in ModeFrontier:
Mathcad Preferences Script Security:
Below is the diagram of ModeFrontier:
The mathcad worksheet:

I don't know the reason of this problem, but I could solve when I ran the ModeFrontier as Administrador.
There is very problems if the ModeFrontier didn't run as administrator.
Then I recommend run always as administrator.
For run always as administrator, you can go to the ModeFrontier's icon. Right click on it and click on properties, finally click on check button "Run as administrator".

Related

What causes elusive: NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint()?

Many people have asked for help with this error:
javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint(Ljava/lang/String;Lorg/xnio/OptionMap;)Lorg/jboss/remoting3/Endpoint;]
at
org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:51)
at
org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:152)
at
javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
...
But no request I can find ever provides a conclusive answer. Just suggestions to tinker with jars.
I believe that’s because there’s an inconsistency in the structure of Jboss interfaces. Can anyone confirm or correct that?
Here’s my code that throws the above error:
final private Properties env = new Properties() {
{put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
put(Context.PROVIDER_URL, "http-remoting://localhost:9990");
put(Context.SECURITY_PRINCIPAL, "myID");
put(Context.SECURITY_CREDENTIALS, "myPassword");
put("jboss.naming.client.ejb.context", true);
}
};
/****************************************************
* myID & myPassword open the Admin GUI for wildfly *
* on localhost:9990 *
****************************************************/
Context ctx = new InitialContext(this.env);
To determine the required jars I removed all jars from the Build path.
Then I ran my program till all ClassNotFoundException were gone.
First Error
java.lang.ClassNotFoundException:
org.jboss.naming.remote.client.InitialContextFactory]
Added jboss-remote-naming-1.0.7.final.jar to class path
Second Error
java.lang.NoClassDefFoundError:
org/jboss/logging/Logger
Added jboss-logging.jar
Third Error
java.lang.NoClassDefFoundError:
org/xnio/Options
Added xnio-api-3.0.7.ga.jar
Fourth Error
java.lang.NoClassDefFoundError:
org/jboss/remoting3/spi/ConnectionProviderFactory
Added jboss-remoting-3.jar
Fifth Error
java.lang.NoClassDefFoundError:
org/jboss/ejb/client/EJBClientContextIdentifier
Added jboss-ejb-client-1.0.19.final.jar
FINAL AND FATAL ERROR
(Note: All NoClassDefFoundError have been cleared)
java.lang.NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint(Ljava/lang/String;Lorg/xnio/OptionMap;)Lorg/jboss/remoting3/Endpoint;]
Using Eclipse’s Project Explorer I verified:
a. jboss-remoting3.jar has the org.jboss.remoting3.Remoting Class.
b. That Remoting Class has this Method:
public Endpoint createEndpoint (String, Executor, OptionMap)
Note it calls for 3 parameters.
BUT the FINAL FATAL ERROR above calls for
public Endpoint createEndpoint (String, OptionMap)
Note: it calls for 2 parameters. Hence the NoSuchMethodError.
Looking at the top lines in the stack trace, I guess
org.jboss.naming.remote.client.InitialContextFactory.getInitialContext() is trying to call org.jboss.remoting3.Remoting.createEndpoint() using 2 parameters, but org.jboss.remoting3.Remoting only defines createEndpoint() with a 3-paramater signature.
Is that supposed to even be possible?
A jar that says it has the org.jboss.remoting3 package whose Remoting class has a single createEndpoint() method with a 3-parameter signature, and another jar that says it has the org.jboss.remoting3 package whose Remoting class has another createEndpoint() method with a 2-parameter signature?
HELP!
I mean do I need to look through every org.jboss.remoting3 package to find one whose Remoting class has a 2 parameter createEnpoint() method?
Or am I missing something important.
I mean this does explain how many questions have been posted about this error:
javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint(Ljava/lang/String;Lorg/xnio/OptionMap;)Lorg/jboss/remoting3/Endpoint;]
And explain why there is never a conclusive explanation or solution other than fiddling with jars and build path.
I mean getting an InitialContext from WildFly running on the same PC as the Java program should be a trivial process. But it hasn’t been. Maybe it's because of inconsistencies in the API.
Thanks to Christoph Böhme:
jboss-logging-3.1.4.GA.jar has an org.jboss.remeoting package with a Remoting class that has createEndpoint() with a 0, 2 and 3 parameter signature.
Replacing jboss-remoting-4.0.7.Final.jar with the above jar was all it required to clear the NoSuchMethodError.
Hope that helps others.

Java Casting Error Using CFPOP

My CF9 application running on a windows server pops mail. When I attempt to retrieve the entire body of the message, I sometimes get the following error...
Error:
An exception occurred while retrieving mail.
The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Location:
Line 335 in controllers\Submissions.cfc
Not sure if this is pertinent, but FYI every message will have an image attached and the whole process usually works fine. This problem is intermittent.
My Questions
Any idea what causes this?
Any idea how to catch and resolve this issue?
I suspect I'll need to drop down into java, but not sure where to start.
Code Fragments
<cfscript>
// setup variables array for all cfpop calls
CFPopAttributes = {
server = request.pop.server,
port = request.pop.port,
username = request.pop.username,
password = request.pop.password,
timeout = 300
};
</cfscript>
<cfpop
action="getall"
name="entireEmail"
uid="#uid#"
attachmentpath="#originalsPath#"
attributecollection="#CFPopAttributes#" // Line 335
generateuniquefilenames="true"
/>
NOTE: I added the comment "Line 335" above to communicate exactly where in the code the template is breaking. If I move the attributecollection up or down (before/after other attributes), the error always breaks at the attributecollection line.
Stack Trace
struct [Filtered - 1 of 8 keys hidden]
Detail: An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest.
Message: Event handler exception.
RootCause:
[struct]
Detail: The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Message: An exception occurred while retrieving mail.
RootCause:
[struct]
Message: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
StackTrace: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
at coldfusion.mail.EmailTable.getAttachmentName(EmailTable.java:819)
at coldfusion.mail.EmailTable.populate(EmailTable.java:283)
at coldfusion.mail.PopImpl.getMails(PopImpl.java:241)
at coldfusion.tagext.net.PopTag$1.run(PopTag.java:433)
at java.security.AccessController.doPrivileged(Native Method)
at coldfusion.tagext.net.PopTag.doStartTag(PopTag.java:429)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799)
at cfSubmissions2ecfc1952269377$funcGETEMAIL.runFunction(D:\home\wwwroot\controllers\Submissions.cfc:335)

How to resolve Error org.omg.CORBA.BAD_OPERATION exception in java ?

When I invoke method on client side, for distributed reference object, I have this message error:
Exception in thread "main" org.omg.CORBA.BAD_OPERATION:
at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:18)
at org.omg.CORBA.portable.ObjectImpl._is_local(ObjectImpl.java:130)
at fr.esiag.commun._ManageDemandStub.createDemand(_ManageDemandStub.java
:28)
at fr.esiag.commun.resource.MyInvocationHandler.invoke(MyInvocationHandl
er.java:29)
at com.sun.proxy.$Proxy0.createDemand(Unknown Source)
at org.TD.TransactionDriver.main(TransactionDriver.java:55)
Can someone tell me what that means ?
BAD_OPERATION expception happens when you try to call a method that dosen't exist in the servant. I think you cast (instead of narrow) the remote object wrong. Maybe it's is relative to your previous question

Java RMI InitialContext: Equivalent of LocateRegistry.createRegistry(int)?

I am trying to some pretty basic RMI:
// Context namingContext = new InitialContext();
Registry reg = LocateRegistry.createRegistry(9999);
for ( int i = 0; i < objs.length; i++ ) {
int id = objs[i].getID();
// namingContext.bind( "rmi:CustomObj" + id , objs[i] );
reg.bind( "CustomObj" + id , objs[i] );
}
That works without a hitch, but for future purposes, I need to use InitialContext.
Context namingContext = new InitialContext();
for ( int i = 0; i < objs.length; i++ ) {
int id = objs[i].getID();
namingContext.bind( "rmi:CustomObj" + id , objs[i] );
}
But I cannot get this to work. I have started rmiregistry from the command line. Is there an equivalent of LocateRegistry.createRegistry(int)? Or some other way to start the RMI registry / registry used by InitialContext from inside my class? (Instead of the command line)
Stack trace:
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: bguiz.scratch.network.eg.Student]
at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:126)
at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:208)
at javax.naming.InitialContext.bind(InitialContext.java:400)
at bguiz.scratch.RMITest.main(RMITest.java:29)
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: bguiz.scratch.CustomObj
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
....(truncated)
EDIT: I will delete my own question in a couple of days, as there seems to be no answer to this (I haven't been able to figure it out myself). Last call for any biters!
After much tinkering, I've solved the problem. FYI, here's what it was:
The ClassNotFoundException is getting thrown because of RMI registry has its own classpath. It doesn't matter that the class containing the InitialContext has the custom objects on its classpath - The RMI registry must be initialised such that the custom objects are on its classpath as well.
To do this set the classpath environment value on the comman line prior to starting rmiregistry. If this classpath contains the custom object's class, the ClassNotFoundException is not thrown, and subsequently ServerException and `CommunicationException' are avoided.
java.lang.ClassNotFoundException: bguiz.scratch.network.eg.Student caused by
java.lang.ClassNotFoundException: bguiz.scratch.CustomObj
Check if this class is available ?
Is there an equivalent of LocateRegistry.createRegistry(int)?
No.
Or some other way to start the RMI registry / registry used by InitialContext from inside my class?
Only LocateRegistry.createRegistry().
I'm almost sure you need to specify the hostname in the URL. What exception & error message are you getting?

An exception is encountered java.lang.UNIXProcess.forkAndExec

Anyone knows what is the reason for encountering this exception?
An exception is encountered during the processing. The stack track is below:
java.lang.UNIXProcess.forkAndExec(Native Method)
java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
java.lang.ProcessImpl.start(ProcessImpl.java:65)
java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
java.lang.Runtime.exec(Runtime.java:591)
java.lang.Runtime.exec(Runtime.java:464)
....
org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:198)
org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
org.quartz.core.JobRunShell.run(JobRunShell.java:202)
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
If the exception is being thrown from the start() method, then the OS isn't able to fork/exec the process. So the problem isn't the subprocess dying, but that it's not being launched.
So are you specifying this correctly ? Are you relying on PATH settings ? Are the execute permissions correct ?
It would be useful to see the code that you use to initialise the ProcessBuilder. i.e. the invocation parameters.

Categories

Resources