glassfish
  1. glassfish
  2. GLASSFISH-7228

CustomResource created with AMX API is not usable

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 9.1.1
    • Fix Version/s: V3
    • Component/s: amx
    • Labels:
      None
    • Environment:

      Operating System: Linux
      Platform: Linux

    • Issuezilla Id:
      7,228

      Description

      I tried to add a CustomResource via the AMX API. This CustomResource throws
      javax.naming.NameNotFoundException when trying to access it.

      The problem can be reproduced by creating a CustomResource with the Class below
      and than go the Glassfish Administration Console and try to save this Resource
      again.

      In the Glassfish log the following Exception can be found:
      javax.naming.NameNotFoundException: test not found
      at
      com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
      at
      com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
      at
      com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
      at
      com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)

      .
      .
      .

      I used the following class to create a CustomResource:

      public class CreateCustomResource {

      public static void main( String[] args ) {
      AppserverConnectionSource connection = Connect.connectNoTLS(
      "localhost",
      "10086",
      "admin",
      "geheim );

      DomainConfig domainConfig = connection.getDomainRoot().getDomainConfig();
      CustomResourceConfig customResource;
      try

      { customResource = domainConfig.createCustomResourceConfig( "test", "test", "test", null ); }

      catch( UndeclaredThrowableException e )

      { e.printStackTrace(); }

      }
      }

        Activity

        Hide
        jthoennes added a comment -

        Anything planned for GF v2.1.1?

        The AMX API is great, but due to this bug it is unusable.

        Show
        jthoennes added a comment - Anything planned for GF v2.1.1? The AMX API is great, but due to this bug it is unusable.
        Hide
        jthoennes added a comment -

        Hello Lloyd,

        please could you comment on this? Can we expect some improvement for GF v2.1.1?

        We were happy to find the AMX interface since it seemed to allow us to create
        custom resources using the Java API. But since the Glassfish does not pick up
        resources created in this way, we had to go back and use the asadmin interface
        and scripts started from Java programs... ugghh

        Would be happy to hear anything from you.

        Thanks, Jörg

        Show
        jthoennes added a comment - Hello Lloyd, please could you comment on this? Can we expect some improvement for GF v2.1.1? We were happy to find the AMX interface since it seemed to allow us to create custom resources using the Java API. But since the Glassfish does not pick up resources created in this way, we had to go back and use the asadmin interface and scripts started from Java programs... ugghh Would be happy to hear anything from you. Thanks, Jörg
        Hide
        llc added a comment -

        Please examine what has actually been created in domain.xml. Is it a legal custom resource or not? If it is
        legal, then the problem does not lie with AMX. If it's not legal, is that because of the way it was created? It
        seems odd that AMX would have a direct bug; it creates such things generically. Could be a calling error.

        In general, I am not woking on V2 at this point and won't be unless this bug is escalated and I'm tasked to
        do so.

        Show
        llc added a comment - Please examine what has actually been created in domain.xml. Is it a legal custom resource or not? If it is legal, then the problem does not lie with AMX. If it's not legal, is that because of the way it was created? It seems odd that AMX would have a direct bug; it creates such things generically. Could be a calling error. In general, I am not woking on V2 at this point and won't be unless this bug is escalated and I'm tasked to do so.
        Hide
        foonotic added a comment -

        Hi,
        thanks for the answer. I have created two custom resources, one over the
        AdminConsole and one over AMX.
        The custom resource tag generated is the same for both:

        <custom-resource enabled="true" factory-class="Test1" jndi-name="Test1"
        object-type="user" res-type="Test1">
        <description>entered via admin console</description>
        </custom-resource>

        <custom-resource enabled="true" factory-class="Test2" jndi-name="Test2"
        object-type="user" res-type="Test2">
        <description>entered via AMX</description>
        </custom-resource>

        However I did not found a resource reference in the servers tag for the
        Resource generated via AMX.

        <servers>
        <server config-ref="server-config" lb-weight="100" name="server">
        <resource-ref enabled="true" ref="Test1"/>
        </server>
        </servers>

        When I enter the missing resource-ref manually everything works.

        The question now is shouldn't the createCustomResourceConfig method register my
        Resource at the server tag or is there an other way to create the missing entry
        in the domain xml?

        thanks in advance

        Marcel

        Show
        foonotic added a comment - Hi, thanks for the answer. I have created two custom resources, one over the AdminConsole and one over AMX. The custom resource tag generated is the same for both: <custom-resource enabled="true" factory-class="Test1" jndi-name="Test1" object-type="user" res-type="Test1"> <description>entered via admin console</description> </custom-resource> <custom-resource enabled="true" factory-class="Test2" jndi-name="Test2" object-type="user" res-type="Test2"> <description>entered via AMX</description> </custom-resource> However I did not found a resource reference in the servers tag for the Resource generated via AMX. <servers> <server config-ref="server-config" lb-weight="100" name="server"> <resource-ref enabled="true" ref="Test1"/> </server> </servers> When I enter the missing resource-ref manually everything works. The question now is shouldn't the createCustomResourceConfig method register my Resource at the server tag or is there an other way to create the missing entry in the domain xml? thanks in advance Marcel
        Hide
        llc added a comment -

        AMX doesn't auto-add references. Remember that resources and applications are in a global area under
        the domain. You will need to add the reference yourself.

        Consider, for example, a domain with multiple servers and clusters. There are only two reasonable
        actions: no refs (safe) and refs for all those servers/clusters (not a good idea).

        Show
        llc added a comment - AMX doesn't auto-add references. Remember that resources and applications are in a global area under the domain. You will need to add the reference yourself. Consider, for example, a domain with multiple servers and clusters. There are only two reasonable actions: no refs (safe) and refs for all those servers/clusters (not a good idea).
        Hide
        jthoennes added a comment -

        Where is explained how to add such references?

        Please outline the missing steps. Is there any documentation how to do this?

        Thanks, Jörg

        Show
        jthoennes added a comment - Where is explained how to add such references? Please outline the missing steps. Is there any documentation how to do this? Thanks, Jörg

          People

          • Assignee:
            llc
            Reporter:
            foonotic
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: