[JCA/JBoss] - Problem using JBoss Datasource
by jborter
Hi
I have serious problems using a JBoss Datasource. From the documentation it seems to be easy... What I've done:
Created file oracle-ds.xml and moved it into the directory server/default/deploy. It looks like this:
| <?xml version="1.0" encoding="UTF-8" ?>
| <datasources>
| <no-tx-datasource>
| <jndi-name>/myOracleDS</jndi-name>
| <use-java-context>
| true
| </use-java-context>
| <connection-url>
| jdbc:oracle:thin:@localhost:1521:TESTDB
| </connection-url>
| <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
| <user-name>TESTER</user-name>
| <password>TESTER</password>
| <min-pool-size>1</min-pool-size>
| <max-pool-size>5</max-pool-size>
| <metadata>
| <type-mapping>Oracle9i</type-mapping>
| </metadata>
| </no-tx-datasource>
| </datasources>
|
As JBoss starts, it displays that this succeeded:
| INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=/myOracleDS' to JNDI name 'java:/myOracleDS'
|
I also created an EJB which has the following JAVA code:
|
| @Stateless(name="oracleConnectionPool")
| public class OracleConnectionPoolImpl implements OracleConnectionPool {
|
| @Resource(mappedName="java:/myOracleDS")
| private DataSource ds;
|
| public Connection getOracleConnection() {
| try {
| return ds.getConnection();
| } catch (SQLException ex) {
| ex.printStackTrace();
| }
|
| return null;
| }
| }
|
As I lookup this EJB and call the method getOracleConnection() from another class, I get a really strange Exception:
|
| java.lang.IllegalArgumentException: failed to set value org.jboss.resource.adapter.jdbc.WrapperDataSource@c1c2f1 on field private javax.sql.DataSource OracleConnectionPoolImpl.ds
| at org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:85)
| at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
| at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:83)
| at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:55)
| at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:111)
| at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:61)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| 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.localInvoke(StatelessContainer.java:214)
| at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
| at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
| at $Proxy175.getOracleConnection(Unknown Source)
| at TestOracleConnection.getStatement(...)
| ...
|
Does anyone has an idea of how to solve this problem?
Tnx & cheers, Jbo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079998#4079998
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079998
16Â years, 10Â months
[JBoss Portal] - Re: CMS
by lucboudreau
More about that...
It's weird because I can't write anything at the root of the CMS repository. I get an AccessDenidedException even if I have Administrator privileges. I can validate that I have those privileges because they get written in the database.
Also note that I didn't use the bundeled portal download package, since I needed JBoss 4.0.5 along with Portal 2.6.1. This portal version usually ships with JBoss AS 4.2 or something I think.
I've also tried to monitor the database logs and I confirm that when I create elements in the repository, they don't get created in the database. Only an access rights validation is done.
I can't even find where the data gets written when I create elements in the CMS repository. I can't find it's trace in the DB, nor in the file system. Does it get created in memory but JBoss cache blocks it from beeing written ? How can I verify that ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079995#4079995
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079995
16Â years, 10Â months
[JBoss Messaging] - Re: JMSMessageID in Messaging cluster
by beve
Hi,
we are calling the gettting the JMSMessageID after the send method returns. My understanding is that the jms provider will generate the JMSMessageID when it receives the message. The id looks like a valid id (it is not "ID:JBM-0").
The senario we have is that when a consumer retrieves the jms message from a clustered queue, the message id is not the same as the one the client has. Thus correlation using the message id does not work and one has to set a custom correlation id on the message prior to sending.
Yes, this we are currently using a custom genererated GUID to correlate the messages and this works fine.
The reason for posting is that we have been been correlating messages using the message id with JBoss ESB, and with version 1.3 this worked as expected. Could you just confirm that we can no longer do this and the only option for clients is to use a custom correlation id? We need to make changes to relect this.
Thanks,
Daniel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079994#4079994
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079994
16Â years, 10Â months
[Persistence, JBoss/CMP, Hibernate, Database] - @Entitylisteners
by motte1979
Hi ,
Is there a seam-way to implement @Entitylisteners ? I've read in the book 'Java Persistence with Hibernate' that the user of EntityManagers is not allowed in callbacks. However; thats the usecase:
I've two Entities which are associated through a @ManyToMany association and i like to implement a last-save-wins-strategy for this set.
|
| @Entity
| @Table (name="t_foo")
| @EntityListeners(value={Foolistener.class})
| public class Foo {
| @Id
| private Long id;
|
| @Basic
| private String name;
|
| @ManyToMany (fetch=FetchType.LAZY)
| @JoinTable (name="t_foo_bar",
| joinColumns=@JoinColumn(name="foo_id"),
| inverseJoinColumns=@JoinColumn(name="bar_id"))
| private Set<Bar> bars;
|
| .....
|
| }
|
|
|
| @Entity
| @Table (name="t_bar")
| public class Bar {
| @Id
| private Long id;
| @Basic
| private String name;
| @ManyToMany (fetch=FetchType.LAZY, mappedBy="bars")
| private Set<Foo> foos;
|
| ....
| }
|
|
| public class Foolistener {
|
| @PrePersist
| public void prePersist (Foo foo) {
| // delete the all entries in t_foo_bar which
| // reference too foo.getId()
| }
|
| @PreUpdate
| public void preUpdate (Foo foo) {
| // delete the all entries in t_foo_bar which
| // reference too foo.getId()
| }
|
| }
|
The first issue on this is, that the callback is only called if the Entity-fields are changed, but not, if the included set changed only. Does anyone know why?
I know i could add a 'changed-set' - flag .. which is not very comfortable if the set is changed directly ;)
I tried to add @Name and @In annotations to the FooListener - but this seems not to work.
I've not much experience with Hibernate-jpa because i worked with jpox-jdo before. If i remember correctly it was no problem to have (restricted) database-access in callback-methods .
Any ideas ?
(see also http://www.jboss.com/index.html?module=bb&op=viewtopic&t=117557[/url])
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079991#4079991
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079991
16Â years, 10Â months