Я разрабатываю новое веб-приложение со структурой Struts2, eclipse, и я сопоставил структуру БД с помощью Hibernate. Проблема в том, что когда я выполняю свое действие «list», фреймворк возвращает мне эту ошибку:
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
This context must be accessed through a java: URL
Unable to lookup JNDI name [java:comp/env/jdbc/main]
File: org/apache/naming/SelectorContext.java
Line number: 776
server.xml:
</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" defaultAutoCommit="false" driverClassName="net.sourceforge.jtds.jdbc.Driver" maxActive="200" maxIdle="100" maxWait="20000" name="jdbc/main" password="########" type="javax.sql.DataSource" url="jdbc:jtds:sqlserver://10.4.1.85/SBAGRU_DEV" username="****"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="2000" executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector SSLEnabled="true" clientAuth="false" keystoreFile="C:\jpeople.bin" keystorePass="gesbanke" keystoreType="PKCS12" maxThreads="200" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="SSL"/>
<!--<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> -->
<Engine defaultHost="localhost" name="Catalina">
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
<Context docBase="mag0" path="/mag0" reloadable="true" source="org.eclipse.jst.jee.server:mag0">
<ResourceLink global="jdbc/main" name="jdbc/main" type="javax.sql.DataSource" />
</Context>
</Host>
</Engine>
</Service>
</Server>
Я также hibernate.cfg.xml
</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" defaultAutoCommit="false" driverClassName="net.sourceforge.jtds.jdbc.Driver" maxActive="200" maxIdle="100" maxWait="20000" name="jdbc/main" password="########" type="javax.sql.DataSource" url="jdbc:jtds:sqlserver://10.4.1.85/SBAGRU_DEV" username="****"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="2000" executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector SSLEnabled="true" clientAuth="false" keystoreFile="C:\jpeople.bin" keystorePass="******" keystoreType="PKCS12" maxThreads="200" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="SSL"/>
<!--<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> -->
<Engine defaultHost="localhost" name="Catalina">
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
<Context docBase="mag0" path="/mag0" reloadable="true" source="org.eclipse.jst.jee.server:mag0">
<ResourceLink global="jdbc/main" name="jdbc/main" type="javax.sql.DataSource" />
</Context>
</Host>
</Engine>
</Service>
</Server>
Любое предложение, где я могу посмотреть? Я действительно схожу с ума!