I am trying to connect to Cloud Bigtable; however, I'm getting issues with netty-tcnative not being found.
Maven dependencies:
<dependency>
<groupId>com.google.cloud.bigtable</groupId>
<artifactId>bigtable-hbase-1.2</artifactId>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork19</version>
</dependency>
Error output:
ERROR 2016-09-09 22:26:00,969 [main] com.google.cloud.bigtable.grpc.BigtableSession: Neither Jetty ALPN nor OpenSSL are available. OpenSSL unavailability cause:
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty-tcnative-osx-x86_64, netty-tcnative]
Exception in thread "BigtableSession-startup-2" java.lang.ExceptionInInitializerError
at com.google.cloud.bigtable.grpc.BigtableSession$3.run(BigtableSession.java:194)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:634)
at java.util.zip.ZipFile.getEntry(ZipFile.java:305)
at java.util.jar.JarFile.getEntry(JarFile.java:227)
at java.util.jar.JarFile.getJarEntry(JarFile.java:210)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:840)
at sun.misc.URLClassPath.getResource(URLClassPath.java:199)
at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.mule.module.launcher.FineGrainedControlClassLoader.findClass(FineGrainedControlClassLoader.java:175)
at org.mule.module.launcher.MuleApplicationClassLoader.findClass(MuleApplicationClassLoader.java:134)
at org.mule.module.launcher.FineGrainedControlClassLoader.loadClass(FineGrainedControlClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.google.bigtable.repackaged.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:36)
at com.google.bigtable.repackaged.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
at com.google.bigtable.repackaged.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
at com.google.bigtable.repackaged.io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:58)
at com.google.bigtable.repackaged.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:77)
at com.google.bigtable.repackaged.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:72)
at com.google.bigtable.repackaged.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:59)
at com.google.cloud.bigtable.grpc.BigtableSessionSharedThreadPools.init(BigtableSessionSharedThreadPools.java:85)
at com.google.cloud.bigtable.grpc.BigtableSessionSharedThreadPools.<init>(BigtableSessionSharedThreadPools.java:77)
at com.google.cloud.bigtable.grpc.BigtableSessionSharedThreadPools.<clinit>(BigtableSessionSharedThreadPools.java:45)
... 4 more
Exception in thread "BigtableSession-startup-1" java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:634)
at java.util.zip.ZipFile.getEntry(ZipFile.java:305)
at java.util.jar.JarFile.getEntry(JarFile.java:227)
at java.util.jar.JarFile.getJarEntry(JarFile.java:210)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:840)
at sun.misc.URLClassPath.getResource(URLClassPath.java:199)
at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.mule.module.launcher.FineGrainedControlClassLoader.findClass(FineGrainedControlClassLoader.java:175)
at org.mule.module.launcher.MuleApplicationClassLoader.findClass(MuleApplicationClassLoader.java:134)
at org.mule.module.launcher.FineGrainedControlClassLoader.loadClass(FineGrainedControlClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.google.bigtable.repackaged.com.google.api.client.http.javanet.NetHttpTransport$Builder.trustCertificates(NetHttpTransport.java:270)
at com.google.bigtable.repackaged.com.google.api.client.googleapis.javanet.GoogleNetHttpTransport.newTrustedTransport(GoogleNetHttpTransport.java:55)
at com.google.cloud.bigtable.config.CredentialFactory.getHttpTransport(CredentialFactory.java:94)
at com.google.cloud.bigtable.grpc.BigtableSession$2.run(BigtableSession.java:183)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
This issue was due to Mule's class loader. Mule runs each app in its own class loader. Need to move this to Mule's common class loader (java.class.path), rather than the app class loader. Ensuring both BigTable client library and tcnative is in the same classpath.
This issue would arise in other containers such as Tomcat, as they follow similar class loader patterns.
Related
I am trying to encrypt / decrypt messages using libvibesimplejava.so of 6.21 version where I have added the dependencies to load the jar from system path when I deployed to dev instance it's throwing this error:
Caused by: java.lang.NoClassDefFoundError: com/voltage/securedata/enterprise/VeException
Caused by: java.lang.ClassNotFoundException: com.voltage.securedata.enterprise.VeException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_181]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_181]
Below is the code for library instantiation
Loading Library -
static {
System.load("src/main/resources/****/libvibesimplejava.so");
}
Library context instanitiation -
LibraryContext library = new LibraryContext.Builder()
.setPolicyURL(policyURL)
.setFileCachePath(cachePath)
.setTrustStorePath(trustStorePath)
.setClientIdProduct("****",
"***")
.build();
Pom file -
<dependency>
<groupId>vibesimplejava</groupId>
<artifactId>vibesimplejava</artifactId>
<version>6.21.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/****/lib/vibesimplejava.jar</systemPath>
</dependency>
Why it is failing to load the class in dev? Could any one suggest me the way to resolve this issue?
I am able to compile my code and run it in my local (windows) machine using Eclipse. However, when I do it on my remote (ubuntu) machine, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
at com.tools.App.main(App.java:36)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
I have added the following entry in my pom.xml file:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
Can someone please help me understand what else I need to do to get this working? Thanks.
that means the jar is available at compile time but when you are running your application this jar isn't present in classpath and so the error
Try to look into the build path of your project and see if commons-io artifact is present there in the build path.
I am using Twilio to send SMS messages from my web app and I have almost completed the integration. It's sending the SMS, but an error is being generated and I don't understand why. I have included a JSON dependency from this json and this file link but I'm still getting an error. Which other jar do I need to include?
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonParseException
at com.twilio.sdk.TwilioRestResponse.getParser(TwilioRestResponse.java:225)
at com.twilio.sdk.TwilioRestResponse.toMap(TwilioRestResponse.java:243)
at com.twilio.sdk.resource.list.SmsList.create(SmsList.java:70)
at Example.main(Example.java:25)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 4 more
screenshot showing json added
Update this is the new screesnshot
You have missed jackson-core-asl.jar 1.9.13 in you project. You can make use of this Maven POM dependency
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
Hope this solves your problem. Check this link for more information. Direct link for download
Class is present in the jar Screen below
Remove your java-json.jar and add the jackson-core-asl.jar
I'm trying to integrate scribe-java and write a Jenkins Plugin for it, but it seems Jenkins can't be used with Class? Does anyone know why is this?
Jenkins Plugin code:
OAuthService service =
new ServiceBuilder().provider( com.lookout.jenkins.publishoverbox.BoxApi20.class ).apiKey( clientId ).apiSecret(clientSecret ).callback(callbackUrl).grantType( OAuthConstants.AUTHORIZATION_CODE ).build();
Log:
SEVERE: Failed to create Guice container from all the plugins
com.google.common.collect.ComputationException: java.lang.NoClassDefFoundError: Lorg/scribe/oauth/OAuthService;
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:397)
at com.google.inject.internal.FailableCache.get(FailableCache.java:49)
at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:66)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:73)
at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:36)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:38)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)
at com.google.inject.internal.FailableCache.get(FailableCache.java:49)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:127)
at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:506)
at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:171)
at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:123)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
at com.google.inject.Guice.createInjector(Guice.java:94)
at com.google.inject.Guice.createInjector(Guice.java:71)
at hudson.ExtensionFinder$GuiceFinder.<init>(ExtensionFinder.java:282)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at net.java.sezpoz.IndexItem.instance(IndexItem.java:181)
at hudson.ExtensionFinder$Sezpoz._find(ExtensionFinder.java:625)
at hudson.ExtensionFinder$Sezpoz.find(ExtensionFinder.java:600)
at hudson.ExtensionFinder._find(ExtensionFinder.java:151)
at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:318)
at hudson.ExtensionList.load(ExtensionList.java:295)
at hudson.ExtensionList.ensureLoaded(ExtensionList.java:248)
at hudson.ExtensionList.iterator(ExtensionList.java:138)
at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:311)
at hudson.ExtensionList.load(ExtensionList.java:295)
at hudson.ExtensionList.ensureLoaded(ExtensionList.java:248)
at hudson.ExtensionList.get(ExtensionList.java:153)
at hudson.PluginManager$PluginUpdateMonitor.getInstance(PluginManager.java:1066)
at hudson.maven.PluginImpl.init(PluginImpl.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at hudson.init.InitializerFinder.invoke(InitializerFinder.java:120)
at hudson.init.InitializerFinder$TaskImpl.run(InitializerFinder.java:184)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
at jenkins.model.Jenkins$7.runTask(Jenkins.java:888)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoClassDefFoundError: Lorg/scribe/oauth/OAuthService;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2300)
at java.lang.Class.getDeclaredFields(Class.java:1745)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:651)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:358)
at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:91)
at com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:35)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:43)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:40)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:38)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)
... 56 more
Caused by: java.lang.ClassNotFoundException: org.scribe.oauth.OAuthService
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 71 more
Jun 3, 2013 11:37:17 AM jenkins.InitReactorRunner$1 onAttained
What ever you need in your plugin, you specify the same in dependencies.
Reason 1:
Jenkins loads each plugin into a separate class loader to avoid conflicts. Plugins can then participate to the system activities just like other Jenkins built-in classes do. They can participate in XStream-based persistence, they can provide "views" by Jelly, they can provide static resources like images, and from users, everything works seamlessly --- there's no distinction between functionalities that are built-in vs those from plugins.
Reason 2: You don't want to change your code when jenkins change their dependencies.
I have the following errors when i try to run my Netbeans aplication of a map reduce algorithm:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.apache.hadoop.mapred.JobConf.<clinit>(JobConf.java:349)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1121)
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:72)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:125)
at org.apache.hadoop.security.Groups.<init>(Groups.java:54)
at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:142)
at
org.apache.hadoop.security.UserGroupInformation.initUGI(UserGroupInformation.java:243)
at
org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation
.java:216)
at
org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation
.java:207)
at
org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroup
Information.java:286)
at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroup
Information.java:500)
at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroup
Information.java:483)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:73)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:133)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:138)
at cloudex.CloudEx.main(CloudEx.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 19 more
Could you please give me a hint on how to get rid of it? i do not know what it generates it
You need to add the log4j jar to your classpath.
Either add the log4j class to your classpath as #smcg has stated, or add the following into your project pom.xml if you're using maven.
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
Download Apache log4j *.jar file at log4j. Import external *.jar file to your project.