users@glassfish.java.net

[gf-users] Configuring EJBs within a WAR

From: Lachezar Dobrev <l.dobrev_at_gmail.com>
Date: Thu, 11 Sep 2014 17:19:45 +0300

  Hello,
  I'm struggling with elementary stuff here.

  I have a WAR packaged application with @Stateless inside.
  I am trying to make them configurable when the application is
installed in a Glassfish server.


  package com.company;

  @Stateless
  public class ServiceEJB implements Service {
    @Resource
    private String link;

    @Override
    public void sendHelloWorld() {
      // Hit the remote service
      new URL(link).openStream().close();
    }
  }


  The EJB is called by a servlet.

  I am unable to configure the link field.
  Tried:
  asadmin set-web-env-entry ... link
  asadmin set-web-env-entry ... com.company.ServiceEJB/link
  asadmin create-custom-resource ... link
  asadmin create-custom-resource ... com.company.ServiceEJB/link

  None of these seem to have any effect on the situation.

  Please advise.