In our application we must dynamically connect different users to different 
databases.  According to a previous thread: 
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=77371

we can use Ejb3Configuration() to eliminate the need for Persistent.xml


Hoping this is the right solution, I started with:


  | 
  |         Properties properties = new Properties();        
  |         
properties.put("cache.provider_class","org.hibernate.ejb.HibernatePersistence");
  |            
properties.put("hibernate.transaction.factory_class.","org.hibernate.ejb.HibernatePersistence");
  |         properties.put("connection.datasource","java:/testDS");
  |         
properties.put("hibernate.dialect","org.hibernate.dialect.SQLServerDialect");
  |         
properties.put("hibernate.transaction.flush_before_completion","true");
  |         properties.put("hibernate.hbm2ddl.auto","update");
  |         properties.put("hibernate.show_sql","true");      
  | 
  | 
  |         Ejb3Configuration cfg = new Ejb3Configuration();
  |         EntityManagerFactory emf =
  |             cfg.addProperties( properties ) 
  |             .createEntityManagerFactory(); 
  | 
  |        EntityManager em = emf.createEntityManager();  
  | 

But the following NoClassDefFoundError is raised:



  | 
  | javax.ejb.EJBException: java.lang.RuntimeException: 
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
  |         at 
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
  |         at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  |         at 
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  |         at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at 
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  |         at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at 
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  |         at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at 
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  |         at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at 
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  |         at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at 
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  |         at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at 
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
  |         at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  |         at 
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  |         at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
  |         at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
  |         at 
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
  |         at 
org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
  |         at 
org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
  | 
  | 



Please help 
Many thanks in advnance.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3944116#3944116

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3944116


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to