"no sigar-x86-winnt.dll in java.library.path" error when using Hyperic SIGAR on multi language OS - multilingual

I am using a Hyperic SIGAR library as third party lib in my installation program.
My installation program unpacks all third lib files to the %TEMP%\\user folder.
On English OS's everything works great, but when i tried to run my setup program on Spanish Os,
I've encountered the following error:
the java library includes the sigar.jar:
java.class.path=C:\DOCUME~1\Spanish Letters\CONFIG~1\Temp\e4j58.tmp_dir\user\sigar.jar
My installation program supports WinXP, WIN7 OS's.
The Error is:
no sigar-x86-winnt.dll in java.library.path
org.hyperic.sigar.SigarException: no sigar-x86-winnt.dll in java.library.path
at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172)
at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:100)
at I4jScript_Internal_1.eval(I4jScript_Internal_1.java:23)
at I4jScript_Internal_1.evaluate(I4jScript_Internal_1.java:79)
at com.install4j.runtime.installer.helper.Script.evaluate(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runScript(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runScript(Unknown Source)
at com.install4j.runtime.beans.actions.control.RunScriptAction.execute(Unknown Source)
at com.install4j.runtime.beans.actions.SystemInstallOrUninstallAction.install(Unknown Source)
at com.install4j.runtime.installer.InstallerContextImpl.performActionInt(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.performAction(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.executeActions(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.handleCommand(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.handleStartup(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.start(Unknown Source)
at com.install4j.runtime.installer.Installer.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.exe4j.runtime.WinLauncher.main(Unknown Source)
at com.install4j.runtime.launcher.WinLauncher.main(Unknown Source)'
Is someone already encountered a similar error and can advise?
Thanks.

you should set System property (java.library.path)
ex) java ... -Djava.library.path=../lib/sigar/lib ...
java.library.path is folder that contain the sigar-x86-winnt.dll
https://forums.oracle.com/forums/thread.jspa?threadID=1299532

You could also add to java.path.library at runtime programmatically.
System.setProperty("java.library.path", System.getProperty("java.library.path")+File.pathSeparator+pathToYourDLL);
//set sys_paths to null
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);
A very good explanation is found at : http://fahdshariff.blogspot.jp/2011/08/changing-java-library-path-at-runtime.html

sigar-x86-winnt.dll put in the current user directory, it will work

as discussed in the docs, SIGAR uses JNI underneath. You have to include appropriate JNI file in the path (file is usually displayed in the stack trace).
If you are using maven to build the project, you should edit pom.xml to add this file to the path(alas, you cant specify artifact and assume it is going to be in path)
<!-- add sigar dll to java path -->
<configuration>
<forkMode>once</forkMode>
<workingDirectory>target</workingDirectory>
<argLine>-Djava.library.path=${basedir}/lib</argLine>
</configuration>

Related

Play framework, typesafe activator: "error loading JNotify watch service: no jnotify in java.library.path"

I am trying to open an existing application through typesafe activator 1.3.
The error message says that JNotify is missing in java library but I've also added jnotify_64bit.dll file to the "/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin" directory. But I'm still facing the error. Below is the log. It's been a while I'm stuck here and I really need some help here.
java.lang.UnsatisfiedLinkError: no jnotify in java.library.path at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at
java.lang.Runtime.loadLibrary0(Runtime.java:870) at
java.lang.System.loadLibrary(System.java:1122) at
net.contentobjects.jnotify.macosx.JNotify_macosx.(Unknown
Source) at
net.contentobjects.jnotify.macosx.JNotifyAdapterMacOSX.(Unknown
Source) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442) at
net.contentobjects.jnotify.JNotify.(Unknown Source) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
play.runsupport.JNotifyPlayWatchService$JNotifyDelegate.ensureLoaded(PlayWatchService.scala:168)
at
play.runsupport.JNotifyPlayWatchService$$anonfun$5.apply(PlayWatchService.scala:223)
at
play.runsupport.JNotifyPlayWatchService$$anonfun$5.apply(PlayWatchService.scala:179)
at
scala.util.control.Exception$Catch$$anonfun$withTry$1.apply(Exception.scala:129)
at
scala.util.control.Exception$Catch$$anonfun$withTry$1.apply(Exception.scala:129)
at scala.util.control.Exception$Catch.apply(Exception.scala:102) at
scala.util.control.Exception$Catch.withTry(Exception.scala:129) at
play.runsupport.JNotifyPlayWatchService$.apply(PlayWatchService.scala:179)
at
play.runsupport.PlayWatchService$$anon$1.delegate$lzycompute(PlayWatchService.scala:65)
at
play.runsupport.PlayWatchService$$anon$1.delegate(PlayWatchService.scala:61)
at
play.runsupport.PlayWatchService$$anon$1.watch(PlayWatchService.scala:74)
at play.runsupport.Reloader.(Reloader.scala:268) at
play.runsupport.Reloader$.reloader$lzycompute$1(Reloader.scala:174)
at
play.runsupport.Reloader$.play$runsupport$Reloader$$reloader$1(Reloader.scala:174)
at play.runsupport.Reloader$.startDevMode(Reloader.scala:197) at
play.forkrun.ForkRun$.startServer(ForkRun.scala:82) at
play.forkrun.ForkRun.run(ForkRun.scala:173) at
play.forkrun.ForkRun$$anonfun$settingUp$1.applyOrElse(ForkRun.scala:162)
at akka.actor.Actor$class.aroundReceive(Actor.scala:465) at
play.forkrun.ForkRun.aroundReceive(ForkRun.scala:148) at
akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) at
akka.actor.ActorCell.invoke(ActorCell.scala:487) at
akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254) at
akka.dispatch.Mailbox.run(Mailbox.scala:221) at
akka.dispatch.Mailbox.exec(Mailbox.scala:231) at
scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
I was facing the same error of you. In my case, I've cloned a play framework(2.3.x) repository project to run the project.
I actually followed this steps:
sbt clean compile
sbt evicted
set ~run
Now, It's working well!
If this doen't work, try to change to your java and javac to 1.6 version.
Actually, until the Play 2.3 use Java 6.

ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver while deploying google connector for database

I'm deploying google search appliance connector for database(SQL). I'm filling the information in the GSA hostname and other required variable where I have specified the full class name of my JDBC Driver as:
com.microsoft.sqlserver.jdbc.SQLServerDriver
which is right. I have browsed my library of the JDBC to check that.
But after the installation, I am getting this error in the logs:
main .Application.realDaemonStart() INFO: about to init com.google.enterprise.adaptor.database.DatabaseAdaptor
11-04 14:05:27.314 main .Application.realDaemonStart() WARNING: Failed to initialize adaptor
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.google.enterprise.adaptor.database.DatabaseAdaptor.init(DatabaseAdaptor.java:133)
at com.google.enterprise.adaptor.Application.realDaemonStart(Application.java:186)
at com.google.enterprise.adaptor.Application.daemonStart(Application.java:155)
at com.google.enterprise.adaptor.Application.start(Application.java:110)
at com.google.enterprise.adaptor.Application.main(Application.java:553)
at com.google.enterprise.adaptor.AbstractAdaptor.main(AbstractAdaptor.java:64)
at com.google.enterprise.adaptor.database.DatabaseAdaptor.main(DatabaseAdaptor.java:315)
What does this mean? I have specified the right class name in the JDBC. Any help is appreciated.
When you run the adaptor - is your JAR file in the same directory as your database adaptor JAR file?
If you are using the Google provided command line, be sure to modify the "classpath" to reference the JAR file for the ODBC driver.
ie.
-classpath="msqljdbc.jar,adaptor-database-4.1.1-withlib.jar"
or
-cp="msqljdbc.jar,adaptor-database-4.1.1-withlib.jar"

How to run Storm Topology class through command prompt?

Hi i have a single topology class with main method in it. It starts zookeeper and run in eclispe right click run as java application. But i am trying it to be able to run through batch file i have tried
java -classpath jar-with-classes-and-dependency.jar com.demo.Topology
but this gives me exception like this.
Exception in thread "main" java.lang.NoClassDefFoundError:
backtype/storm/generated/AlreadyAliveException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException:
backtype.storm.generated.AlreadyAliveException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
I think this is about missing any dependency.
Please help in running this topology class.
Try running like this...
pathToStorm/bin/storm jar ./target/jar-with-classes-and-dependency.jar com.demo.Topology.
And remember, you should build your jar before doing this step. You can build your jar by running
mvn clean install inside your storm project where your pom.xml file is located.

CXF Webservice call works well in Netbeans IDE, but fails in standalone jar created by Netbeans (Swing,CXF,web start,Netbeans)

I am trying to create a shopping cart application in SWING, which uses SOAP webservice to get items from DB.
I have generated WebService client using WSDL URL in eclipse (CXF implementation) and exported as JAR to add it as dependency in my Swing application.
Following code snippet calls my SOAP web service in Swing application:
ItemWebServiceService itemWebServiceService = new ItemWebServiceService(ItemWebServiceService.WSDL_LOCATION,SERVICE_NAME);
IItemServiceSEI itemWebService = itemWebServiceService.getItemWebServicePort();
try
{
ilv = new ItemListView(itemWebService.fetchItems(productID), this);
} catch (ApplicationException_Exception e)
{
e.printStackTrace();
}
above code works fine, when i run my application in Netbeans. But when i run my application from JAR file or as a web start, i am getting following error.
Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:218)
at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:161)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:99)
at javax.xml.ws.Service.<init>(Unknown Source)
at com.boeing.petstore.web.ws.ItemWebServiceService.<init>(ItemWebServiceService.java:43)
at com.boeing.patterns.petstore.widgets.WorkView.productSeleced(WorkView.java:113)
at com.boeing.patterns.petstore.widgets.ProductListView$1.run(ProductListView.java:92)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I verified my dist folder, all libraries are available in lib folder and all these jars in the classpath declaration of META-INF.MF file.
Dist Folder contains:
lib Folder
JNLP file
App Jar
Did anyone have idea about the above problem?
I too face the same problem kindly refer the below link this may help you
JAX-WS = When Apache CXF is installed it "steals" default JDK JAX-WS implementation, how to solve?

Solr setting up standalone zooKeeper

Im trying to setup solr cluster on jetty but with a separate standalone(not ensemble zookeeper). I manage to start zooKeeper, but I cannot upload config to zooKeeper - I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
ry
at org.apache.solr.common.cloud.SolrZkClient.<clinit>(SolrZkClient.java:
66)
at org.apache.solr.cloud.ZkCLI.main(ZkCLI.java:163)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
I use cloud-scripts - zkcli.bat. Any idea why???
You have to provide one of the various SLF4J implementation .jar files in the classpath..
Try adding slf4j-log4j12.jar and slf4j-api-1.6.6.jar to lib directory of Jetty.

Resources