title: War won't deploy "Unresolved <ejb-link>" Glassfish 3, Netbeans 7
body: <p>I have enterprise application with ejb and war module, and since I created local interface web module wont deploy. It builds fine. EJB project is referenced inside web project.</p>
  
  <p>Also when I delete <code>&lt;ejb-local-ref&gt;</code> from web.xml it deploys, but then lookup method fails.</p>
  
  <p>Glassfish error:</p>
  
  <blockquote>
    <p>SEVERE: Exception while deploying the app [Projekat-war] : Error: Unresolved &lt;ejb-link>: Projekat-ejb.jar#ZaWebSessionBean</p>
  </blockquote>
  
  <p>Simple interface:</p>
  
  <pre><code>@Local
  public interface ZaWebSessionBeanLocal {
  
      String vrati(String str);
  
  }
  
  @Stateless
  public class ZaWebSessionBean implements ZaWebSessionBeanLocal {
  
      @Override
      public String vrati(String str) {
          return "vrati";
      }
  
      // Add business logic below. (Right-click in editor and choose
      // "Insert Code &gt; Add Business Method")
  
  
  }
  </code></pre>
  
  <p>And web.xml</p>
  
  <pre><code>&lt;ejb-local-ref&gt;
      &lt;ejb-ref-name&gt;ZaWebSessionBean&lt;/ejb-ref-name&gt;
      &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt;
      &lt;local&gt;za_web.ZaWebSessionBeanLocal&lt;/local&gt;
      &lt;ejb-link&gt;Projekat-ejb.jar#ZaWebSessionBean&lt;/ejb-link&gt;
  &lt;/ejb-local-ref&gt;
  </code></pre>
  
  <p>Lookup method (generated) :</p>
  
  <pre><code>public class HeaderBean {
      ZaWebSessionBeanLocal zaWebSessionBean = lookupZaWebSessionBeanLocal();
  
      private ZaWebSessionBeanLocal lookupZaWebSessionBeanLocal() {
          try {
              Context c = new InitialContext();
              return (ZaWebSessionBeanLocal) c.lookup("java:global/Projekat/Projekat-ejb/ZaWebSessionBean!za_web.ZaWebSessionBeanLocal");
          } catch (NamingException ne) {
              Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
              throw new RuntimeException(ne);
          }
      }
  </code></pre>
  
  <p>Full log:</p>
  
  <pre><code>SEVERE: Exception while deploying the app [Projekat-war] : Error: Unresolved &lt;ejb-link&gt;: Projekat-ejb.jar#ZaWebSessionBean
  SEVERE: Unresolved &lt;ejb-link&gt;: Projekat-ejb.jar#ZaWebSessionBean
  SEVERE: Exception while deploying the app [Projekat-war]
  SEVERE: Error: Unresolved &lt;ejb-link&gt;: Projekat-ejb.jar#ZaWebSessionBean
  java.lang.RuntimeException: Error: Unresolved &lt;ejb-link&gt;: Projekat-ejb.jar#ZaWebSessionBean
      at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:724)
      at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:2004)
      at com.sun.enterprise.deployment.Application.visit(Application.java:1777)
      at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:195)
      at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:185)
      at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:94)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:827)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:769)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
      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:849)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
      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:619)
  
  SEVERE: Exception while deploying the app [Projekat-war] : Error: Unresolved &lt;ejb-link&gt;: Projekat-ejb.jar#ZaWebSessionBean
  </code></pre>