Search in sources :

Example 56 with NameNotFoundException

use of javax.naming.NameNotFoundException in project wildfly by wildfly.

the class MetadataCompleteCustomDescriptorTestCase method testAnnotated.

@Test
public void testAnnotated() throws NamingException {
    final InitialContext ctx = new InitialContext();
    try {
        final AnnotatedGreeterBean bean = (AnnotatedGreeterBean) ctx.lookup("java:global/ejb-descriptor-test/AnnotatedGreeter!org.jboss.as.test.integration.ejb.descriptor.AnnotatedGreeterBean");
        fail("The annotated bean should not be available");
    } catch (NameNotFoundException e) {
    // good
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Example 57 with NameNotFoundException

use of javax.naming.NameNotFoundException in project wildfly by wildfly.

the class SimpleSLSB method isUnInjectedStringEnvEntryPresentInEnc.

public boolean isUnInjectedStringEnvEntryPresentInEnc() {
    Context ctx = null;
    try {
        ctx = new InitialContext();
        ctx.lookup("java:comp/env/missingEnvEntryValStringResource");
        return true;
    } catch (NameNotFoundException nnfe) {
        return false;
    } catch (NamingException ne) {
        throw new RuntimeException(ne);
    }
}
Also used : InitialContext(javax.naming.InitialContext) DirContext(javax.naming.directory.DirContext) SessionContext(javax.ejb.SessionContext) Context(javax.naming.Context) LdapContext(javax.naming.ldap.LdapContext) NameNotFoundException(javax.naming.NameNotFoundException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext)

Example 58 with NameNotFoundException

use of javax.naming.NameNotFoundException in project wildfly by wildfly.

the class SimpleSLSB method isUnInjectedIntEnvEntryPresentInEnc.

public boolean isUnInjectedIntEnvEntryPresentInEnc() {
    Context ctx = null;
    try {
        ctx = new InitialContext();
        ctx.lookup("java:comp/env/missingEnvEntryValIntResource");
        return true;
    } catch (NameNotFoundException nnfe) {
        return false;
    } catch (NamingException ne) {
        throw new RuntimeException(ne);
    }
}
Also used : InitialContext(javax.naming.InitialContext) DirContext(javax.naming.directory.DirContext) SessionContext(javax.ejb.SessionContext) Context(javax.naming.Context) LdapContext(javax.naming.ldap.LdapContext) NameNotFoundException(javax.naming.NameNotFoundException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext)

Example 59 with NameNotFoundException

use of javax.naming.NameNotFoundException in project wildfly by wildfly.

the class OptionalEnvEntryBean method checkLookup.

public void checkLookup() {
    try {
        InitialContext ctx = new InitialContext();
        ctx.lookup("java:comp/env/entry");
        throw new RuntimeException("Should have thrown a NameNotFoundException");
    } catch (NameNotFoundException e) {
    // okay
    } catch (NamingException e) {
        throw new RuntimeException(e);
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext)

Example 60 with NameNotFoundException

use of javax.naming.NameNotFoundException in project wildfly by wildfly.

the class AbstractCustomDescriptorTests method test1.

@Test
public void test1() throws NamingException {
    final InitialContext ctx = new InitialContext();
    try {
        final DescriptorGreeterBean bean = (DescriptorGreeterBean) ctx.lookup("java:global/ejb-descriptor-test/DescriptorGreeter!org.jboss.as.test.integration.ejb.descriptor.DescriptorGreeterBean");
        final String name = "test1";
        final String result = bean.greet(name);
        assertEquals("Hi test1", result);
    } catch (NameNotFoundException e) {
        fail(e.getMessage());
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Aggregations

NameNotFoundException (javax.naming.NameNotFoundException)168 NamingException (javax.naming.NamingException)81 InitialContext (javax.naming.InitialContext)75 Context (javax.naming.Context)71 Reference (javax.naming.Reference)40 Test (org.junit.Test)39 NotContextException (javax.naming.NotContextException)35 Name (javax.naming.Name)34 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)33 OperationNotSupportedException (javax.naming.OperationNotSupportedException)29 CompositeName (javax.naming.CompositeName)27 Binding (javax.naming.Binding)22 CompoundName (javax.naming.CompoundName)16 LinkRef (javax.naming.LinkRef)16 IOException (java.io.IOException)12 NamingContext (org.eclipse.jetty.jndi.NamingContext)12 ArrayList (java.util.ArrayList)10 InvalidNameException (javax.naming.InvalidNameException)10 Attributes (javax.naming.directory.Attributes)10 HashMap (java.util.HashMap)7