Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] javax.naming.NamingException: This context is immutable; remaining name 'env'


little correction

new InitialContext().lookup("java:comp/env/jms/FS_CF");



Nikolas.Falco@xxxxxxxxxxxx
Sent by: jetty-users-bounces@xxxxxxxxxxx

23/07/2010 09.27

Please respond to
JETTY user mailing list <jetty-users@xxxxxxxxxxx>

To
JETTY user mailing list <jetty-users@xxxxxxxxxxx>
cc
Subject
Re: [jetty-users] javax.naming.NamingException: This context is        immutable; remaining name 'env'






Seem that you register a resourse with server scope but you lookup with application scope.

Or you do a lookup of jms/
connectionFactory
or in the jetty-env.xml register jndi.Resource with argument0 webappcontext reference.


<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext">

...

       <New class="org.eclipse.jetty.plus.jndi.Resource">

               <Arg><Ref id='wac' /></Arg>

               <Arg>jms/FS_CF</Arg>

               <Arg>

                       <New class="org.apache.activemq.ActiveMQXAConnectionFactory">

                               <Arg>vm://BROKER?broker.persistent=false</Arg>

                       </New>

               </Arg>

       </New>

...


new InitialContext().lookup("java:/comp/env/jms/FS_CF");



Don Santillan <donzymeth@xxxxxxxxx>
Sent by: jetty-users-bounces@xxxxxxxxxxx

22/07/2010 18.37

Please respond to
JETTY user mailing list <jetty-users@xxxxxxxxxxx>

To
JETTY user mailing list <jetty-users@xxxxxxxxxxx>
cc
Subject
[jetty-users] javax.naming.NamingException: This context is immutable; remaining name 'env'







Hello,

I was just able to make JNDI work on my project. I am using jetty
7.1.4.v20100610.

On JETTY_HOME/etc/jetty.xml, I added an ActiveMQConnectionFactory that
will be looked up from the code:

  <New id="cf" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg><Ref id="Server"/></Arg>
    <Arg>jms/connectionFactory</Arg>
    <Arg>
      <New class="org.apache.activemq.ActiveMQConnectionFactory">
        <Arg>tcp://localhost:61616</Arg>
      </New>
    </Arg>
  </New>

and looked up as

      InitialContext context = null;
      ConnectionFactory connectionFactory = null;
      try {
          context = new InitialContext();
          connectionFactory =
(ConnectionFactory)context.lookup("java:comp/env/jms/connectionFactory");
      } catch (NamingException e) {
          logger.error("initConnection", e);
      }

This is actually working on every jetty server restart.

Problem starts when I do a redeploy of the WAR app that does the looking
up for ActiveMQConnectionFactory. I use cargo for redeployment. Cargo
successfully redeploys the WAR file but right after the deployment, I
get this from jetty's log:

javax.naming.NamingException: This context is immutable; remaining name
'env'
  at
org.eclipse.jetty.jndi.NamingContext.createSubcontext(NamingContext.java:432)
  at
org.eclipse.jetty.jndi.NamingContext.createSubcontext(NamingContext.java:515)
  at
org.eclipse.jetty.plus.webapp.EnvConfiguration.createEnvContext(EnvConfiguration.java:203)
  at
org.eclipse.jetty.plus.webapp.EnvConfiguration.preConfigure(EnvConfiguration.java:62)
  at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:379)
  at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
  at
org.codehaus.cargo.deployer.jetty.DeployerServlet.deployArchive(DeployerServlet.java:258)
  at
org.codehaus.cargo.deployer.jetty.DeployerServlet.doPut(DeployerServlet.java:192)

At first I thought that this was just being caused by hot deployment and
redeploy raise condition, but it was not. The deployed app is not
working not until I do a manual jetty server restart which after that,
everything works fine again.

Any ideas?

Thanks in advance.
-don
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top