title: java.lang.ClassNotFoundException: org.elasticsearch.common.transport.TransportAddress
body: <p>I am trying to use elasticsearch in my J2EE application but I am getting <code>java.lang.ClassNotFoundException: org.elasticsearch.common.transport.TransportAddress</code> during deployment to Glassfish 3.1. IntelliJ shows no error during compilation.</p>
  
  <p>I use maven with dependency in pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.elasticsearch&lt;/groupId&gt;
      &lt;artifactId&gt;elasticsearch&lt;/artifactId&gt;
      &lt;version&gt;1.0.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>This happens when use this code in my project:</p>
  
  <pre><code>Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 9200));
  </code></pre>
  
  <p>I took look into elasticsearch-1.0.0.jar used by maven and found that TransportAddress is interface. Probably the whole library it not being put into glassfish.</p>
  
  <p>Here is complete stacktrace:</p>
  
  <pre><code>[#|2014-02-18T15:05:00.963+0100|INFO|glassfish3.1.2|org.jboss.weld.ClassLoading|_ThreadID=51;_ThreadName=Thread-2;|catching
  org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class modules.core.service.CmsViewerServiceImpl
      at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:167)
      at org.jboss.weld.bootstrap.BeanDeployer.loadWeldClass(BeanDeployer.java:108)
      at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:79)
      at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123)
      at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:350)
      at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:179)
      at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
      at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:277)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
      at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
      at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
      at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
      at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
      at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/common/transport/TransportAddress
      at java.lang.Class.getDeclaredFields0(Native Method)
      at java.lang.Class.privateGetDeclaredFields(Class.java:2317)
      at java.lang.Class.getDeclaredFields(Class.java:1762)
      at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:105)
      at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:102)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:63)
      at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:102)
      at org.jboss.weld.introspector.jlr.WeldClassImpl.&lt;init&gt;(WeldClassImpl.java:154)
      at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:119)
      at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:59)
      at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:50)
      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 org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:163)
      ... 37 more
  Caused by: java.lang.ClassNotFoundException: org.elasticsearch.common.transport.TransportAddress
      at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:808)
      at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      ... 55 more
  |#]
  </code></pre>
  
  <p>Is there something I am missing? Should I add elasticsearch library somehow manually to glassfish?</p>
  
  <p>Thank you for suggestions.</p>