[Persistence, JBoss/CMP, Hibernate, Database] - Re: Could not find datasource message in client JPA although
by ezanih
Thanks for the reply, jakiran.
Ok...I've been doing a lot of reading so let me share with you and all some knowledge :-) but my client still not working :-(
There are 3 ways to add jndi.properties to the client app :- (1) from the Eclipse Run Configuration menu, just add this to the VM arguments:-
| -Djava.naming.provider.url=jnp://localhost:1099
| -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
or you can do like my BidClient.java coding above and put the properties in code
or you can just create a text file, name it jndi.properties and place it in root folder of client app. I've modified my app for this method so I can comment out all the InitialContext code additions and just put
| InitialContext ctx = InitialContext();
|
Much cleaner...Ok...that is settled....
Now I've read some more and it seems JBoss needs two more configurator files at the client side, namely application-client.xml and jboss-client.xml.
I've added these 2 files :-
application-client.xml:
<?xml version="1.0" encoding="UTF-8"?>
|
| <application-client xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
| http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
| version="1.4">
|
| <display-name>BiddingClient</display-name>
|
| <resource-ref>
| <res-ref-name>java:OracleXE1_DS</res-ref-name>
| <res-type>javax.sql.DataSource</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
| </application-client>
|
jboss-client.xml:
| <jboss-client>
| <resource-ref>
| <res-ref-name>java:OracleXE1_DS</res-ref-name>
| <res-type>javax.sql.DataSource</res-type>
| <jndi-name>OracleXE1_DS</jndi-name>
| </resource-ref>
| </jboss-client>
|
Unfortunately, still getting the same error...Unable to find data source and the jndi initial naming error, see below:
Console output :
| [BidClient] : creating EntityManagerFactory...
| log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
| log4j:WARN Please initialize the log4j system properly.
| javax.persistence.PersistenceException: [PersistenceUnit: BiddingTest] Unable to build EntityManagerFactory
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
| at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
| at Main.main(Main.java:61)
| Caused by: org.hibernate.HibernateException: Could not find datasource
| at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)
| at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
| at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
| at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
| at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
| at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
| ... 4 more
| Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
| at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
| at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
| at javax.naming.InitialContext.init(InitialContext.java:223)
| at javax.naming.InitialContext.<init>(InitialContext.java:175)
| at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:51)
| at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
| ... 11 more
| Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
| at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
| at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
| at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
| at java.lang.Class.forName0(Native Method)
| at java.lang.Class.forName(Class.java:242)
| at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
| at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
| ... 16 more
| Exception in thread "main" java.lang.NullPointerException
| at Main.main(Main.java:106)[BidClient] : closing entity manager and factory...
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4198552#4198552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4198552
15 years, 6 months
[JBoss Cache: Core Edition] - Re: Error function when working with passivation.
by kenees
BTW, i was using JDK1.6 and following is some log output:
2008-12-26 13:28:16,415 [Thread-1] DEBUG (AdjListJDBCCacheLoader.java:147) - executing sql: select fqn from jbosscache where parent=? (/testRegion)
| 2008-12-26 13:28:16,509 [Thread-1] INFO (ReadThread.java:40) - currently node (/testRegion) has 20 subnodes
| 2008-12-26 13:28:16,509 [Thread-1] INFO (ReadThread.java:44) - Get value 'Name is Ramon 15, age is 20.' in node '/testRegion/15'.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,025 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,056 [EvictionTimer-0] DEBUG (BaseEvictionAlgorithm.java:438) - Visiting node that was not added to eviction queues. Assuming that it has 1 element.
| 2008-12-26 13:28:20,134 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:20,290 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:20,447 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:20,603 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:20,806 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:20,978 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:21,134 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:21,290 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:21,447 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:21,634 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:21,790 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:21,962 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:22,118 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:22,290 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:22,478 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:22,634 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:22,806 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:22,978 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:23,134 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:23,290 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:23,462 [EvictionTimer-0] DEBUG (AdjListJDBCCacheLoader.java:580) - executing sql: update jbosscache set node=? where fqn=?
| 2008-12-26 13:28:26,525 [Thread-1] DEBUG (AdjListJDBCCacheLoader.java:147) - executing sql: select fqn from jbosscache where parent=? (/testRegion)
| 2008-12-26 13:28:26,618 [Thread-1] INFO (ReadThread.java:40) - currently node (/testRegion) has 20 subnodes
| 2008-12-26 13:28:26,618 [Thread-1] DEBUG (AdjListJDBCCacheLoader.java:431) - executing sql: select node from jbosscache where fqn=? (/testRegion/19)
| 2008-12-26 13:28:26,790 [Thread-1] DEBUG (AdjListJDBCCacheLoader.java:147) - executing sql: select fqn from jbosscache where parent=? (/testRegion/19)
| 2008-12-26 13:28:26,868 [Thread-1] DEBUG (ActivationInterceptor.java:215) - no children UnversionedNode[ /testRegion/19]
| 2008-12-26 13:28:26,947 [Thread-1] INFO (ReadThread.java:44) - Get value 'null' in node '/testRegion/19'.
Pay attention to the RED color, you can see from the log that before passivation everything work well, but after passivation, when the read thread try to activation, the reader got nothing.
And also there is some following statements, I don't know what that mean...Is there a relationship?
Visiting node tha
t was not added to eviction queues. Assuming that it has 1 element.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4198544#4198544
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4198544
15 years, 6 months
[EJB/JBoss] - EJB invokation happens locally event if remote lookup is per
by unnis
Hi,
I am having 2 jboss application server in which i am deploying same ear . From the fist application server I want to lookup and invoke the ejbs belongs to second application server.
For that i am writing the following code
| Properties properties = new Properties();
| properties.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
| properties.put(Context.PROVIDER_URL, "second jboss IP" + ":1099");
| context = new InitialContext(properties);
|
| Object objectRef = context.lookup("MyEjb");
| MyEjbHome myHome = (MyEjbHome) PortableRemoteObject.narrow(objectRef, MyEjbHome.class);
| MyEjbRemote myRemote = myHome .create();
|
| String x = myRemote .getVal();
|
Even if i have given IP of remote jboss server while creating initial context, it is always invoking the EJB belongs to first jboss server.My first application server is also having corresponding ejbs deployed. If i am not having those EJB in my first application server remote lookup is performed.
I am using jboss 3.2.7 and jdk 1.4
Any help is appreciated
Thanks & Regards
unnis
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4198543#4198543
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4198543
15 years, 6 months