Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Can Jetty user bind JNDI by themselves?

Hi,

 

Thanks a lot for your reply!

 

Then how can I bind a resource to a tree like name, such as “a/b/c”, please? We’re trying merge from Weblogic to Jetty, and seems something different between Weblogic and Jetty on the JNDI name binding…

 

Thanks!

 

Lin

 

From: Joakim Erdfelt [mailto:joakim@xxxxxxxxxxx]
Sent: 2018
49 20:23
To: JETTY user mailing list
Subject: Re: [jetty-users] Can Jetty user bind JNDI by themselves?

 

That error tells you that "/event_channel" doesn't exist.

 

You are trying to bind "/event_channel/${serverName}" before the parent even exists.

 


Joakim Erdfelt / joakim@xxxxxxxxxxx

 

On Sat, Apr 7, 2018 at 9:41 PM, Lin Ren <lin.ren@xxxxxxxxxx> wrote:

Hi,

 

I’m currently trying to bind a JNDI by myself in the Bean code (not in the application), code is like below:

 

   try {

      // Bind receiver under server name

      jndiName = WlngContext.getInstance().getServerName();

final String JNDI_PREFIX = "event_channel/";

      fullJndiName = JNDI_PREFIX + jndiName;

      namingContext = new InitialContext();

      localReceiver = new EventReceiverImpl(this);

      namingContext.bind(fullJndiName, localReceiver);

      eventContext = (EventContext) namingContext.createSubcontext(JNDI_PREFIX);

      namingListener = new EventReceiversListener(this);

      eventContext.addNamingListener("", EventContext.ONELEVEL_SCOPE, namingListener);

      refreshCachedEventReceivers();

    } catch (Exception e) {

      // Cleanup what we've done before throwing exception

      System.out.println("================================" + e.getMessage());

      e.printStackTrace();

      deactivate();

      throw e;

    }

 

And I got an exception said that:

 

javax.naming.NameNotFoundException: event_channel is not bound

         at org.eclipse.jetty.jndi.local.localContextRoot.bind(localContextRoot.java:608)

         at org.eclipse.jetty.jndi.local.localContextRoot.bind(localContextRoot.java:547)

         at javax.naming.InitialContext.bind(InitialContext.java:425)

         at com.bea.wlcp.wlng.event_channel.rmi.EventBroadcasterRmi.activate(EventBroadcasterRmi.java:54)

 

My question here is, can we bind JNDI by ourselves? If yes, how can we do for that?

 

Thanks!

 

Lin

 


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

 


Back to the top