相关疑难解决方法(0)

关闭Spring应用程序会使数据源的JNDI名称远离jdbc上下文

我正在尝试在我的Weblogic服务器上使用Spring MVC和Spring Data JPA设置Web应用程序.第一次将它部署到Weblogic服务器时应用程序正常工作但是当我停止应用程序时,我的数据源的jndi名称(jdbc/myDS)从我的Weblogic服务器上的JNDI树中消失,然后当我尝试启动应用程序时我再次收到以下错误:

Caused By: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.myDS'. Resolved 'jdbc'; remaining name 'myDS'
Run Code Online (Sandbox Code Playgroud)

我在JPAConfiguratation.java启动时设置了以下内容:

package mySpringApp.application;

import java.util.Properties;

import javax.annotation.Resource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * An application context Java configuration class. The usage of Java configuration
 * requires Spring Framework 3.0 or higher with …
Run Code Online (Sandbox Code Playgroud)

java spring servlets weblogic jndi

10
推荐指数
1
解决办法
2729
查看次数

标签 统计

java ×1

jndi ×1

servlets ×1

spring ×1

weblogic ×1