title: java.lang.ClassNotFoundException: javax.naming.Referenceable
body: <p>I have been trying to use activeMQ from an OSGi bundle and I have been running into some issues. I have been getting the one above now and I'm not sure what I need to do. Normally when I get this error it just means that you didn't import the package that you needed, but I have already added the javax.naming package in my manifest file.</p>
  
  <p>This is what my manifest file looks like.</p>
  
  <pre><code>Manifest-Version: 1.0
  Bundle-ManifestVersion: 2
  Bundle-Name: com.activemq.test
  Bundle-SymbolicName: com.activemq.test
  Bundle-Version: 1.0.0.qualifier
  Bundle-RequiredExecutionEnvironment: JavaSE-1.7
  Bundle-Activator: com.activemq.test.App
  Import-Package: javax.jms,
   javax.naming,
   org.osgi.framework
  Require-Bundle: ActiveMQExportTest;bundle-version="1.0.0"
  </code></pre>
  
  <p>I am running the activeMQ helloworld application that they provide on their website. It works great when I run it normally, but if you wrap it into an osgi bundle it starts to fail.</p>
  
  <p>Edit: I don't know if it's relevant, but the Required-Bundle is the activeMQ-all jar wrapped in a plugin to expose the packages that I need.</p>
  
  <p>Stack Trace. If you need something else, let me know.</p>
  
  <pre><code>[7/30/13 9:14:17:782 CDT] 00000018 LogService-64-com.ibm.ws.org.apache.aries.proxy.1.0.2        E CWWKE0701E: FrameworkEvent ERROR Bundle:com.ibm.ws.org.apache.aries.proxy.1.0.2(id=64) java.lang.ClassFormatError: Unexpected error from weaving hook.
      at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:74)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:600)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
      at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
      at java.lang.Class.forNameImpl(Native Method)
      at java.lang.Class.forName(Class.java:219)
      at org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.visit(AbstractWovenProxyAdapter.java:228)
      at org.objectweb.asm.ClassVisitor.visit(Unknown Source)
      at org.objectweb.asm.commons.SerialVersionUIDAdder.visit(Unknown Source)
      at org.apache.aries.proxy.impl.weaving.SyntheticSerialVerUIDAdder.visit(SyntheticSerialVerUIDAdder.java:60)
      at org.objectweb.asm.ClassReader.accept(Unknown Source)
      at org.objectweb.asm.ClassReader.accept(Unknown Source)
      at org.apache.aries.proxy.impl.weaving.WovenProxyGenerator.getWovenProxy(WovenProxyGenerator.java:54)
      at org.apache.aries.proxy.impl.weaving.ProxyWeavingHook.weave(ProxyWeavingHook.java:87)
      at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.call(WovenClassImpl.java:140)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1239)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1222)
      at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.callHooks(WovenClassImpl.java:182)
      at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:68)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:600)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
      at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
      at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
      at com.ibm.activemq.test.App$HelloWorldProducer.run(App.java:73)
      at java.lang.Thread.run(Thread.java:780)
  Caused by: java.lang.NoClassDefFoundError: javax.naming.Referenceable
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:632)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:607)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
      at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
      at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
      at java.lang.Class.forNameImpl(Native Method)
      at java.lang.Class.forName(Class.java:219)
      at org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.checkInterfacesForSerializability(AbstractWovenProxyAdapter.java:308)
      at org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.visit(AbstractWovenProxyAdapter.java:231)
      at org.objectweb.asm.ClassVisitor.visit(Unknown Source)
      at org.objectweb.asm.commons.SerialVersionUIDAdder.visit(Unknown Source)
      at org.apache.aries.proxy.impl.weaving.SyntheticSerialVerUIDAdder.visit(SyntheticSerialVerUIDAdder.java:60)
      at org.objectweb.asm.ClassReader.accept(Unknown Source)
      at org.objectweb.asm.ClassReader.accept(Unknown Source)
      at org.apache.aries.proxy.impl.weaving.WovenProxyGenerator.getWovenProxy(WovenProxyGenerator.java:54)
      at org.apache.aries.proxy.impl.weaving.ProxyWeavingHook.weave(ProxyWeavingHook.java:87)
      at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.call(WovenClassImpl.java:140)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1239)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1222)
      at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.callHooks(WovenClassImpl.java:182)
      at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:68)
      ... 40 more
  Caused by: java.lang.ClassNotFoundException: javax.naming.Referenceable
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
      at java.lang.ClassLoader.defineClassImpl(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
      ... 68 more
  </code></pre>
  
  <p>If anyone has any suggestions, I would gladly take them. Thanks!</p>