mysql - JNDI TOMCAT7 AMAZON EC2 -


i've been trying set tomcat server on amazon's ec2 server little luck. have same exact setup running fine on windows local machine no issues.

    caused by: javax.naming.namenotfoundexception: name [jdbc/orders] not bound in context. unable find [jdbc].     @ org.apache.naming.namingcontext.lookup(namingcontext.java:819)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:167)     @ org.apache.naming.selectorcontext.lookup(selectorcontext.java:156)     @ javax.naming.initialcontext.lookup(initialcontext.java:411)     @ org.springframework.jndi.jnditemplate$1.doincontext(jnditemplate.java:154)     @ org.springframework.jndi.jnditemplate.execute(jnditemplate.java:87)     @ org.springframework.jndi.jnditemplate.lookup(jnditemplate.java:152)     @ org.springframework.jndi.jnditemplate.lookup(jnditemplate.java:178)     @ org.springframework.jndi.jndilocatorsupport.lookup(jndilocatorsupport.java:104)     @ org.springframework.jndi.jndiobjectlocator.lookup(jndiobjectlocator.java:105)     @ org.springframework.jndi.jndiobjectfactorybean.lookupwithfallback(jndiobjectfactorybean.java:201)     @ org.springframework.jndi.jndiobjectfactorybean.afterpropertiesset(jndiobjectfactorybean.java:187)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1541)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1479)     ... 103 more 

server.xml

      <?xml version="1.0" encoding="utf-8"?> <!--   licensed apache software foundation (asf) under 1 or more   contributor license agreements.  see notice file distributed   work additional information regarding copyright ownership.   asf licenses file under apache license, version 2.0   (the "license"); may not use file except in compliance   license.  may obtain copy of license @        http://www.apache.org/licenses/license-2.0          unless required applicable law or agreed in writing, software         distributed under license distributed on "as is" basis,        without warranties or conditions of kind, either express or implied.        see license specific language governing permissions ,        limitations under license.       --><!-- note:  "server" not "container", may not      define subcomponents such "valves" @ level.      documentation @ /docs/config/server.html      --><server port="8005" shutdown="shutdown">       <!-- security listener. documentation @ /docs/config/listeners.html       <listener classname="org.apache.catalina.security.securitylistener" />        -->       <!--apr library loader. documentation @ /docs/apr.html -->      <listener sslengine="on" classname="org.apache.catalina.core.aprlifecyclelistener"/>   <!--initialize jasper prior webapps loaded. documentation @ /docs/jasper-howto.html -->   <listener classname="org.apache.catalina.core.jasperlistener"/>   <!-- prevent memory leaks due use of particular java/javax apis-->   <listener classname="org.apache.catalina.core.jrememoryleakpreventionlistener"/>   <listener classname="org.apache.catalina.mbeans.globalresourceslifecyclelistener"/>   <listener classname="org.apache.catalina.core.threadlocalleakpreventionlistener"/>    <!-- global jndi resources        documentation @ /docs/jndi-resources-howto.html   -->   <globalnamingresources>     <!-- editable user database can used          userdatabaserealm authenticate users     -->     <resource name="jdbc/orders" auth="container" type="javax.sql.datasource"     maxactive="100" maxidle="30" maxwait="10000" username="marios"     password="135181mi!" driverclassname="com.mysql.jdbc.driver"     url="jdbc:mysql://localhost:3306/orders" />     <resource auth="container" description="user database can updated , saved" factory="org.apache.catalina.users.memoryuserdatabasefactory" name="userdatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.userdatabase"/>   </globalnamingresources>    <!-- "service" collection of 1 or more "connectors" share        single "container" note:  "service" not "container",        may not define subcomponents such "valves" @ level.        documentation @ /docs/config/service.html        -->       <service name="catalina">      <!--the connectors can use shared executor, can define 1 or more named thread pools-->     <!--     <executor name="tomcatthreadpool" nameprefix="catalina-exec-"         maxthreads="150" minsparethreads="4"/>         -->        <!-- "connector" represents endpoint requests received          , responses returned. documentation @ :          java http connector: /docs/config/http.html (blocking & non-blocking)          java ajp  connector: /docs/config/ajp.html          apr (http/ajp) connector: /docs/apr.html          define non-ssl http/1.1 connector on port 8080     -->     <connector connectiontimeout="20000" port="8080" protocol="http/1.1" redirectport="8443"/>     <!-- "connector" using shared thread pool-->     <!--     <connector executor="tomcatthreadpool"                port="8080" protocol="http/1.1"                connectiontimeout="20000"                redirectport="8443" />     -->     <!-- define ssl http/1.1 connector on port 8443          connector uses jsse configuration, when using apr,          connector should using openssl style configuration          described in apr documentation -->     <!--     <connector port="8443" protocol="http/1.1" sslenabled="true"                maxthreads="150" scheme="https" secure="true"                clientauth="false" sslprotocol="tls" />     -->     <!-- define ajp 1.3 connector on port 8009 -->     <connector port="8009" protocol="ajp/1.3" redirectport="8443"/>     <!-- engine represents entry point (within catalina) processes          every request.  engine implementation tomcat stand alone          analyzes http headers included request, , passes them          on appropriate host (virtual host).          documentation @ /docs/config/engine.html -->     <!-- should set jvmroute support load-balancing via ajp ie :     <engine name="catalina" defaulthost="localhost" jvmroute="jvm1">     -->     <engine defaulthost="localhost" name="catalina">       <!--for clustering, please take @ documentation at:           /docs/cluster-howto.html  (simple how to)           /docs/config/cluster.html (reference documentation) -->       <!--       <cluster classname="org.apache.catalina.ha.tcp.simpletcpcluster"/>       -->       <!-- use lockoutrealm prevent attempts guess user passwords            via brute-force attack -->       <realm classname="org.apache.catalina.realm.lockoutrealm">         <!-- realm uses userdatabase configured in global jndi              resources under key "userdatabase".  edits              performed against userdatabase              available use realm.  -->         <realm classname="org.apache.catalina.realm.userdatabaserealm" resourcename="userdatabase"/>       </realm>       <host appbase="webapps" autodeploy="true" name="localhost" unpackwars="false">         <!-- singlesignon valve, share authentication between web applications              documentation at: /docs/config/valve.html -->         <!--         <valve classname="org.apache.catalina.authenticator.singlesignon" />         -->         <!-- access log processes example.              documentation at: /docs/config/valve.html              note: pattern used equivalent using pattern="common" -->         <valve classname="org.apache.catalina.valves.accesslogvalve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>       </host>     </engine>   </service> </server> 

web-inf/context.xml tried put in tomcat7/config/context.xml

   <?xml version='1.0' encoding='utf-8'?> <!--   licensed apache software foundation (asf) under 1 or more   contributor license agreements.  see notice file distributed   work additional information regarding copyright ownership.   asf licenses file under apache license, version 2.0   (the "license"); may not use file except in compliance   license.  may obtain copy of license @        http://www.apache.org/licenses/license-2.0    unless required applicable law or agreed in writing, software   distributed under license distributed on "as is" basis,   without warranties or conditions of kind, either express or implied.   see license specific language governing permissions ,   limitations under license. --> <!-- contents of file loaded each web application --> <context docbase="paphosdiner" path="/paphosdiner" reloadable="true" source="org.eclipse.jst.jee.server:paphosdiner">        <resourcelink name="jdbc/orders"                 global="jdbc/orders"                 auth="container"                 type="javax.sql.datasource" />     <!-- default set of monitored resources -->     <watchedresource>web-inf/web.xml</watchedresource>   </context> 

web.xml

<resource-ref>     <description>database</description>     <res-ref-name>jdbc/orders</res-ref-name>     <res-type>javax.sql.datasource</res-type>     <res-auth>container</res-auth> </resource-ref>  

i have included mysqlconnector jar in server