facebook

No ClassLoaders found for: net.sf.hibernate.jmx.HibernateSer

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #259558 Reply

    arupsarkar
    Member

    Hi:

    JBoss version 4.0.2
    Jdk 1.4.2
    MySql 5.0
    Myeclipse ide

    I have created a Hibernate capable project. I am using a service locator to identify the Hibernate Session Factory and Session using JNDI. I have created a hibernate.cfg.xml. I am also using hibernate doclet to generate jboss-service.xml, but I am getting the following error during deployment.

    “org.jboss.deployment.DeploymentException: No ClassLoaders found for: net.sf.hibernate.jmx.HibernateService; – nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: net.sf.hibernate.jmx.HibernateService)”

    Any help would be highly appreciated.

    Regards
    Arup

    /***** Service Locator code ****/

    public static SessionFactory getHibernateSessionFactory(String jndiSessionFactoryName) throws ServiceLocatorException {
    SessionFactory sessionFactory = null;

    try {
    Context ctx = new InitialContext();
    sessionFactory = (SessionFactory) ctx.lookup(jndiSessionFactoryName);

    } catch (ClassCastException cce) {
    throw new ServiceLocatorException(cce);
    } catch (NamingException ne) {
    throw new ServiceLocatorException(ne);
    }

    return sessionFactory;
    }

    public static Session getHibernateSession(String jndiSessionFactoryName) throws ServiceLocatorException {
    Session session = null;

    try
    {
    session = getHibernateSessionFactory(jndiSessionFactoryName).openSession();
    }
    catch (Exception e)
    {
    throw new ServiceLocatorException(e);
    }
    return session;
    }

    /**** code hibernate.cfg.xml *****/

    <?xml version=’1.0′ encoding=’UTF-8′?>
    <!DOCTYPE hibernate-configuration PUBLIC
    “-//Hibernate/Hibernate Configuration DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd”&gt;

    <!– Generated by MyEclipse Hibernate Tools. –>
    <hibernate-configuration>

    <session-factory>
    root

    jdbc:mysql://localhost:3307/test

    net.sf.hibernate.dialect.MySQLDialect

    Jaw
    elkh0107

    com.mysql.jdbc.Driver

    </session-factory>

    </hibernate-configuration>

    /********** jboss-service.xml **********/

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE server>

    <!– Generated file – Do not edit! –>

    /***** code of HibernateCarDAO *****************/

    public class HibernateCarDAO implements CarDAO{

    private static final String HIBERNATE_SESSION_FACTORY=”java:comp/env/hibernate/SessionFactory”;

    public HibernateCarDAO()
    {}

    public List findAll()
    {
    List carList = new ArrayList();
    Session session = null;

    try
    {
    session = ServiceLocator.getHibernateSession(HIBERNATE_SESSION_FACTORY);
    Criteria criteria = session.createCriteria(CarDTO.class);
    carList = criteria.list();
    }
    catch (Exception e)
    {
    System.out.println(e);
    }
    finally
    {
    try
    {
    if (session != null) {session.close();}
    }
    catch (Exception e)
    {
    System.out.println(e);
    }
    }

    return carList;
    }

    }

    #259564 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: No ClassLoaders found for: net.sf.hibernate.jmx.HibernateSer

You must be logged in to post in the forum log in