I have this project in which I have to use hibernate, this is the first time I use, I don't really know many things about it and I get a bunch of exceptions when I run my program. I have installed the required libraries from hibernate in eclipse. But when I run I get this. I'm sorry that I paste all the errors here but I really have no idea how I could fix them and where to start. Could you please help me
Mar 31, 2014 9:44:05 AM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Mar 31, 2014 9:44:05 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.8.Final}
Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Mar 31, 2014 9:44:06 AM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: Book.hbm.xml
Mar 31, 2014 9:44:06 AM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/Lab1-aop]
Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
Mar 31, 2014 9:44:08 AM org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure
WARN: HHH000342: Could not obtain connection to query metadata : Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection refused: connect
STACKTRACE:
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:193)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:77)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1788)
at library.repository.file.RepositoryFile.<init>(RepositoryFile.java:17)
at controller.Controller.<init>(Controller.java:18)
at view.Library.<init>(Library.java:23)
at Start.createAndShowGUI(Start.java:14)
at Start$1.run(Start.java:28)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
** END NESTED EXCEPTION **
Last packet sent to the server was 1 ms ago.
Mar 31, 2014 9:44:08 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Mar 31, 2014 9:44:08 AM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000422: Disabling contextual LOB creation as connection was null
Mar 31, 2014 9:44:08 AM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Mar 31, 2014 9:44:08 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Exception in thread "AWT-EventQueue-0" org.hibernate.MappingException: entity class not found: model.Book
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:129)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:390)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:75)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:145)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:507)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:146)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:383)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1788)
at library.repository.file.RepositoryFile.<init>(RepositoryFile.java:17)
at controller.Controller.<init>(Controller.java:18)
at view.Library.<init>(Library.java:23)
at Start.createAndShowGUI(Start.java:14)
at Start$1.run(Start.java:28)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: model.Book
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192)
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:126)
... 33 more
You are missing mysql-connector jar in your classpath and hence the exception.
Specified JDBC Driver com.mysql.jdbc.Driver class not found
Include it in you classpath.
You are missing mysql-connector jar .. Kindly download appropriate version and put it in your project class path.. this will solve your problem...
Your Exception shows below lines
Exception in thread "AWT-EventQueue-0" org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
That means your jdbc driver is not added in library or properly configured.
Please check your config file
You're missing the Mysql Connection JAR on your classpath.
This jar contains the driver: com.mysql.jdbc.Driver
Download it and add,problem will be solved
you can download mysql java driver from http://www.mysql.com/downloads/connector/j/
Related
I have a java war that is being run through Jetty. It has been working on multiple Windows 7 computers for years. But now a new installation on a Windows 7 computer is producing errors and I don't understand the errors. I am posting below the log up until the point of the error:
C:\Users\QT\Desktop\vcctl\scripts>cd ..\src
C:\Users\QT\Desktop\vcctl\src>java -classpath "lib/derby.jar:lib/derbytools.jar" -Dorg.eclipse.jetty.server.Request.maxFormKeys=20000 -jar "VcctlWrapper.jar"
2016-03-21 15:42:11.866:INFO::AWT-EventQueue-0: Logging initialized #204ms
Current relative path is: C:\Users\QT\Desktop\vcctl\src
2016-03-21 15:42:11.969:INFO:oejs.Server:AWT-EventQueue-0: jetty-9.1.3.v20140225
Mar 21, 2016 3:42:13 PM org.apache.struts.action.ActionServlet initChain
INFO: Loading chain catalog from jar:file:/C:/Users/QT/AppData/Local/Temp/jetty-0.0.0.0-8080-vcctl.war-_vcctl-any-7374762875405590280.dir/webapp/WEB-INF/lib/struts-tiles-1.3.8.jar!/org/apache/struts/tiles/chain-config.xml
Mar 21, 2016 3:42:13 PM org.apache.struts.action.ActionServlet initChain
INFO: Loading chain catalog from jar:file:/C:/Users/QT/Desktop/vcctl/src/lib/struts-tiles-1.3.8.jar!/org/apache/struts/tiles/chain-config.xml
Mar 21, 2016 3:42:13 PM org.apache.struts.config.impl.ModuleConfigImpl addAction Config
WARNING: Overriding ActionConfig of path /my-files/viewImage
Mar 21, 2016 3:42:13 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
2016-03-21 15:42:13.626:INFO:oejsh.ContextHandler:AWT-EventQueue-0: Started o.e.j.w.WebAppContext#3c6dee0f{/vcctl,file:/C:/Users/QT/AppData/Local/Temp/jetty-0.0.0.0-8080-vcctl.war-_vcctl-any-7374762875405590280.dir/webapp/,AVAILABLE}{C:\Users\QT\Desktop\vcctl\src/vcctl.war}
2016-03-21 15:42:13.635:WARN:oejuc.AbstractLifeCycle:AWT-EventQueue-0: FAILED ServerConnector#3ba4f2fd{HTTP/1.1}{0.0.0.0:8080}: java.net.BindException: Address already in use: bind
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:279)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:337)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at vcctl.webServiceRunner.startJettyServer(webServiceRunner.java:98)
at vcctl.webServiceRunner.<init>(webServiceRunner.java:40)
at vcctl.webServiceRunner$1.run(webServiceRunner.java:107)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$300(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
2016-03-21 15:42:13.639:WARN:oejuc.AbstractLifeCycle:AWT-EventQueue-0: FAILED org.eclipse.jetty.server.Server#4a4cdea2: java.net.BindException: Address already
in use: bind
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:279)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:337)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at vcctl.webServiceRunner.startJettyServer(webServiceRunner.java:98)
at vcctl.webServiceRunner.<init>(webServiceRunner.java:40)
at vcctl.webServiceRunner$1.run(webServiceRunner.java:107)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$300(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
On my other Windows 7 computers, the log message looks like this:
C:\Users\bullard\Desktop\vcctl\scripts>cd ..\src
C:\Users\bullard\Desktop\vcctl\src>java -classpath "lib/derby.jar:lib/derbytools.jar" -Dorg.eclipse.jetty.server.Request.maxFormKeys=20000 -jar "VcctlWrapper.jar"
2016-03-21 17:34:04.520:INFO::AWT-EventQueue-0: Logging initialized #172ms
Current relative path is: C:\Users\bullard\Desktop\vcctl\src
2016-03-21 17:34:04.598:INFO:oejs.Server:AWT-EventQueue-0: jetty-9.1.3.v20140225
Mar 21, 2016 5:34:05 PM org.apache.struts.action.ActionServlet initChain
INFO: Loading chain catalog from jar:file:/C:/Users/bullard/AppData/Local/Temp/jetty-0.0.0.0-8080-vcctl.war-_vcctl-any-9120726856785823814.dir/webapp/WEB-INF/lib/struts-tiles-1.3.8.jar!/org/apache/struts/tiles/chain-config.xml
Mar 21, 2016 5:34:05 PM org.apache.struts.action.ActionServlet initChain
INFO: Loading chain catalog from jar:file:/C:/Users/bullard/Desktop/vcctl/src/lib/struts-tiles-1.3.8.jar!/org/apache/struts/tiles/chain-config.xml
Mar 21, 2016 5:34:05 PM org.apache.struts.config.impl.ModuleConfigImpl addAction Config
WARNING: Overriding ActionConfig of path /my-files/viewImage
Mar 21, 2016 5:34:05 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
2016-03-21 17:34:05.955:INFO:oejsh.ContextHandler:AWT-EventQueue-0: Started o.e.j.w.WebAppContext#1ac6103{/vcctl,file:/C:/Users/bullard/AppData/Local/Temp/jetty-0.0.0.0-8080-vcctl.war-_vcctl-any-9120726856785823814.dir/webapp/,AVAILABLE}{C:
\Users\bullard\Desktop\vcctl\src/vcctl.war}
2016-03-21 17:34:05.971:INFO:oejs.ServerConnector:AWT-EventQueue-0: Started ServerConnector#146eb1b{HTTP/1.1}{0.0.0.0:8080}
2016-03-21 17:34:05.971:INFO:oejs.Server:AWT-EventQueue-0: Started #1623ms
This occurs when another instance of Jetty or another process is running on the same port your Jetty server is attempting to run on. Jetty runs on default port 8080. So either you have another Jetty instance or maybe a Tomcat server running on that server occupying port 8080 (or whatever port you configured).
You can modify the jetty.xml file and update the jetty.port by changing this line:
<Set name="port"><SystemProperty name="jetty.port" default="80"/></Set>
But before doing that, I would check for processes in the taskmgr like jetty or tomcat currently running. You can also check netstat -a -b for running processes and the port they are using.
I'm trying to use Jasypt to encrypt the DB password in the hibernate.cfg.xml file in my application.
I'm currently using Hibernate 4.3.2 with Jasypt 1.9.2.
The following is my configuration :
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Security -->
<property name="connection.provider_class">org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider</property>
<property name="connection.encryptor_registered_name">configurationHibernateEncryptor</property>
<!-- Database connection settings -->
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.url">jdbc:h2:db/pappu;AUTO_SERVER=TRUE</property>
<property name="connection.username">pappu</property>
<property name="connection.password">ENC(xsIYbIfGoS2mZ1Tokihdathbuk0JVS2A)</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">managed</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup - REMOVE THIS LINE FOR PRODUCTION-->
<property name="hbm2ddl.auto">update</property>
<!-- Mappings -->
</session-factory>
</hibernate-configuration>
a part of HibernateUtil.java
try {
StandardPBEStringEncryptor strongEncryptor = new StandardPBEStringEncryptor();
HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance();
strongEncryptor.setAlgorithm("PBEWithMD5AndTripleDES");
strongEncryptor.setPassword("test");
registry.registerPBEStringEncryptor("configurationHibernateEncryptor", strongEncryptor);
Configuration cfg = new Configuration().configure("/pappu/config/hibernate.cfg.xml");
StandardServiceRegistryBuilder sb = new StandardServiceRegistryBuilder();
sb.applySettings(cfg.getProperties());
StandardServiceRegistry standardServiceRegistry = sb.build();
return cfg.buildSessionFactory(standardServiceRegistry);
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
When I launch my application I get these errors :
Initial SessionFactory creation failed.org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source)
at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at pappu.core.db.HibernateUtil.buildSessionFactory(HibernateUtil.java:60)
at pappu.core.db.HibernateUtil.initSessionFactory(HibernateUtil.java:98)
at pappu.core.db.HibernateUtil.getSessionFactory(HibernateUtil.java:70)
at pappu.core.db.HibernateUtil.getCurrentSession(HibernateUtil.java:82)
at pappu.Main.start(Main.java:23)
at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$5.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
at com.sun.glass.ui.win.WinApplication$3$1.run(Unknown Source)
... 1 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:233)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:197)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
at pappu.core.db.HibernateUtil.buildSessionFactory(HibernateUtil.java:56)
... 15 more
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider]
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:197)
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:120)
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:55)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:83)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:223)
... 25 more
Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider] as strategy [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:128)
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:194)
... 29 more
jasypt-1.9.2.jar and jasypt-hibernate4-1.9.2.jar are correctly included in the class path.
There is something weird, in the tutorial provided by jasypt, they use this property in their hibernate.cfg.xml :
<property name="connection.provider_class">
org.jasypt.hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider
</property>
You can see the difference with my hibernate.cfg.xml at the line 8, I'm using
org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider
If I use the "org.jasypt.hibernate4.connectionprovider...." I get these errors :
juin 17, 2014 12:44:43 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
juin 17, 2014 12:44:43 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.2.Final}
juin 17, 2014 12:44:43 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
juin 17, 2014 12:44:43 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
juin 17, 2014 12:44:43 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /pappu/config/hibernate.cfg.xml
juin 17, 2014 12:44:43 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /pappu/config/hibernate.cfg.xml
juin 17, 2014 12:44:43 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
juin 17, 2014 12:44:43 PM org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
INFO: HHH000130: Instantiating explicit connection provider: org.jasypt.hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/service/jdbc/connections/internal/DriverManagerConnectionProviderImpl
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source)
at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at pappu.core.db.HibernateUtil.buildSessionFactory(HibernateUtil.java:60)
at pappu.core.db.HibernateUtil.initSessionFactory(HibernateUtil.java:98)
at pappu.core.db.HibernateUtil.getSessionFactory(HibernateUtil.java:70)
at pappu.core.db.HibernateUtil.getCurrentSession(HibernateUtil.java:82)
at pappu.Main.start(Main.java:23)
at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$5.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
at com.sun.glass.ui.win.WinApplication$3$1.run(Unknown Source)
... 1 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/jdbc/connections/internal/DriverManagerConnectionProviderImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:222)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:240)
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:125)
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:194)
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:120)
at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:55)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:83)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:223)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:197)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
at pappu.core.db.HibernateUtil.buildSessionFactory(HibernateUtil.java:56)
... 15 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 49 more
I'm totally lost because my HibernateUtil.java includes org.jasypt.hibernate4 !
The problem appears to be that jasypt is looking for the class
org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl
which is no longer available for versions of Hibernate 4.3.x and above.
Try reverting to Hibernate 4.2.13.Final and retry.
I must connect to a server of a system from my Java application. However, it fails and I do not understand why, because I have done the configuration and I connect to the server by IP. The error is:
run:
août 27, 2013 4:13:48 PM com.lhs.ccb.func.corba.CORBAAdapter <init>
INFO: Reading orb.properties...
août 27, 2013 4:13:49 PM com.lhs.ccb.func.corba.CORBAAdapter$OrbThread run
INFO: Before ORB.run
août 27, 2013 4:13:49 PM com.lhs.ccb.func.corba.CORBAAdapter newInitialNamingContext
INFO: Bootstrap initial naming context using "resolve_initial_references("NameService")"
août 27, 2013 4:13:50 PM com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 41.229.0.149; port: 2010"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2200)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2221)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:223)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:236)
at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:119)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:185)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:136)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:229)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:130)
at org.omg.CosNaming.NamingContextExtHelper.narrow(NamingContextExtHelper.java:73)
at com.lhs.ccb.func.corba.CORBAAdapter.newInitialNamingContext(Unknown Source)
at com.lhs.ccb.func.corba.CORBAAdapter.getInitialNamingContext(Unknown Source)
at com.lhs.ccb.common.soiimpl.ServiceRootLocatorNamingService.lookupServiceRoot(Unknown Source)
at com.lhs.ccb.common.soiimpl.ServiceRootLocatorNamingService.lookupServiceRoot(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.getNewRootAccessor(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.createContainerFactory(Unknown Source)
at com.lhs.ccb.cfw.cda.session.ServerGateway.connect(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.createConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnectionFromPool(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.ott.cms.client.CallCommand.main(CallCommand.java:28)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:75)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at com.lhs.ccb.func.corba.CORBASocketFactory.createSocket(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init> (SocketOrChannelConnectionImpl.java:206)
... 20 more
août 27, 2013 4:13:50 PM com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway createContainerFactory
SEVERE: Error getting RootAccessor
Error code: FUNC_UTIL.id100
ClassName: com.lhs.ccb.func.ect.SystemException
Error arguments:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
Stack trace:
[com.lhs.ccb.func.corba.CORBAAdapter.newInitialNamingContext(Unknown Source), com.lhs.ccb.func.corba.CORBAAdapter.getInitialNamingContext(Unknown Source), com.lhs.ccb.common.soiimpl.ServiceRootLocatorNamingService.lookupServiceRoot(Unknown Source), com.lhs.ccb.common.soiimpl.ServiceRootLocatorNamingService.lookupServiceRoot(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.getNewRootAccessor(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.createContainerFactory(Unknown Source), com.lhs.ccb.cfw.cda.session.ServerGateway.connect(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.createConnection(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnectionFromPool(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnection(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source), com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source), com.ott.cms.client.CallCommand.main(CallCommand.java:28)]
at com.lhs.ccb.func.corba.CORBAAdapter.newInitialNamingContext(Unknown Source)
at com.lhs.ccb.func.corba.CORBAAdapter.getInitialNamingContext(Unknown Source)
at com.lhs.ccb.common.soiimpl.ServiceRootLocatorNamingService.lookupServiceRoot(Unknown Source)
at com.lhs.ccb.common.soiimpl.ServiceRootLocatorNamingService.lookupServiceRoot(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.getNewRootAccessor(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.createContainerFactory(Unknown Source)
at com.lhs.ccb.cfw.cda.session.ServerGateway.connect(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.createConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnectionFromPool(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.ott.cms.client.CallCommand.main(CallCommand.java:28)
août 27, 2013 4:13:53 PM com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl getConnectionFromPool
SEVERE: Connection createion failed for poolTRAIN
com.lhs.ccb.cfw.cda.session.ConnectionFailedException: Service currently not available. Cannot connect to server.
at com.lhs.ccb.cfw.cda.servicelayer.SoiServerGateway.createContainerFactory(Unknown Source)
at com.lhs.ccb.cfw.cda.session.ServerGateway.connect(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.createConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnectionFromPool(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.ott.cms.client.CallCommand.main(CallCommand.java:28)
Exception in thread "main" com.lhs.ccb.cfw.cda.servicelayer.ServiceRuntimeException: Tried to open a server connection for reading data.
But the server did not respond. Maybe it is down.
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnectionFromPool(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolImpl.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.lhs.ccb.cfw.cda.servicelayer.connectionpool.ConnectionPoolManager.getConnection(Unknown Source)
at com.ott.cms.client.CallCommand.main(CallCommand.java:28)
This my file of configuration in Java:
org.omg.CORBA.ORBInitRef=NameService=corbaloc:iiop:41.229.0.149:2010/NameService
And this file in the system:
# LISTENER.ORA Network Configuration File: C:\Orant\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 41.229.0.149)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = demodb)
(ORACLE_HOME = C:\Orant)
(GLOBAL_DBNAME = demodb)
)
)
Your host machine seems to be dead for me. I can't reach it. Try to figure out what is going wrong there before tweaking your code.
I am following a tutorial for a simple sample web service at http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/comment-page-1/#comment-130057 - He carefully lists the libraries needed, and they are in both the tomcat lib folder and in the "user libraries" section of the web service itself. (Putting those there got me past my last fatal error message trying to get this done.) I've seen a post on this error with this class indicating that an "old servlet.jar is probably sitting somewhere."; I cannot find one in either eclipse or the tomcat library directory. There is a servlet-api.jar in the tomcat lib directory, and it actually has the ServletContainerInitializer in it.
This is Tomcat 7, eclipse Juno, and no I don't want to stop and learn Maven first. I saw one other post that said that after the poster had cleaned out and reinstalled the JRE/JDK, Tomcat, and eclipse, the problem went away. I suppose if I buy a new machine it will go away, too, but I'm hoping for something less drastic.
I don't expect anyone to know what the problem is -- can someone tell me how to chase it down? I'm posting the first part of the console log, in case that's any help...
Mar 3, 2013 8:53:41 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\local\derby\bin;C:\Program Files\SlikSvn\bin;C:\Program Files\Java\jre6\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;c:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files (x86)\Windows Live\Shared;.
Mar 3, 2013 8:53:41 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FirstWS' did not find a matching property.
Mar 3, 2013 8:53:42 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 3, 2013 8:53:42 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 3, 2013 8:53:42 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 794 ms
Mar 3, 2013 8:53:42 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 3, 2013 8:53:42 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.37
Mar 3, 2013 8:53:42 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContainerInitializer
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1628)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.catalina.startup.ContextConfig.getServletContainerInitializer(ContextConfig.java:1659)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1569)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1277)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContainerInitializer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 32 more
I am trying to run the tomcat 5.5 but while starting the server it gives the following error.
java.io.IOException: Cannot rename original file to C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
Below is the full stack trace.
`Jun 22, 2012 12:17:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 361 ms
Jun 22, 2012 12:17:44 PM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.io.IOException: Cannot rename original file to C:\Program Files\Apache Soft
ware Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.
java:582)
at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance
(MemoryUserDatabaseFactory.java:104)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF
actory.java:140)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContextBindingsEnumeration.nextElementInterna
l(NamingContextBindingsEnumeration.java:113)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContext
BindingsEnumeration.java:71)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:137)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:109)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycle
Event(GlobalResourcesLifecycleListener.java:81)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:693
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.mbeans.GlobalResourcesLifecycleList
ener createMBeans
SEVERE: Exception processing Global JNDI Resources
javax.naming.NamingException: Cannot rename original file to C:\Program Files\Ap
ache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContextBindingsEnumeration.nextElementInterna
l(NamingContextBindingsEnumeration.java:113)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContext
BindingsEnumeration.java:71)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:137)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:109)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycle
Event(GlobalResourcesLifecycleListener.java:81)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:693
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 22, 2012 12:17:44 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.25
Jun 22, 2012 12:17:44 PM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.io.IOException: Cannot rename original file to C:\Program Files\Apache Soft
ware Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.
java:582)
at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance
(MemoryUserDatabaseFactory.java:104)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF
actory.java:140)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j
ava:253)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.realm.UserDatabaseRealm start
SEVERE: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: Cannot rename original file to C:\Program Files\Ap
ache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j
ava:253)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException: No UserDatabase component found under key UserDatabase
at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j
ava:261)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 102 ms
`
Plz go through this post. You might get an idea for this problem.
http://tomcat.10.n6.nabble.com/Tomcat-within-Eclipse-td2102784.html
Try setting readonly="true" on your UserDatabase Resource element. That will stop Tomcat trying to copy it.
The underlying problem is a permssions one. Whichever user Tomcat is running as, does not have permissions to modify files in the conf directory.