You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "praveen Vijayan (JIRA)" <ji...@apache.org> on 2012/07/02 00:11:43 UTC

[jira] [Created] (AXIS2-5354) JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.

praveen Vijayan created AXIS2-5354:
--------------------------------------

             Summary: JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.
                 Key: AXIS2-5354
                 URL: https://issues.apache.org/jira/browse/AXIS2-5354
             Project: Axis2
          Issue Type: Bug
          Components: jaxws
    Affects Versions: 1.6.2
         Environment: JDK 1.6, Tomcat 7
            Reporter: praveen Vijayan


I am facing a problem with JNDI lookup when we moved our JAX-WS based web service from Axis2 1.6.1 to axis 1.6.2 library.

Following is the exception that gets thrown from the Impl class :

Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    

The service runs on Tomcat 7 (JDK 6) and deployed as a WAR application. It was working fine (i.e. it was able to lookup the name) when I was using 1.6.1 version of axis jar.I have declared the JNDI resource names in context.xml.The problem started when I discarded 1.6.1 jars and started using 1.6.2 Axis2 jars.

It looks like the issue is happening due to Thread Context Class Loader (TCCL) setting in JAXWSMessageReceiver.java.Here is the block of code that I suspect is causing the issue for us.

        AxisService service = axisRequestMsgCtx.getAxisService();
        // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
        // services, there can be situations where we have to load classes from the deployment
        // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
        // artifact. Adding this as a fix for AXIS2-4930.
        setContextClassLoader(service.getClassLoader());
        
I think when the service class's class loader is set as TCCL, the JNDI object present in WebAppClassLoader become invisible to the current TCCL. If I comment 'setContextClassLoader(...)' statement the JNDI lookup passes (i.e. it works fine.).



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Commented] (AXIS2-5354) JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.

Posted by "praveen Vijayan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13406752#comment-13406752 ] 

praveen Vijayan commented on AXIS2-5354:
----------------------------------------

Hi, 
I have created a sample jaxws web service to replicate the issue. In getConnection() method in the Impl class (BookingWebServiceImpl.java), we have the following block of code.

                       
				Context initialContext = new InitialContext();
				DataSource datasource = (DataSource) initialContext
						.lookup(dataSourceName);


initialContext.lookup() method throws "Name java:comp is not bound in this Context" when we use the latest Axis2 1.6.2 jars. As I mentioned in my comment above if we comment the following line JAXWSMessageReceiver.java (which I understand is not a fix and it will break something else), the lookup works fine.
                             setContextClassLoader(service.getClassLoader()); 

Please let me know if I can provide any additional information that can help you replicate the issue.

Thanks,
Praveen
praveenv_cs@yahoo.com
                
> JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.
> -------------------------------------------------------------
>
>                 Key: AXIS2-5354
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5354
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws
>    Affects Versions: 1.6.2
>         Environment: JDK 1.6, Tomcat 7
>            Reporter: praveen Vijayan
>         Attachments: SampleRequest_and_endpointURL.txt, SampleTestWS.zip, log_stackTrace.txt, server.xml
>
>
> I am facing a problem with JNDI lookup when we moved our JAX-WS based web service from Axis2 1.6.1 to axis 1.6.2 library.
> Following is the exception that gets thrown from the Impl class :
> Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     
> The service runs on Tomcat 7 (JDK 6) and deployed as a WAR application. It was working fine (i.e. it was able to lookup the name) when I was using 1.6.1 version of axis jar.I have declared the JNDI resource names in context.xml.The problem started when I discarded 1.6.1 jars and started using 1.6.2 Axis2 jars.
> It looks like the issue is happening due to Thread Context Class Loader (TCCL) setting in JAXWSMessageReceiver.java.Here is the block of code that I suspect is causing the issue for us.
>         AxisService service = axisRequestMsgCtx.getAxisService();
>         // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
>         // services, there can be situations where we have to load classes from the deployment
>         // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
>         // artifact. Adding this as a fix for AXIS2-4930.
>         setContextClassLoader(service.getClassLoader());
>         
> I think when the service class's class loader is set as TCCL, the JNDI object present in WebAppClassLoader become invisible to the current TCCL. If I comment 'setContextClassLoader(...)' statement the JNDI lookup passes (i.e. it works fine.).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Updated] (AXIS2-5354) JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.

Posted by "praveen Vijayan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

praveen Vijayan updated AXIS2-5354:
-----------------------------------

    Attachment: server.xml
                SampleTestWS.zip
                SampleRequest_and_endpointURL.txt
                log_stackTrace.txt

Following 4 files are attached.
1. SampleTestWS.zip : This is a sample web service project that I created for replicating the issue. It is an eclipse project which can be imported into eclipse.
The application gets deployed as a WAR file in tomcat. Before deploying it, we need to copy all axis2 1.6.2 jars (from Axis2 binary) to the lib folder.

2. log_stackTrace.txt : Stack trace showing look up exception.

3. SampleRequest_and_endpointURL.txt : sample request and soap endpoint (when the service is deployed in tomcat)

4. server.xml : Tomcat server.xml file where datasource is declared. We need to provide appropriate jdbc connect string and database user credentials in this.
                
> JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.
> -------------------------------------------------------------
>
>                 Key: AXIS2-5354
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5354
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws
>    Affects Versions: 1.6.2
>         Environment: JDK 1.6, Tomcat 7
>            Reporter: praveen Vijayan
>         Attachments: SampleRequest_and_endpointURL.txt, SampleTestWS.zip, log_stackTrace.txt, server.xml
>
>
> I am facing a problem with JNDI lookup when we moved our JAX-WS based web service from Axis2 1.6.1 to axis 1.6.2 library.
> Following is the exception that gets thrown from the Impl class :
> Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     
> The service runs on Tomcat 7 (JDK 6) and deployed as a WAR application. It was working fine (i.e. it was able to lookup the name) when I was using 1.6.1 version of axis jar.I have declared the JNDI resource names in context.xml.The problem started when I discarded 1.6.1 jars and started using 1.6.2 Axis2 jars.
> It looks like the issue is happening due to Thread Context Class Loader (TCCL) setting in JAXWSMessageReceiver.java.Here is the block of code that I suspect is causing the issue for us.
>         AxisService service = axisRequestMsgCtx.getAxisService();
>         // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
>         // services, there can be situations where we have to load classes from the deployment
>         // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
>         // artifact. Adding this as a fix for AXIS2-4930.
>         setContextClassLoader(service.getClassLoader());
>         
> I think when the service class's class loader is set as TCCL, the JNDI object present in WebAppClassLoader become invisible to the current TCCL. If I comment 'setContextClassLoader(...)' statement the JNDI lookup passes (i.e. it works fine.).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Commented] (AXIS2-5354) JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.

Posted by "praveen Vijayan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411208#comment-13411208 ] 

praveen Vijayan commented on AXIS2-5354:
----------------------------------------

Also I noticed that the following difference between 1.6.1 and 1.6.2 code w.r.t setting of TCCL in JAXWSMessageReceiver.java


Axis2 1.6.1 (in JAXWSMessageReceiver.java)


    private void mergeDeploymentCL(AxisService service) {

    ClassLoader deploymentClassLoader = service.getClassLoader();
        if (deploymentClassLoader instanceof URLClassLoader) {
            // get URLs from deployment class loader
            URL[] deploymentClassLoaderUrls = ((URLClassLoader) deploymentClassLoader).getURLs();
            // create a new class loader by setting the current TCCL as the parent
            setContextClassLoader(new URLClassLoader(deploymentClassLoaderUrls,
                    getContextClassLoader()));
        }
}        
        
        
 This is now replaced by the following code in Axis2 1.6.2 code 
 
 
         setContextClassLoader(service.getClassLoader());

So it looks like in 1.6.1 version a new Classloader was created using url of service class classLoader and it was set as the child of Web app classloader.
However, now in 1.6.2 version the service class ClassLoader is directly set as the TCCL.
                
> JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.
> -------------------------------------------------------------
>
>                 Key: AXIS2-5354
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5354
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws
>    Affects Versions: 1.6.2
>         Environment: JDK 1.6, Tomcat 7
>            Reporter: praveen Vijayan
>         Attachments: SampleRequest_and_endpointURL.txt, SampleTestWS.zip, log_stackTrace.txt, server.xml
>
>
> I am facing a problem with JNDI lookup when we moved our JAX-WS based web service from Axis2 1.6.1 to axis 1.6.2 library.
> Following is the exception that gets thrown from the Impl class :
> Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     
> The service runs on Tomcat 7 (JDK 6) and deployed as a WAR application. It was working fine (i.e. it was able to lookup the name) when I was using 1.6.1 version of axis jar.I have declared the JNDI resource names in context.xml.The problem started when I discarded 1.6.1 jars and started using 1.6.2 Axis2 jars.
> It looks like the issue is happening due to Thread Context Class Loader (TCCL) setting in JAXWSMessageReceiver.java.Here is the block of code that I suspect is causing the issue for us.
>         AxisService service = axisRequestMsgCtx.getAxisService();
>         // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
>         // services, there can be situations where we have to load classes from the deployment
>         // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
>         // artifact. Adding this as a fix for AXIS2-4930.
>         setContextClassLoader(service.getClassLoader());
>         
> I think when the service class's class loader is set as TCCL, the JNDI object present in WebAppClassLoader become invisible to the current TCCL. If I comment 'setContextClassLoader(...)' statement the JNDI lookup passes (i.e. it works fine.).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Commented] (AXIS2-5354) JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.

Posted by "Sagara Gunathunga (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13404896#comment-13404896 ] 

Sagara Gunathunga  commented on AXIS2-5354:
-------------------------------------------

Commenting that line breaks JAX-WS handler framework hence it's not the ideal solution. Can you please add a sample to reproduce this issue with clear instructions ?   
                
> JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.
> -------------------------------------------------------------
>
>                 Key: AXIS2-5354
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5354
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws
>    Affects Versions: 1.6.2
>         Environment: JDK 1.6, Tomcat 7
>            Reporter: praveen Vijayan
>
> I am facing a problem with JNDI lookup when we moved our JAX-WS based web service from Axis2 1.6.1 to axis 1.6.2 library.
> Following is the exception that gets thrown from the Impl class :
> Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     
> The service runs on Tomcat 7 (JDK 6) and deployed as a WAR application. It was working fine (i.e. it was able to lookup the name) when I was using 1.6.1 version of axis jar.I have declared the JNDI resource names in context.xml.The problem started when I discarded 1.6.1 jars and started using 1.6.2 Axis2 jars.
> It looks like the issue is happening due to Thread Context Class Loader (TCCL) setting in JAXWSMessageReceiver.java.Here is the block of code that I suspect is causing the issue for us.
>         AxisService service = axisRequestMsgCtx.getAxisService();
>         // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
>         // services, there can be situations where we have to load classes from the deployment
>         // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
>         // artifact. Adding this as a fix for AXIS2-4930.
>         setContextClassLoader(service.getClassLoader());
>         
> I think when the service class's class loader is set as TCCL, the JNDI object present in WebAppClassLoader become invisible to the current TCCL. If I comment 'setContextClassLoader(...)' statement the JNDI lookup passes (i.e. it works fine.).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Comment Edited] (AXIS2-5354) JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.

Posted by "praveen Vijayan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13406752#comment-13406752 ] 

praveen Vijayan edited comment on AXIS2-5354 at 7/4/12 10:40 PM:
-----------------------------------------------------------------

Hi, 
I have created a sample jaxws web service to replicate the issue. In getConnection() method in the Impl class (BookingWebServiceImpl.java), we have the following block of code.

                       
				Context initialContext = new InitialContext();
				DataSource datasource = (DataSource) initialContext
						.lookup(dataSourceName);


initialContext.lookup() method throws "Name java:comp is not bound in this Context" when we use the latest Axis2 1.6.2 jars. As I mentioned in my comment above if we comment the following line JAXWSMessageReceiver.java (which I understand is not a fix and it will break something else), the lookup works fine.
                             setContextClassLoader(service.getClassLoader()); 

Please let me know if I can provide any additional information that can help you replicate the issue.

Thanks,
Praveen

                
      was (Author: praveenv):
    Hi, 
I have created a sample jaxws web service to replicate the issue. In getConnection() method in the Impl class (BookingWebServiceImpl.java), we have the following block of code.

                       
				Context initialContext = new InitialContext();
				DataSource datasource = (DataSource) initialContext
						.lookup(dataSourceName);


initialContext.lookup() method throws "Name java:comp is not bound in this Context" when we use the latest Axis2 1.6.2 jars. As I mentioned in my comment above if we comment the following line JAXWSMessageReceiver.java (which I understand is not a fix and it will break something else), the lookup works fine.
                             setContextClassLoader(service.getClassLoader()); 

Please let me know if I can provide any additional information that can help you replicate the issue.

Thanks,
Praveen
praveenv_cs@yahoo.com
                  
> JNDI NameNotFoundException with Axis2 1.6.2 JAXWS webservice.
> -------------------------------------------------------------
>
>                 Key: AXIS2-5354
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5354
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws
>    Affects Versions: 1.6.2
>         Environment: JDK 1.6, Tomcat 7
>            Reporter: praveen Vijayan
>         Attachments: SampleRequest_and_endpointURL.txt, SampleTestWS.zip, log_stackTrace.txt, server.xml
>
>
> I am facing a problem with JNDI lookup when we moved our JAX-WS based web service from Axis2 1.6.1 to axis 1.6.2 library.
> Following is the exception that gets thrown from the Impl class :
> Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     
> The service runs on Tomcat 7 (JDK 6) and deployed as a WAR application. It was working fine (i.e. it was able to lookup the name) when I was using 1.6.1 version of axis jar.I have declared the JNDI resource names in context.xml.The problem started when I discarded 1.6.1 jars and started using 1.6.2 Axis2 jars.
> It looks like the issue is happening due to Thread Context Class Loader (TCCL) setting in JAXWSMessageReceiver.java.Here is the block of code that I suspect is causing the issue for us.
>         AxisService service = axisRequestMsgCtx.getAxisService();
>         // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
>         // services, there can be situations where we have to load classes from the deployment
>         // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
>         // artifact. Adding this as a fix for AXIS2-4930.
>         setContextClassLoader(service.getClassLoader());
>         
> I think when the service class's class loader is set as TCCL, the JNDI object present in WebAppClassLoader become invisible to the current TCCL. If I comment 'setContextClassLoader(...)' statement the JNDI lookup passes (i.e. it works fine.).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org