I am using Jacob a Java-COM bridge and I have placed the required dll to -C:\WINDOWS\system32\jacob-1.14.3-x86.dll. I have also added the required jar file to -
C:\Program Files\Java\jdk1.6.0_18\jre\lib\ext\jacob-1.14.3.jar.
Until yesterday I was able to use it, today I uninstalled some unrequired .Net softwares on my machine and suddenly it stopped working and throws following error -
com.jacob.com.ComFailException: Can't co-create object
at com.jacob.com.Dispatch.createInstanceNative(Native Method)
at com.jacob.com.Dispatch.<init>(Dispatch.java:101)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
My machine belongs to "x86 Family 15 Model 4 Stepping 3". I have tried to de-register/register the dll using regsvr32.exe but to no luck. I have no idea how to bring it to work again..other wise I will have to format my machine..geeks pls hlp me out !
I wonder if anyone faced similar problem by any chance..
Anyways I had no other option than to restore my machine to last working date.
I guess some JAVA-COM class entries would have been accidently deleted from the registry.
Had no idea which was it exactly..
Finally "System Restore" was my solution :)
Related
I am getting below error on my web app.
java.lang.UnsatisfiedLinkError: Can't obtain updateLastError method for class com.sun.jna.Native
com.sun.jna.Native.initIDs(Native Method)
com.sun.jna.Native.<clinit>(Native.java:139)
com.sun.jna.Pointer.<clinit>(Pointer.java:41)
com.sun.jna.platform.win32.WinNT$HANDLEByReference.<init>(WinNT.java:1114)
com.sun.jna.platform.win32.WinNT$HANDLEByReference.<init>(WinNT.java:1110)
waffle.windows.auth.impl.WindowsAuthProviderImpl.logonDomainUserEx(WindowsAuthProviderImpl.java:193)
waffle.windows.auth.impl.WindowsAuthProviderImpl.logonDomainUser(WindowsAuthProviderImpl.java:181)
waffle.windows.auth.impl.WindowsAuthProviderImpl.logonUser(WindowsAuthProviderImpl.java:212)
waffle.apache.MixedAuthenticator.post(MixedAuthenticator.java:233)
waffle.apache.MixedAuthenticator.authenticate(MixedAuthenticator.java:112)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:577)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
I searched that it may be due to some old version access of jna but removing jna is giving me NoClassDefErrors for com.sun.jna.Pointer. Also tried -Djna.nosys=true but its also not solving the issue.
I also tried -Djava.library.path=
from What is the cause of an UnsatisfiedLinkError? but it is also not working..
Any suggestion is highly appreciated.
I resolved this by deleting an old jnidispatch.dll file from my machine.
I'm using Gradle and Tomcat on Windows 7.
Delete the jnidispatch.dll file in C:\Users\<username>\.gradle\native\jna\win32-amd64
Don't have enough rep to just comment, but this is vaguely similar to a question i asked a couple years ago called UnsatisfiedLinkError, despite setting Djava.library.path variable
Somebody suggested making sure i was using the right architecture type, i.e. using 64 bit jdk with 64 bit Tomcat & 32 with 32. Does that match up?
I'm using the JACOB (Java COM Bridge) library to call registered COM Objects from my Windows OS.
It took me a while until I figured out how JACOB works and to set up everything. So my current problem is that:
ActiveXComponent comp = new ActiveXComponent("iTunes.Application");
for example works, my iTunes starts properly etc.
If I want to call a self generated and registered COM Object written in C# JACOB responds the following error:
Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object
That my iTunes started was an indicator for me that everything is set up right, I'm not sure why JACOB can't call my own .dll
Currently I'm using the Visual Studio 2015 on build register for COM interop function which worked pretty good in the past for me. The COM object looks as following:
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComClass1Interface
{
}
[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComClass1Events
{
}
[ComVisible(true)]
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(ComClass1Events))]
[ProgId("test.Application")]
public class ComClass1 : ComClass1Interface
{
}
Is anything wrong with my C# dll or does JACOB require a certain type of structure in this dll?
Unfortunately I could not find any COM examples for JACOB.
Thanks in advance.
EDIT:
If i change my first line to:
ActiveXComponent comp = new ActiveXComponent("CLSID:{C9888A8E-8D23-4185-9D7D-A1E0B812803D}");
I'm getting following Exception:
Exception in thread "main" com.jacob.com.ComFailException: Can't find moniker
My .dll should be registered though.
I would first write a VBS (VB script) program to test your DLL and make sure it runs.
set obj = CreateObject("test.application")
MsgBox TypeName(obj)
Make sure it succeeds. If it fails, then (assuming a 64-bit OS), try running it with c:\windows\syswow64\wscript.exe path\to\your\script.vbs.
Check to see whether your Java process is a 64-bit or 32-bit process. Your C# DLL has to be registered with the same bit-ness as your Java process for it to succeed.
Thanks for the hint, I was able to find a solution:
Visual Studio apparently registered my COM-Object as 32 bit.
I'm not sure if this is a default setting(?).
So two simple steps to solve the problem:
open your windows cmd as admin.
Run the following Command:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe /verbose /nologo /codebase "path to your dll"
The command will register the .dll in 64 bit and not 32.
This solved the problem for me and I could use it via JACOB.
Our application is a RoR app, and currently uses JRuby version 1.7.22, and JRE 8_65. Our app is an on-prem solution, so we use JRuby to host our application on JVM at the target, Windows Server 2012 R2 system. We compile our ruby code, using
jruby -S jrubyc
This takes the .rb file and compiles it to a .class file. In the original .rb, it loads in the class file, like so.
load __FILE__.sub(/\.rb$/, ".class")
This all works with JRuby 1.7.22
Now, we want to update JRuby to 9.0.5.0, but are experiencing some problems when it comes to deploying our application. Basically, that line of code above inside of the .rb file is not working anymore, and we get the error when trying to run a rake db:setup
rake aborted!
LoadError: C:/appname/app/models/app_attribute.class is not compiled Ruby; use java_import to load normal classes
C:/appname/app/models/app_attribute.rb:1:in `<top>'
C:/appname/db/seeds.rb:10:in `<top>'
C:/appname/db/seeds.rb:9:in `block in (root)'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Great. So I replace load with java_import
rake aborted!
ArgumentError: not a valid Java identifier: C:/appname/app/models/app_attribute.class
uri:classloader:/jruby/java/core_ext/object.rb:43:in `block in java_import'
uri:classloader:/jruby/java/core_ext/object.rb:34:in `java_import'
C:/appname/app/models/app_attribute.rb:1:in `<top>'
C:/appname/db/seeds.rb:10:in `<top>'
C:/appname/db/seeds.rb:9:in `block in (root)'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Still not working, no matter what I try. I looked at this post: https://github.com/jruby/jruby/issues/3018
I tried to pass the parameter
jruby -Xaot.loadClasses=true
But I get a warning saying that aot.LoadClasses is not recognized. EVEN THOUGH I see it in the properties when I type
jruby -Xproperties
I have done A LOT of research on this, and have probably have looked at everything on the internet regarding this. Any input will be greatly appreciated. Is there something I missing? I am not fully adept in Java.
Thank you.
might be the same issue as https://github.com/jruby/jruby/issues/3651
which means you'll need to wait for 9.1 or use a snapshot http://ci.jruby.org/
since, the error is slightly different you should look into reproducing with snapshot and if it fails (might be Windows related) a step-by-step reproduction might speed-up getting the issue resolved.
jruby -Xaot.loadClasses=true
this is not needed with Warbler
But I get a warning saying that aot.LoadClasses is not recognized. EVEN THOUGH I see it in the properties when I type
hmm, could you reproduce this with an empty script and no JRUBY_OPTS ?
I have done A LOT of research on this, and have probably have looked at everything on the internet regarding this. Any input will be greatly appreciated.
you might want to try looking into the issue next time :) or considering getting some support
Is there something I missing? I am not fully adept in Java.
you shouldn't be missing anything - its not a Java issue ...
I have a program that uses Sqlite database. It works fine on Windows (exported jar or directly in Eclipse) but when I move it to linux server (plan is to use run it at certain intervals, cron job). I'm exporting it to jar from Eclipse and packing the sqlite-jdbc4-3.8.2-SNAPSHOT.jar with it. Error is this:
/$ /usr/bin/java -jar /home/username/Software.jar /home/username/
java.lang.UnsatisfiedLinkError: /tmp/sqlite-3.8.2-amd64-libsqlitejdbc.so: /tmp/sqlite-3.8.2-amd64-libsqlitejdbc.so: failed to map segment from shared object: Operation not permitted
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
at org.sqlite.core.NativeDB._open(Native Method)
at org.sqlite.core.DB.open(DB.java:161)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:145)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:66)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:21)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:23)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:44)
at org.sqlite.JDBC.createConnection(JDBC.java:113)
at org.sqlite.JDBC.connect(JDBC.java:87)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
....
So before you ask, I've made sure that sqlite-3.8.2-amd64-libsqlitejdbc.so in /tmp/ has all permissions (rwxrwxrwx). Still that native library is causing problems. It does get copied in /tmp/ folder though. That being said I totally suck in Linux... and for that reason I'm pretty much clueless what to try next.
What should I do? Switch connector?
EDIT:
Solved the problem by using System.setProperty("java.io.tmpdir", "/home/username/"); Apparently it for some reason couldn't execute the native library from tmp folder... Probably because it was created by root. Also I had to revert back to sqlite-jdbc-3.7.2.jar because the new one crashes on linux.
I had same problem, and I found the solution in this GitHub issue:
JAVA_OPTS=-Djava.io.tmpdir=/path/to/some/other/tmpdir bin/cerebro
Also look at this other SO answer.
I am using Netbeans 7, and I have 32 bit JDK version 1.7.0.40. I want to use jpcap library to analyze incoming packets.
I do following to be able to use jpcap.
I added "jpcap.jar" into my project's library.
I copied "jpcap.dll" into my JRE/bin
I copied "jpcap.jar" into my JDK/jre/lib/ext
I copied "jpcap.jar" into my JRE/lib/ext
However, I get the exception below:
Exception in thread "main" java.lang.UnsatisfiedLinkError: jpcap.JpcapCaptor.getDeviceList()[Ljpcap/NetworkInterface;
at jpcap.JpcapCaptor.getDeviceList(Native Method)
at src.JpcapAnalyzer.<init>(JpcapAnalyzer.java:19)
at src.Main.main(Main.java:31)
Java Result: 1
I appreciate for any recommendations.
Edit :
After 2 weeks posting this question, I received no answers. Then I want to share my experience with the community.
I tried another library,jnetpcap, which can be downloaded at https://sourceforge.net/projects/jnetpcap/. I easily implemented it. You can use this library both in 32 bit and 64 bit OS and JDK.