<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: JNDI Lookup fails in JBoss AS 7 [java.naming.CommunicationException]
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/abiya">abiya</a> in <i>JNDI and Naming</i> - <a href="http://community.jboss.org/message/640970#640970">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Thanks for the reply Jaikiran. While using annotation I get the following exception during deployment,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Servlet /common threw load() exception: java.lang.IllegalArgumentException: Can not set javax.sql.DataSource field com.metreo.common.web.servlet.StartupServlet.ds to com.metreo.common.web.servlet.StartupServlet<br/> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) [:1.6.0_24]<br/> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) [:1.6.0_24]<br/> at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) [:1.6.0_24]<br/> at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source) [:1.6.0_24]<br/> at java.lang.reflect.Field.set(Unknown Source) [:1.6.0_24]<br/> at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptor.java:64)<br/> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.as.ee.component.ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptor.java:53)<br/> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)<br/> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]<br/> at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:152)<br/> at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:77)<br/> at org.jboss.as.web.deployment.component.WebComponentInstantiator$1.&lt;init&gt;(WebComponentInstantiator.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]<br/> at org.jboss.as.web.deployment.component.WebComponentInstantiator.getReference(WebComponentInstantiator.java:55) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]<br/> at org.jboss.as.web.deployment.WebInjectionContainer.instantiate(WebInjectionContainer.java:99) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]<br/> at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:78) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]<br/> at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]<br/> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1156) [jbossweb-7.0.1.Final.jar:7.0.2.Final]<br/> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]<br/> at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631) [jbossweb-7.0.1.Final.jar:7.0.2.Final]<br/> at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844) [jbossweb-7.0.1.Final.jar:7.0.2.Final]<br/> at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]<br/> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)<br/> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)<br/> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_24]<br/> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_24]<br/> at java.lang.Thread.run(Unknown Source) [:1.6.0_24]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My servlet code is as follows,</p><p align="left"><p><span style=": ; color: #7f0055; font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></p></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong><span style="font-size: 10pt; color: #7f0055;"><strong style="color: #7f0055; font-size: 10pt;"><strong style=": ; color: #7f0055; font-size: 2;"><p align="left">public</p></strong></strong></span><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><span style="font-size: 10pt; color: #000000;"> </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">class</strong></strong><span style="font-size: 10pt; color: #000000;"> <span style="text-decoration: underline;">StartupServlet</span> </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">extends</strong></strong><p align="left"><span style="font-size: 10pt;"><span style="color: #000000;"> HttpServlet</span><p align="left">{</p><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></span></p></strong></p><p align="left"><span style="font-size: 10pt; color: #3f7f5f;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></p><p><span style=": ; font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #646464; font-size: 10pt;">@Resource</span><span style="font-size: 10pt;">(mappedName=</span><span style="color: #2a00ff; font-size: 10pt;">"java:jboss/datasources/weblogic.jdbc.jts.demopool"</span><span style="font-size: 10pt;">)<span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></span></p><p><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">private</strong></strong><span style="font-size: 10pt;"> DataSource </span><span style="color: #0000c0; font-size: 10pt;">ds;</span></p><p><span style="color: #0000c0; font-size: 10pt;">....</span></p><p><span style="color: #0000c0; font-size: 10pt;">}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #0000c0; font-size: 10pt;">I am new to annotations and not sure what is wrong over here.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #0000c0; font-size: 10pt;"></span><span style="color: #0000c0;">Thanks,</span></p><p><span style="color: #0000c0;">Abiya</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><div class="mcePaste" id="_mcePaste" style="left: 0px; position: absolute; top: 0px;"></div></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/640970#640970">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JNDI and Naming at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>