You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "selvatlc (via GitHub)" <gi...@apache.org> on 2023/10/02 14:24:00 UTC

[I] [Bug] Getting class not found exception when I try to initialise PulsarClient/PulsarAdmin [pulsar]

selvatlc opened a new issue, #21296:
URL: https://github.com/apache/pulsar/issues/21296

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Version
   
    
    **Environments**
    
   ```
    karaf - 4.4.3
   openjdk version "17.0.6" 2023-01-17
    Maven - 3.9.1
   ```
   
   **Used Dependencies**
   
   ```
           <dependency>
               <groupId>org.apache.pulsar</groupId>
               <artifactId>pulsar-client-all</artifactId>
               <version>3.1.0</version>
           </dependency>
   ```
   
   **Sample Snippet**
   
   ```
           pulsarAdmin = PulsarAdmin.builder().serviceHttpUrl(adminUrl).build();
           pulsarClient = PulsarClient.builder().serviceUrl(clientUrl).build();
   ```
   
   
   ### Minimal reproduce step
   
   When I try to execute the code by creating a normal JAR and execute it on terminal using java -jar <jar_file>, i'm getting valid response.
   
   If i create an OSGI bundle and installed my code on KARAF, i'm getting class not found exception. Need your help on this
   
   ### What did you expect to see?
   
   Pulsar client and admin should be created without making any errors
   
   ### What did you see instead?
   
   ```
   
   java.lang.ClassNotFoundException: org.apache.pulsar.client.api.PulsarClient not found by wrap_file__Users_kumarselvadg_.m2_repository_org_apache_pulsar_pulsar-client-all_3.1.0_pulsar-client-all-3.1.0.jar [201]
   	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)
   	at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
   	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
   	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
   	at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1358)
   	at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1612)
   	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1528)
   	at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
   	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
   	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
   	at java.base/java.lang.Class.forName0(Native Method)
   	at java.base/java.lang.Class.forName(Class.java:375)
   	at com.tlc.queue.internal.pulsar.PulsarService.start(PulsarService.java:67)
   	at com.tlc.queue.QueueAccess.start(QueueAccess.java:92)
   	at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:849)
   	at org.apache.felix.framework.Felix.activateBundle(Felix.java:2429)
   	at org.apache.felix.framework.Felix.startBundle(Felix.java:2335)
   	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006)
   	at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38)
   	at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65)
   	at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
   	at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
   	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
   	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
   	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599)
   	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
   	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
   	at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416)
   	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
   	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
   	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   	at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   
   
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] Getting class not found exception when I try to initialise PulsarClient/PulsarAdmin [pulsar]

Posted by "michalcukierman (via GitHub)" <gi...@apache.org>.
michalcukierman commented on issue #21296:
URL: https://github.com/apache/pulsar/issues/21296#issuecomment-1745338693

   The bug is not with the Pulsar Clients, but with the way you've created the bundle. Please check the answer I've provided you in the discussion you've opened.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] Getting class not found exception when I try to initialise PulsarClient/PulsarAdmin [pulsar]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #21296:
URL: https://github.com/apache/pulsar/issues/21296#issuecomment-1791792150

   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org