gpt4 book ai didi

tomcat - 无法在 maven 中使用 broadleaf 运行 Tomcat 服务器

转载 作者:行者123 更新时间:2023-11-28 23:21:12 26 4
gpt4 key购买 nike

我已经运行了基本的演示应用程序,它显示了以下错误:

nested exception is javax.naming.NameNotFoundException: Name [jdbc/web] is not bound in this Context. Unable to find [jdbc].

我的 context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Context sessionCookieName="JSESSIONIDADMIN">

<!-- disable session persistence -->
<Manager pathname="" />
<ResourceLink name="jdbc/web"
global="jdbc/web"
type="javax.sql.DataSource" />
</Context>

我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany-community</groupId>
<artifactId>ecommerce-website</artifactId>
<version>5.0</version>
</parent>
<artifactId>core</artifactId>
<name>core</name>
<description>Customizations And Extensions For Broadleaf Commerce Services And Entities</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<rootPath>${basedir}</rootPath>
</configuration>
</plugin>

</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-framework</artifactId>
</dependency>
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-profile</artifactId>
</dependency>
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-menu</artifactId>
</dependency>
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-sample-payment-gateway</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
</dependencies>
</project>

最佳答案

是否在server.xml中添加了GlobalNamingResources的Resource设置?如果没有,您应该添加设置。

例如:

<GlobalNamingResources>
...
<Resource name="jdbc/web"
auth="Container"
type="javax.sql.DataSource"
username="test"
password="test"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@***.***.***.***:1521:orcl" />
</GlobalNamingResources>

或者更改context.xml的内容,例如:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/web"
auth="Container"
type="javax.sql.DataSource"
username="test"
password="test"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@***.***.***.***:1521:orcl" />
</Context>

或者如果应用程序不需要访问数据库,则从 context.xml 中删除 Resource 标签。

关于tomcat - 无法在 maven 中使用 broadleaf 运行 Tomcat 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43520456/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com