问题描述
我刚开始使用Proxool(JDBC连接池管理器)。我下载了在以下链接中找到的jar:。之后,我只是在NetBeans 7.0.1中将该jar位置添加到ClassPath中,构建了该项目,重新启动了我的服务器(即Glassfish),然后尝试配置它,如下例所示:
'p>
我只是修改了示例(参数)来修复我的应用程序和下面的一段代码崩溃。它示出了误差 java.lang.NoClassDefFoundError:无法初始化类org.logicalcobwebs.proxool.ProxoolDataSource
我不明白为什么,因为我只是进口了整个包装。我不知道从哪里开始。
以下是我的代码:
import org.logicalcobwebs.proxool。*;
import org.logicalcobwebs。*;
/ *错误在这里----> * / ProxoolDataSource dataSource = new ProxoolDataSource();
dataSource.setAlias(flpool);
dataSource.setDriver(com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource);
dataSource.setDriverUrl(jdbc:mysql:// localhost:3306 / superdb);
dataSource.setUser(db);
dataSource.setPassword(password);
dataSource.setMaximumActiveTime(100);
dataSource.setMinimumConnectionCount(8);
dataSource.setMaximumConnectionCount(25);
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,com.sun.jndi.rmi.registry.RegistryContextFactory);
env.put(Context.PROVIDER_URL,rmi:// localhost:1099);
Context context = new InitialContext(env);
context.createSubcontext(jdbc);
context.bind(jndiName,dataSource);
context.close();
DataSource ds =(DataSource)context.lookup(jndiName);
ProxoolFacade.removeConnectionPool(flpool);
context.close();
如果有人有任何想法,请提前致谢,感谢您的帮助。
我猜你错过了 JAR。
消息
无法初始化类org.logicalcobwebs.proxool.ProxoolDataSource
表示指定类的静态初始化失败。
我下载了Proxool的源代码,并且此类中唯一的静态初始化为以下行:
private static final Log LOG = LogFactory.getLog(ProxoolDataSource.class);
尝试将Commons Logging JAR添加到您的项目并重新启动服务器。
I just started using Proxool (JDBC Connection Pool manager). I downloaded the jar which is found at the following link: http://proxool.sourceforge.net/download.html. After that, I just added the jar location into the ClassPath in netbeans 7.0.1, built the project, restarted my server (which is Glassfish) and then tried to configure it as this example shows:
I just adapted the Example (parameters) to fix into my application and the following piece of code below crashes. It shows the error java.lang.NoClassDefFoundError: Could not initialize class org.logicalcobwebs.proxool.ProxoolDataSource
.
I can't understand why because I just imported the whole package. I do not know where to start.
Here's my code:
import org.logicalcobwebs.proxool.*;
import org.logicalcobwebs.*;
/* Error Here ----> */ ProxoolDataSource dataSource = new ProxoolDataSource();
dataSource.setAlias("flpool");
dataSource.setDriver("com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource");
dataSource.setDriverUrl("jdbc:mysql://localhost:3306/superdb");
dataSource.setUser("db");
dataSource.setPassword("password");
dataSource.setMaximumActiveTime(100);
dataSource.setMinimumConnectionCount(8);
dataSource.setMaximumConnectionCount(25);
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
Context context = new InitialContext(env);
context.createSubcontext("jdbc");
context.bind(jndiName,dataSource);
context.close();
DataSource ds = (DataSource) context.lookup(jndiName);
ProxoolFacade.removeConnectionPool("flpool");
context.close();
if someone have any idea will appreciate it your help, thanks in advance.
I would guess that you are missing an Apache Commons Logging JAR.
The message
Could not initialize class org.logicalcobwebs.proxool.ProxoolDataSource
indicates that static initialization of the named class failed.
I downloaded the source of Proxool, and the only static initialization in this class was the following line:
private static final Log LOG = LogFactory.getLog(ProxoolDataSource.class);
Try adding a Commons Logging JAR to your project and restarting your server.
这篇关于Proxool java.lang.NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!