[jboss-jira] [JBoss JIRA] Commented: (JBAS-5048) Lookup of resource bound via ExternalContext using a CompondName results in serialization of org.jnp.interfaces.FastNamingProperties

Mark van Holsteijn (JIRA) jira-events at lists.jboss.org
Fri Dec 28 08:42:43 EST 2007


    [ http://jira.jboss.com/jira/browse/JBAS-5048?page=comments#action_12393495 ] 
            
Mark van Holsteijn commented on JBAS-5048:
------------------------------------------

I have created a workaround for this particular issue: In the proxy provided by the nested class CachedContext,  I convert any parameter of the class javax.naming.Name by a Name as delivered by the NameParser associated with the external context. It does do the trick for cachedContexts. Hope this helps into providing a timely solution.


      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      {
         Object value = null;

         for(int i = 0; args != null && i < args.length; i++) {
        	 if(args[i] != null && args[i] instanceof Name) {
        		 try {
						Name n = parser.parse(args[i].toString());
						if(log.isDebugEnabled()) {
							log.debug("Replacing argument " + i + " of method '"
									+ method.getName()
									+ "' with ExternalContext Name, was '" + args[i].toString()
									+ "' replaced by '" + n.toString() + "'.");
						}
						
						args[i] = n;
					} catch (NamingException e) {
						log.warn("Failed to replace argument " + i + "(" + args[i].toString() + ") of method '"
								+ method.getName()
								+ "' with ExternalContext Name.", e);
					}
				}
         }


> Lookup of resource bound via ExternalContext using a CompondName results in serialization of org.jnp.interfaces.FastNamingProperties
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBAS-5048
>                 URL: http://jira.jboss.com/jira/browse/JBAS-5048
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Naming
>    Affects Versions: JBossAS-4.0.5.GA
>            Reporter: Mike Clark
>         Assigned To: Scott M Stark
>
> When a user registers resources using the org.jboss.naming.ExternalContext, they can only successfully lookup resources on the remote JNDI system if they first lookup the Context registered in the ExternalContext and then look up resources on the returned Context.  Looking up the full name results in the use of the org.jnp.interfaces.FastNamingProperties class which is not generally available on the remote JNDI implementation.
> So, for example, a user might register "external/foreign_jndi" using the ExternalContext.  Looking up resource, a/b/c as follows works:
> Context initialContext = new InitialContext();
> Context remoteContext = (Context) initialContext.lookup("external/foreign_jndi");
> Object obj = remoteContext.lookup("a/b/c");
> while, the more direct
> Context initialContext = new InitialContext();
> Object obj = initialContext.lookup("external/foreign_jndi/a/b/c");
> results in a "java.lang.ClassNotFoundException: org.jnp.interfaces.FastNamingProperties" exception on the remote JNDI system.
> It appears to occur because the FastNamingProperties class is used in the construction of the CompoundName in the org.jnp.interfaces.NamingParser.  So, in the first case, the parsing of "a/b/c" is handled by the foreign JNDI system, while in the latter, the CompoundName containing the FastNamingProperties is passed to the foreign JNDI system.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list