Hi I am currently task to convert a legacy Visual Basic 6 Application that communicates with the a Passbook Printer via third Party Application XFS.ocx (No source).
Based on my research I could JACOB to do this task but I am encountering an error. Can anyone help me? Based on the logs my program can instantiate the activeXcomponent and see the id of the methods I want to use however when I try to use them I encounter an error.
In the sample VB6 code I am using as a guide the method VersionRequired requires two integers as a parameter while ApplicationID requires just a string.
Hopefully I just made a mistake on the syntax or JACOB method to use as I only want to use java JNI as a last resort. Please note this application will always be installed in a Windows(7/10) workstation so other OS compatibility is not an issue.
Here is my Code
ActiveXComponent activeXComponent = new ActiveXComponent("XFS.XFSCtrl.1");
System.out.println( activeXComponent.getIDOfName(activeXComponent, "ApplicationID"));
System.out.println( activeXComponent.getIDOfName(activeXComponent, "VersionRequired"));
System.out.println( activeXComponent.getIDOfName(activeXComponent, "Description"));
System.out.println( activeXComponent.getIDOfName(activeXComponent, "Open"));
//Variant variant = activeXComponent.call(activeXComponent, "VersionRequired",1,1);
//Variant variant = activeXComponent.call(activeXComponent, "Description"); // added 072318 for David answer
//Variant variant = activeXComponent.getProperty("Description");
//activeXComponent.setProperty("Description", "Description");
//Variant variant = activeXComponent.get(activeXComponent,"Description");
activeXComponent.call(activeXComponent, "Description", "value");
Here is the logs and error I am encountering
WARNING: JNI local refs: zu, exceeds capacity: zu
at java.lang.System.initProperties(Native Method)
at java.lang.System.initializeSystemClass(System.java:1166)
main: Loading library jacob-1.19-x86 using System.loadLibrary
main: Loading library jacob-1.19-x86 using System.loadLibrary
main: Loading library jacob-1.19-x86 using System.loadLibrary
main: ComThread: before Init: 0
main: ComThread: after Init: 0
main: ROT: Automatic GC flag == false
main: ComThread: after ROT.addThread: 0
main: ROT: adding com.jacob.activeX.ActiveXComponent#11d50c0->com.jacob.activeX.ActiveXComponent table size prior to addition:0
13
31
1
21
main: ROT: adding ->com.jacob.com.Variant table size prior to addition:1
main: ROT: adding ->com.jacob.com.Variant table size prior to addition:2
main: ROT: adding ->com.jacob.com.Variant table size prior to addition:3
main: ROT: adding ->com.jacob.com.Variant table size prior to addition:4
main: ROT: adding ->com.jacob.com.Variant table size prior to addition:5
Exception in thread "main" com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Description
Description: 8000ffff / Catastrophic failure
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.com.Dispatch.invokev(Dispatch.java:625)
at com.jacob.com.Dispatch.callN(Dispatch.java:453)
// at com.jacob.com.Dispatch.get(Dispatch.java:788) // added 072318 when using activeXComponent.get(activeXComponent,"Description")
at com.jacob.com.Dispatch.call(Dispatch.java:541)
// at com.jacob.com.Dispatch.call(Dispatch.java:529) // added 072318 for David answer
at ph.com.bdo.icos.passbook.Launcher.main(Launcher.java:32)
VB Code I am Using as a reference
With XFS1
'Set up the versions required of XFS and SP
.VersionRequired(WFS_VERSREQ_OLE, WFS_VERSREQ_LOW) = 1# ' 2.00
.VersionRequired(WFS_VERSREQ_OLE, WFS_VERSREQ_HIGH) = 2# ' 2.00
.VersionRequired(WFS_VERSREQ_API, WFS_VERSREQ_LOW) = 1.01
.VersionRequired(WFS_VERSREQ_API, WFS_VERSREQ_HIGH) = 2#
.VersionRequired(WFS_VERSREQ_SRV, WFS_VERSREQ_LOW) = 1.01
.VersionRequired(WFS_VERSREQ_SRV, WFS_VERSREQ_HIGH) = 2.1
'Get back one of the values for testing
fResult = .VersionRequired(WFS_VERSREQ_API, WFS_VERSREQ_LOW)
'Set and Get the Application property for testing
.ApplicationID = "Passbook Printer"
sAppID = .ApplicationID
sDescription = .Description
My guess is than Description is a read-only property, not a function
so you can't use a call on it and this code will bug, producing a catastrophic failure (COM error have always been obscure):
activeXComponent.call(activeXComponent, "Description", "value");
as explained by the message log :
Exception in thread "main" com.jacob.com.ComFailException: A COM exception has been encountered: At Invoke of: Description
and you can't set a property either because it's read-only:
activeXComponent.setProperty("Description", "Description");
Actually if you read your VB6 code correctly, the Description property is just read
sDescription = XFS1.Description
Try this instead:
Variant v = activeXComponent.call(activeXComponent, "Description");
String description = v.toString();
Related
I have a script that works perfectly when I'm not using Renv. However, when running it in a project with Renv enabled, the last command line returns the following message:
> r5r_core <- setup_r5(data_path = data_path, verbose = FALSE)
Error in rJava::.jinit() : Unable to create a Java class loader.
Just run the code below inside a renv project to have a reproducible example:
options(java.parameters = "-Xmx2G")
library(r5r)
library(rJava)
data_path <- system.file("extdata/poa", package = "r5r")
list.files(data_path)
poi <- fread(file.path(data_path, "poa_points_of_interest.csv"))
head(poi)
points <- fread(file.path(data_path, "poa_hexgrid.csv"))
points <- points[ c(sample(1:nrow(points), 10, replace=TRUE)), ]
head(points)
# Indicate the path where OSM and GTFS data are stored
r5r_core <- setup_r5(data_path = data_path, verbose = FALSE)
My Java version is compatible with the one used in this package, but it looks like R is having a hard time communicating with Java in Renv. Could anyone tell me?
I have such a method in my bean:
/**
*
* #param searchBase - The base DN where the search should start.
* #return List of EmployeeContacts built from persons found in AD under the searchBase
*/
private List<EmployeeContact> getAllPersonsFromBase(String searchBase) {
final PagedResultsDirContextProcessor processor = new
PagedResultsDirContextProcessor(500);
final SearchControls searchControls = new SearchControls();
searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
return SingleContextSource.doWithSingleContext(
contextSource,
singleContextLdapOperations -> {
List<EmployeeContact> result = new LinkedList<>();
do {
List<EmployeeContact> oneResult = singleContextLdapOperations.search(
searchBase,
"(&(objectClass=user)(objectCategory=person))",
searchControls,
this::mapAttributesToEmployeeContact,
processor);
result.addAll(oneResult);
} while(processor.hasMore());
return result;
});
}
It works perfectly under my Windows 10 (Oracle JDK 11.0.9).
Tested it on a clean VM with Windows 10 and had the same result - works as it should.
But I have problems running it under Ubuntu. Tried JDK from 11.0.8 to 11.0. The result is always the same.
When the search result contains less than 500 (hardcoded in the method) records it works fine. But when the result is paged it fails with:
2021-05-07T18:50:50,380 INFO [scheduling-1] org.spr.lda.con.AbstractFallbackRequestAndResponseControlDirContextProcessor: No matching response control found - looking for 'class javax.naming.ldap.PagedResultsResponseControl
2021-05-07T18:50:50,381 ERROR [scheduling-1] biz.san.it.int.sw_.ADReader: Exception been caught while querying Active Directory. Exception:
java.lang.ClassCastException: class java.lang.String cannot be cast to class [B (java.lang.String and [B are in module java.base of loader 'bootstrap')
Looks like it cannot load class javax.naming.ldap.PagedResultsResponseControl when it runs under Ubuntu.
And then it fails with the strange exception probably because of unpredictable response.
When the search result returns less then 500 records it works fine. But when the result is paged it fails.
The problem was in application.yaml encoding. Something with CRLF. The file has been edited in windows notepad and then transferred to Linux VM.
When I edited the file with vim changing some lines in ldap config section and then restarted my service the problem has gone.
I used the following command to create a .pb file:
flow --model ../YOLOv2/alexeyAB_darknet/darknet-master/cfg/yolov2-dppedestrian.cfg --load ../YOLOv2/alexeyAB_darknet/darknet-master/backup/yolov2-dppedestrian_33900.weights --savepb
Although the model was created successfully, when I load it into my java tensorflow application, I get the following error:
Exception in thread "Thread-9" org.tensorflow.TensorFlowException: Could not find meta graph def matching supplied tags: { serve }. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: saved_model_cli
The problem is in the second line of code:
String model_path = "/home/adisys/Desktop/cloudiV2/models/yolo_pedestrian/saved_model";
SavedModelBundle model = SavedModelBundle.load(model_path, "serve");
I tried digging deep and found this link:
Can not load pb file in tensorflow serving
Following the link I ran the following command:
saved_model_cli show --dir saved_model/
The output is as follows:
/home/adisys/anaconda3/lib/python3.6/site-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters
The given SavedModel contains the following tag-sets:
As can be seen, there were no tag-sets displayed.
What could be the issue?
I just saw your post, I'm sure the problem has solved itself now, but I'm leaving the comment for others working with darkflow. The command --savepb needs to be assigned as --savepb True
I am completely at a loss over this - updated my Java (to version 8, build 91) and now my Groovy project, in an early development stage, simply will not run. (See answer The update was a co-incidence)
BUG! exception in phase 'semantic analysis' in source unit 'Simul.groovy' unexpected NullpointerException
Caused by: java.lang.NullPointerException
Here is an example piece of code:
package simul
class Simulation {
def globalMemory
def signalNetwork
def processors
def blueTree
def coreArray
def outputDevice
def endian
def coreCount
static CORE_COUNT = 256
static TOTAL_MEM_SIZE = 0x100000000
static DEFAULT_ENDIAN = 0
static LOCAL_MEM_SIZE = 16
static LOCAL_MEM_START = 0xA0000000
Simulation(def cores = this.CORE_COUNT, def memSize = this.TOTAL_MEM_SIZE,
def endianess = this.DEFAULT_ENDIAN)
{
//0 for little endian, 1 for big endian
endian = endianess
globalMemory = new MemoryArray(this, memSize, 0)
coreCount = cores
}
}
def stuff = new Simulation()
stuff.coreArray = []
for (coreNumb in 1..stuff.coreCount) {
stuff.coreArray << new Core(stuff, coreNumb - 1)
}
Eclipse merely flags an error on the package line (and does the same for other class files).
I assume this is a problem caused by the Java update but I can find nobody else referencing this issue online (and unfortunately the Groovy email lists seem to be unavailable due to a DNS problem).
Any clues?
Update
If I try to run one of the files on its own eg groovyConsole Simul.groovy it will execute but then complain it cannot see other files in the package. In fact I can do the same inside the IDE (and this error is repeated in ggts also) if I change the package name for the Simul.groovy file. But if I try to compile/run the code with the package names properly specified it fails with this BUG! error.
(This means the problem is similar - in terms of symptoms - to this: https://answers.atlassian.com/questions/327479/scriptrunner-bug-exception-in-phase-semantic-analysis-in-source-unit-script40-groovy-bundle-is-uninstalled)
This is the stack trace:
BUG! exception in phase 'semantic analysis' in source unit '/Users/adrian/groovy_stuff/simul/src/simul/Simul.groovy' unexpected NullpointerException
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1226)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:651)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:629)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:606)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:201)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.resolve(GroovyCompilationUnitDeclaration.java:2206)
at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1084)
at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1129)
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:215)
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:281)
at org.codehaus.jdt.groovy.model.GroovyReconcileWorkingCopyOperation.makeConsistent(GroovyReconcileWorkingCopyOperation.java:80)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:90)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:789)
at org.codehaus.jdt.groovy.model.GroovyCompilationUnit.reconcile(GroovyCompilationUnit.java:440)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:126)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:108)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:89)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:151)
at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:104)
at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)
Caused by: java.lang.NullPointerException
at org.codehaus.groovy.control.StaticVerifier$1.visitVariableExpression(StaticVerifier.java:84)
at org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitPropertyExpression(CodeVisitorSupport.java:251)
at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55)
at org.codehaus.groovy.control.StaticVerifier.visitConstructorOrMethod(StaticVerifier.java:79)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:121)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1214)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
at org.codehaus.groovy.control.StaticVerifier.visitClass(StaticVerifier.java:42)
at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:235)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1221)
... 24 more
Well, the answer is I was referring to static members of the class Simulation in the form of this.STATIC_MEMBER as parameters to the class constructor.
As this doesn't exist at this point (and is superfluous in any case) this does raise a NullPointerException though it is highly confusing that it's flagged at the point of the package command.
I just downloaded and setup the Apache James 3 latest beta release on Windows and so far i haven't been able to send a simple message. It looks like there is an issue with the build. The error is -
ERROR 22:45:01,666 | james.mailspooler | Exception processing mail while spooling Unable to process mail Mail1442234701295-757cd62b-eeed-4671-828c-2a7c715acfaa (org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.apache.james.core.MailImpl#4262d5d7])
javax.mail.MessagingException: Unable to process mail Mail1442234701295-757cd62b-eeed-4671-828c-2a7c715acfaa (org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.apache.james.core.MailImpl#4262d5d7])
.
.
Caused by: javax.mail.MessagingException: Unable to process mail Mail1442234701295-757cd62b-eeed-4671-828c-2a7c715acfaa (org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.apache.james.core.MailImpl#4262d5d7])
.
.
Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.apache.james.core.MailImpl#4262d5d7]
.
.
Caused by: java.lang.NoSuchMethodError: org.apache.james.mime4j.stream.MimeConfig: method <init>()V not found
The relevant class in the JAR shows the supposedly missing constructor so i am at a complete loss. Can anyone guide me in the right direction please?
Thanks in advance!
Edit: Decompiled code snippet from the MimeConfig class shows the constructor
public final class MimeConfig {
/* member class not found */
class Builder {}
.
.
MimeConfig(boolean strictParsing, int maxLineLen, int maxHeaderCount, int maxHeaderLen, long maxContentLen, boolean countLineNumbers,
String headlessParsing, boolean malformedHeaderStartsBody) {
/* 53*/ this.strictParsing = strictParsing;
/* 54*/ this.countLineNumbers = countLineNumbers;
/* 55*/ this.malformedHeaderStartsBody = malformedHeaderStartsBody;
/* 56*/ this.maxLineLen = maxLineLen;
/* 57*/ this.maxHeaderCount = maxHeaderCount;
/* 58*/ this.maxHeaderLen = maxHeaderLen;
/* 59*/ this.maxContentLen = maxContentLen;
/* 60*/ this.headlessParsing = headlessParsing;
}
I got the same error and was searching for an answer. The error is because MimeConfig doesn't have a default constructor. I could get the mail successfully delivered locally by doing to following.
Dowloaded apache-mime4j-core-0.8.0-20150617.024907-738-sources
Created a default public constructor for MimeConfig
Initialized all the variables with values shown in the static class Builder constructor
Added setters for all the variables (Because I was getting NoSuchMethodError for setMaxLineLen)
Created a jar called apache-mime4j-0.8.0-fix.jar and pushed into the lib folder
I use run.sh, so replaced the mime4j core jar name with the above one.
I am sure there is some mismatch between spooler and mime4j. I think the calling code should use the Builder instead of directly trying to instantiate the MimeConfig.
Try these and let me know if it works. It worked for me. I am not sure if this is a permanent fix, but I can go ahead with exploring the V3 features till we get a permanent solution.
The solution is to use the : apache-mime4j-core-0.7.2.jar and apache-mime4j-dom-0.7.2.jar
download the two jars and put them in : james-server-app-3.0.0-beta5-SNAPSHOT\lib.
You can download james-server-app-3.0.0-beta5 from : https://repository.apache.org/content/repositories/snapshots/org/apache/james/james-server-app/3.0.0-beta5-SNAPSHOT/.