[Persistence, JBoss/CMP, Hibernate, Database] - No Class Loader error during deploy
by arupsarkar
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">
<!-- 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! -->
jboss.jca:service=RARDeployer
com/jbossatwork/dto/CarDTO.hbm.xml
java:/hibernate/SessionFactory
java:/MySqlDS
net.sf.hibernate.dialect.MySQLDialect
false
false
net.sf.hibernate.transaction.JBossTransactionManagerLookup
/***** 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;
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975177#3975177
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975177
19 years, 2 months
[JBoss Seam] - how to write a code
by nako_ruru
I have 3 classes. User, RoleRef, Role
| public class User {
|
| public void setId(int id) {
| ...
| }
|
| public int getId() {
| return ...;
| }
|
| }
|
| public class Role {
|
| public void setId(int id) {
| ...
| }
|
| public int getId() {
| return ...;
| }
|
| }
|
| public class RoleRef {
|
| private User user;
| private Role role;
|
| public User getUser() {
| return user;
| }
|
| public Role getRole() {
| return role;
| }
|
| public void setUser(User user) {
| this.user = user;
| }
|
| public void setRole(Role role) {
| this.role = role;
| }
|
| public boolean equals(Object o) {
| if(o == this) {
| return true;
| } else if(o == null) {
| return false;
| } else if(o instanceof RoleRef) {
| RoleRef referrence = (RoleRef) o;
| return user.equals(referrence.user) && role.equals(referrence.role);
| } else {
| return false;
| }
| }
|
| }
|
The mapped tables are respective role, roleref, user.
Now assume that I have an instance of User, how can I write criteria code which is the same as sql expression as below.
"select role.* from user, roleref, role where user.id = roleref.uid && roleref.rid = role.id".
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975176#3975176
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975176
19 years, 2 months
[JBoss Getting Started Documentation] - Re: jboss-web.xml
by PeterJ
Maybe this will help. Here is a excerpt from one of my WEB-INF/web.xml files:
<ejb-ref>
| <ejb-ref-name>ProductSessionRemote</ejb-ref-name>
| <ejb-ref-type>Session</ejb-ref-type>
| <home>com.unisys.orp.product.ejb.ProductSessionRemoteHome</home>
| <remote>com.unisys.orp.product.ejb.ProductSessionRemote</remote>
| <ejb-link>ProductSessionRemote</ejb-link>
| </ejb-ref>
| <ejb-ref>
| <ejb-ref-name>OrderSessionRemote</ejb-ref-name>
| <ejb-ref-type>Session</ejb-ref-type>
| <home>com.unisys.orp.product.ejb.OrderSessionRemoteHome</home>
| <remote>com.unisys.orp.product.ejb.OrderSessionRemote</remote>
| <ejb-link>OrderSessionRemote</ejb-link>
| </ejb-ref>
| <ejb-ref>
| <ejb-ref-name>CalculatorRemote</ejb-ref-name>
| <ejb-ref-type>Session</ejb-ref-type>
| <home>com.unisys.orp.rpn.ejb.CalculatorEJBRemoteHome</home>
| <remote>com.unisys.orp.rpn.ejb.CalculatorEJBRemote</remote>
| <ejb-link>CalculatorRemote</ejb-link>
| </ejb-ref>
And here is the WEB-INF/jboss-web.xml file that goes with it:
<?xml version='1.0' encoding='UTF-8' ?>
| <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
| <jboss-web>
| <ejb-ref>
| <ejb-ref-name>ProductSessionRemote</ejb-ref-name>
| <jndi-name>ProductSessionRemote</jndi-name>
| </ejb-ref>
| <ejb-ref>
| <ejb-ref-name>OrderSessionRemote</ejb-ref-name>
| <jndi-name>OrderSessionRemote</jndi-name>
| </ejb-ref>
| <ejb-ref>
| <ejb-ref-name>CalculatorRemote</ejb-ref-name>
| <jndi-name>CalculatorRemote</jndi-name>
| </ejb-ref>
| </jboss-web>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975171#3975171
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975171
19 years, 2 months
[JBoss Seam] - Some latin characteres are not rendered properly
by rlhr
Hello,
I'm using jboss-seam-1.0.1.GA CVS build 20060917.
The problem I'm dealing with might not be due to Seam but to JSF. I'm not sure so I thought I'd ask.
In a properties file, I have all the french translation of the english properties.
Let say I have the following string in the english file:
SUMMER = summer
and in the french one:
SUMMER = été
The internationalization works fine, but when I try to create a javascript variable that will hold that value doing the following:
var test = "#{messages.SUMMER}";
This will render the following:
| var test = "&# 233;t&# 233;"; // with no space between &# and 233.
|
Also if I create a remote method that gives me back that string, I get the same &# 233;t&# 233; instead of été.
When using a <h:outputText> tag inside a view tag, it works fine.
The xhtml file starts by
<?xml version="1.0" encoding="ISO-8859-1" ?>
| So it should be fine I thought.
Any clue about what's going on?
Thanks,
Richard
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975170#3975170
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975170
19 years, 2 months
[Persistence, JBoss/CMP, Hibernate, Database] - Using jboss.xml entries to mimic Weblogic's <db-isshared> tr
by jmakas
I'm porting an old EBJ1.1 application, which was running on Weblogic, to JBoss AS 4.0.4. The port is complete and all works very well, except for the fact that I need to disable the container's EJB cache. The database unfortunately is being shared with another backend application, and data modification can occur from either system. In Weblogic, there is a weblogic-ejb-jar.xml attribute called <db-is-shared>, that if set to "true" forces the container to persist or refresh on every method call. How can I mimic this functionality in JBoss?
I know that EJB1.1 was a poor technology for what this application has evolved into. And the application is being rearchitected towards an EJB3.0 or pure Hibernate design; however, it needs to be up and running for a bit in its original state.
Any assistance with this issue would be greatly appreciated!
Thanks in advance,
-- j --
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975169#3975169
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975169
19 years, 2 months