赞
踩
http://my.oschina.net/u/574870/blog/193782
Weblogic与tomcat的数据源配置不一样,每次在本地跑时都得修改数据源配置,
aaDs要改成java:/comp/env/aaDs
索性自己编译一个tomcat去掉前面的java:/comp/env/
过程如下.
Tomcat的源码下载及编译在此不再赘述,只说明修改的地方.
true改为false
- public Context getInitialContext(Hashtable environment)
- throws NamingException {
- if (ContextBindings.isThreadBound() ||
- (ContextBindings.isClassLoaderBound())) {
- // Redirect the request to the bound initial context
- //true改为false
- return new SelectorContext(environment, false);
- } else {
- // If the thread is not bound, return a shared writable context
- if (initialContext == null)
- initialContext = new NamingContext(environment, MAIN);
- return initialContext;
- }
- }
不判断initialContext直接返回name
- protected String parseName(String name)
- throws NamingException {
-
- if ((!initialContext) && (name.startsWith(prefix))) {
- return (name.substring(prefixLength));
- } else {
- //不判断initialContext直接返回name
- // if (initialContext) {
- return (name);
- /* } else {
- throw new NamingException
- (sm.getString("selectorContext.noJavaUrl"));
- }*/
- }
-
- }
直接取namingContext作为compCtx, envCtx不作叛断
- private void createNamingContext()
- throws NamingException {
-
- // Creating the comp subcontext
- //直接取namingContext作为compCtx, envCtx不作叛断
- // if (container instanceof Server) {
- compCtx = namingContext;
- envCtx = namingContext;
- /* } else {
- compCtx = namingContext.createSubcontext("comp");
- envCtx = compCtx.createSubcontext("env");
- }*/
-
- int i;
-
- if (log.isDebugEnabled())
- log.debug("Creating JNDI naming context");
-
- if (namingResources == null) {
- namingResources = new NamingResources();
- namingResources.setContainer(container);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。