Question

I have an ejb deployed on weblogic. I am able to successfully get the remote reference via a simple java client. However when I hit the ejb via my web application it throws the below exception:

javax.naming.CommunicationException [Root exception is weblogic.socket.UnrecoverableConnectException: [Login failed for an unknown reason: HTTP/1.1 404 Not Found]]
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
    at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:783)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:367)
    at weblogic.jndi.Environment.getContext(Environment.java:315)
    at weblogic.jndi.Environment.getContext(Environment.java:285)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)

I am not sure why the protocol is HTTP, i am using t3. Here's my code:

Properties serverProperties = new Properties();
        serverProperties.put("java.naming.provider.url", "t3://localhost:3080");
        serverProperties.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");

        InitialContext context = new InitialContext(serverProperties);
Was it helpful?

Solution

I suspect your weblogic listen address is configured with your server's hostname. See the following article: http://docs.oracle.com/cd/E17904_01/web.1111/e13709/setup.htm

Specifically it says:

Localhost Considerations

If you identify a server instance's listen address as localhost, non-local processes will not be able to connect to the server instance. Only processes on the machine that hosts the server instance will be able to connect to the server instance. If the server instance must be accessible as localhost (for instance, if you have administrative scripts that connect to localhost), and must also be accessible by remote processes, leave the listen address blank. The server instance will determine the address of the machine and listen on it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top