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 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
