[JCA/JBoss] - Creating a WrapperDataSource
by ezeqgarcia
Hello,
I use a C3P0 Connection Pool, but, i have many problems, because my connections pools need to be created dinamically.
I do test with connection pool of JBoss and my problems disappear.
The question, is that i need create a pool, in other words, instantiate a DataSource and bind to JNDI, dinamically, and i would like that this connection pool (DataSource) was the JBoss pool.
I can't create a -ds.xml file, because my information to connection don't exist in startup time of JBoss.
I tried instantiate a WrapperDataSource, but, this class need for two parameters: "final BaseWrapperManagedConnectionFactory mcf, final ConnectionManager cm", and i don't known how do i do.
Somebody help me?
Regards.
Ezequiel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040412#4040412
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040412
19 years
[Installation, Configuration & Deployment] - when i deployed a Spring project on jboss , i encoutered a er
by bill.cheng
i deployed a project on jboss-4.2.when i started jboss,i encoutered a error.Below is the error. But i use JUnit for testing , all testcases run well.
My project includes two projects ,one is ejb project ,another is web project.I place ApplicationContext.xml and *.hbm.xml file on the root of ejb project. i added item of "contextConfigLocation" and "org.springframework.web.context.ContextLoaderList ener" to web.xml.
In test environment,I used a ClassPathXmlApplicationContext for obtaining a bean. TestCases run well.
Exception:
18:36:05,562 INFO [STDOUT] 18:36:05,546 ERROR [ContextLoader] Context initialization failed
| org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'partnerInfoDao' defined in file [C:\jboss-4.2.0.CR1.by.bnet3\jboss-4.2.0.CR1\server\default\deploy\bsr.ear\bsrEJB.jar\spring\dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy79] to required type [org.hibernate.SessionFactory] for property 'sessionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy79] to required type [org.hibernate.SessionFactory] for property 'sessionFactory': no matching editors or conversion strategy found
| Caused by:
| org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy79] to required type [org.hibernate.SessionFactory] for property 'sessionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy79] to required type [org.hibernate.SessionFactory] for property 'sessionFactory': no matching editors or conversion strategy found
| Caused by:
| java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy79] to required type [org.hibernate.SessionFactory] for property 'sessionFactory': no matching editors or conversion strategy found
| at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:227)
| at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
| at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380)
application context
| <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
| xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
| http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
| http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
| default-autowire="byName">
|
| <aop:config>
| <aop:pointcut id="defaultServiceOperation"
| expression="execution(* com.gsww.bnet..*service.impl.*Impl.*(..))"/>
| <aop:advisor pointcut-ref="defaultServiceOperation" advice-ref="defaultTxAdvice"/>
| </aop:config>
|
| <tx:advice id="defaultTxAdvice" transaction-manager="transactionManager">
| <tx:attributes>
| <tx:method name="get*" read-only="true"/>
| <tx:method name="*"/>
| </tx:attributes>
| </tx:advice>
|
| <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
| <property name="locations">
| <list>
| <value>classpath:jdbc.properties</value>
| </list>
| </property>
| </bean>
|
| <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
| <property name="driverClassName">
| <value>${jdbc.driverClassName}</value>
| </property>
| <property name="url">
| <value>${jdbc.url}</value>
| </property>
| <property name="username">
| <value>${jdbc.username}</value>
| </property>
| <property name="password">
| <value>${jdbc.password}</value>
| </property>
| </bean>
|
| <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
| <property name="dataSource" ref="dataSource"/>
| <property name="hibernateProperties">
| <props>
| <prop key="hibernate.dialect">${hibernate.dialect}</prop>
| </props>
| </property>
| <property name="mappingDirectoryLocations">
| <list>
| <value>classpath*:hibernate</value>
| </list>
| </property>
| </bean>
|
| <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
| <property name="sessionFactory" ref="sessionFactory"/>
| </bean>
|
| <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
| <property name="sessionFactory" ref="sessionFactory"/>
| </bean>
| <bean id="partnerInfoDao" class="com.gsww.bnet.bsr.partner.dao.PartnerInfoDao" />
| <bean id="partnerUserDao" class="com.gsww.bnet.bsr.partner.dao.PartnerUserDao" />
| <bean id="partnerAppDao" class="com.gsww.bnet.bsr.marketing.app.dao.PartnerAppDao" />
| <bean id="applealingOrderDao" class="com.gsww.bnet.bsr.cs.dao.AppealingOrderDao" />
|
Java class:
I defined a Class like below for supporting generic type ?
| import org.apache.commons.beanutils.PropertyUtils;
| import org.hibernate.Criteria;
| import org.hibernate.FlushMode;
| import org.hibernate.Query;
| import org.hibernate.criterion.CriteriaSpecification;
| import org.hibernate.criterion.MatchMode;
| import org.hibernate.criterion.Projection;
| import org.hibernate.criterion.Projections;
| import org.hibernate.criterion.Restrictions;
| import org.hibernate.impl.CriteriaImpl;
| import org.springframework.orm.ObjectRetrievalFailureException;
| import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
| import org.springframework.util.Assert;
|
|
| import java.io.Serializable;
| import java.lang.reflect.InvocationTargetException;
| import java.util.ArrayList;
| import java.util.List;
| import java.util.regex.Matcher;
| import java.util.regex.Pattern;
|
| public class HibernateGenericDao extends HibernateDaoSupport {
|
| public <T> T get(Class<T> entityClass, Serializable id) {
| T o = (T) getHibernateTemplate().get(entityClass, id);
| if (o == null)
| throw new ObjectRetrievalFailureException(entityClass, id);
| return o;
| }
| ........
|
and defined another abstract class for some methods ,
| import org.apache.log4j.Logger;
| import org.hibernate.Criteria;
| import com.gsww.util.GenericsUtils;
| import java.io.Serializable;
| import java.util.List;
| abstract public class HibernateAbstractDao<T> extends HibernateGenericDao {
| protected Logger log = Logger.getLogger(getClass().getName());
|
| protected Class<T> entityClass;
| ......
|
| public class PartnerAppDao extends HibernateAbstractDao<PartnerApp> {
|
| }
|
i deleted the hibernate.jar that jboss ships and added another hibernate.jar to jboss_home/server/default/lib. i guess it's not the problem of version .
Thank you very much!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040405#4040405
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040405
19 years
[JBoss Seam] - trace level logging on Jboss AS
by matt.drees
>From looking at the Log4JProvider class, it looks like log.trace simply does a log.debug call (log4j doesn't have trace). I'd like to be able to differentiate between trace and debug, but I don't see an easy way to do that. If I could override Log4JProvider, I could have "trace" do something besides log.debug, but it doesn't look like we can plug in our own LogProviders.
If it isn't too much work, could we be given control of which LogProvider Seam uses? I imagine it'd be hard to make it a component, because logging needs to be available before components are loaded; but there is probably another way.
If that isn't going to happen, can anyone suggest a workaround to enable trace logging?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040404#4040404
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040404
19 years
[Installation, Configuration & Deployment] - Classloader problems
by viniciuscarvalho
Hi there! I'm having a few problems with the UCL and jboss seam :(
I have two applications with different jsf versions, so I need classloading isolation (using jboss-app.xml for that). So far things were ok.
I also have a sar deployment (jbpmConfiguration).
So both applications have classloading isolation. and both ships with their own jbpm-lib. The sar has its own as well, and all of 'em on the same version (3.2 btw)
The problem is that one of the applications do a jndi lookup on a jbpmconfiguration registred by the sar application.
And when I cast : ClassCastException org.jbpm.JbpmConfiguration can not be cast to org.jbpm.JbpmConfiguration
It was ok, since they have have different classloaders right?
So I've put the jbpm libs under the server/lib, and remove them from all the applications. The classloader isolation was kept because the jsf libs problem...
Well I was hopping that even with different classloaders, the root classloader would be the same hence it would work. Well, it did not :(
How can I solve this?
Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040403#4040403
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040403
19 years