-
JBoss Initial Context (14 messages)
- Posted by: Daniel c
- Posted on: June 02 2004 18:49 EDT
Hi all, I need some help for define my initial context for JBoss i have this:
private Context getInitialContext() throws Exception {
Properties properties = null;
try {
properties = new Properties();
properties.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.setProperty("java.naming.provider.url", "http://localhost:1099");
properties.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces.NamingContextFactory");
}
catch (Exception ex) {
error += ex.getMessage();
}
return new InitialContext(properties);
}
But it don't works, any help?Threaded Messages (14)
- Can you post more information! by Chandra Vadlamani on June 02 2004 20:19 EDT
- more info required by krishna kishore on June 03 2004 04:14 EDT
- more info required by Arun Nair on June 03 2004 05:56 EDT
- ejb with jboss by akhil reddy on April 01 2010 00:54 EDT
- JBoss Initial Context by Daniel c on June 03 2004 11:25 EDT
- JBoss Initial Context by Daniel c on June 03 2004 17:55 EDT
- JBoss Initial Context by Daniel c on June 03 2004 18:01 EDT
- JBoss Initial Context by Arun Nair on June 04 2004 04:10 EDT
- JBoss Initial Context by Daniel c on June 03 2004 18:01 EDT
- JBoss Initial Context by Vyacheslav Zakovyrya on June 04 2004 10:52 EDT
- JBoss Initial Context by Udayan Patel on June 04 2004 11:05 EDT
- JBoss Initial Context by Daniel c on June 04 2004 12:35 EDT
- JBoss Initial Context by Daniel c on June 04 2004 21:17 EDT
- JBoss Initial Context by Vyacheslav Zakovyrya on June 05 2004 04:50 EDT
- JBoss Initial Context by Vyacheslav Zakovyrya on June 05 2004 07:19 EDT
-
Can you post more information![ Go to top ]
- Posted by: Chandra Vadlamani
- Posted on: June 02 2004 20:19 EDT
- in response to Daniel c
Can you post more information, is localhost resolving on your box? The same configuration works for me on my 3.2.3 setup of jboss? -
more info required[ Go to top ]
- Posted by: krishna kishore
- Posted on: June 03 2004 04:14 EDT
- in response to Daniel c
Hie..
Can u give me more info regarding the error u r getting .....
krishna kishore -
more info required[ Go to top ]
- Posted by: Arun Nair
- Posted on: June 03 2004 05:56 EDT
- in response to krishna kishore
What error ?. error stack trace pls
-arun -
ejb with jboss[ Go to top ]
- Posted by: akhil reddy
- Posted on: April 01 2010 00:54 EDT
- in response to krishna kishore
hi hello ,
can i know how to integrate or deploying in the jboss
as i am getting the error like this ..........since i used to do with weblogic right now i am not having weblogic and i am using jboss 5.0.error is like this
Exception in thread "main"
javax.naming.NoInitialContextException: Cannot instantiate class: jboss.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: jboss.jndi.WLInitialContextFactory]at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.(Unknown Source)
at com.nit.ejb2.TestClient.main(
TestClient.java:14)Caused by:
java.lang.ClassNotFoundException: jboss.jndi.WLInitialContextFactoryat java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(
Native Method)at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(
Native Method)at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
... 5 more
i have wriitenn small slsb programme but i want to deploy the jar in jboss but it is showing the above error
-
JBoss Initial Context[ Go to top ]
- Posted by: Daniel c
- Posted on: June 03 2004 11:25 EDT
- in response to Daniel c
Ok I have an application that runs on weblogic 8.1, but I want to change to the jboss application server, in the application I use EJBs 2.0 and relationships, I am using JBuilder 9 as IDE, I configure JBuilder to use JBoss and it automatically generate the ejb-jax.xml, jboss.xml and jbosscmp-jdbc.xml
********when I call a finder for example, I do this***************
try {
context = getInitialContext();
Object homeObject = context.lookup("apas.ApasAsociacionRemote");
asociacionHome = (ApasAsociacionRemoteHome) PortableRemoteObject.
narrow(
homeObject, ApasAsociacionRemoteHome.class);
Integer tipIdentInt = new Integer(0);
Long numIdentLong = new Long(601620454);
answer = asociacionHome.getByTipIdentNumIdent(
tipIdentInt, numIdentLong);
}
catch (Exception ex) {
error += ex;
}
********This is the function that return the initialContext**********
private Context getInitialContext() throws Exception {
Properties properties = null;
try {
properties = new Properties();
properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url","http://localhost:1099");
properties.put("java.naming.factory.url.pkgs", "org.jnp.interfaces.NamingContextFactory");
}
catch (Exception ex) {
error += ex.getMessage();
}
return new InitialContext(properties);
}
********************* This is the error*****************
08:32:09,592 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
ame=apas.ApasAsociacionSocioRemote,service=EJB
org.jboss.deployment.DeploymentException: Mappings were not provided for all fie
lds: unmaped fields=[tip_Identificacion, num_Identificacion] in role=ApasAsociac
ionSocioRelationshipRole
********************* Also ***********************
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Mappings were not prov
ided for all fields: unmaped fields=[tip_Identificacion, num_Identificacion] in
role=ApasAsociacionSocioRelationshipRole, ObjectName: jboss.j2ee:jndiName=apas.A
pasAsociacionSocioRemote,service=EJB
state: FAILED
*****************************************************
tip_Identificacion, num_Identificacion are the keys of the EJB
Thanks for your help
regards Daniel -
JBoss Initial Context[ Go to top ]
- Posted by: Daniel c
- Posted on: June 03 2004 17:55 EDT
- in response to Daniel c
Ok, i only upload one EJB and I get this exception:
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] -
JBoss Initial Context[ Go to top ]
- Posted by: Daniel c
- Posted on: June 03 2004 18:01 EDT
- in response to Daniel c
That on my application with a try catch and on the JBoss console:
16:02:08,857 WARN [NamingContext] Failed to connect to http:1099
javax.naming.CommunicationException: Failed to connect to server http:1099. Roo
t exception is
javax.naming.ServiceUnavailableException: Failed to connect to server http:1099.
Root exception is
java.net.UnknownHostException: http: http
at java.net.InetAddress.getAllByName0(InetAddress.java:948)
at java.net.InetAddress.getAllByName0(InetAddress.java:918)
at java.net.InetAddress.getAllByName(InetAddress.java:912)
at java.net.InetAddress.getByName(InetAddress.java:832)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory...
Please I need help!
Regards Daniel -
JBoss Initial Context[ Go to top ]
- Posted by: Arun Nair
- Posted on: June 04 2004 04:10 EDT
- in response to Daniel c
2004-06-04 08:16:22,490 INFO [org.jboss.ejb.EjbModule] Deploying OutstandingOrders
...
...
2004-06-04 08:16:24,271 INFO [org.jboss.ejb.plugins.StatelessSessionInstancePool] Started jboss.j2ee:jndiName=OutstandingOrders,plugin=pool,service=EJB
2004-06-04 08:16:24,271 INFO [org.jboss.ejb.StatelessSessionContainer] Started jboss.j2ee:jndiName=OutstandingOrders,service=EJB
If your bean is deployed then you would get something like this on Server console for your EJB. Check out that...for your Bean. Ignore my Bean name !!
My guess would be there is problem in the deployment descriptor defining the CMP fields with DD columns. Check that as well to make sure that all the field mappings including primary key are correct in the deployment descriptor.
And also becasue you have defined localhost in the context look-up, I belive the server running locally ?. -
JBoss Initial Context[ Go to top ]
- Posted by: Vyacheslav Zakovyrya
- Posted on: June 04 2004 10:52 EDT
- in response to Daniel c
There is an error in your parameters for JBoss Initial Context.properties.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces.NamingContextFactory");
Value for "java.naming.factory.url.pkgs" should be defined as "org.jboss.naming:org.jnp.interfaces".
As for me I use "jndi.properties" file for getting Initial Context. This way is much easier and portable.
---------------------------------8<---------------------------------
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost
---------------------------------8 -
JBoss Initial Context[ Go to top ]
- Posted by: Udayan Patel
- Posted on: June 04 2004 11:05 EDT
- in response to Vyacheslav Zakovyrya
Ummmmm..... I thought the URL to your naming perovider should start with jnp. Am I smoking something? jnp://localhost:1099 shound't it look like this???? -
JBoss Initial Context[ Go to top ]
- Posted by: Daniel c
- Posted on: June 04 2004 12:35 EDT
- in response to Daniel c
OK Arun Nair, thanks for answer, I saw in the JBoss console and I find something the same
that appears for your bean:
10:20:39,411 INFO [EjbModule] Deploying ApasSocio
10:20:40,726 INFO [ApasSocio] Table 'APAS_SOCIO' already exists
10:20:40,868 INFO [EntityInstancePool] Started jboss.j2ee:jndiName=apas.ApasSoc
ioRemote,plugin=pool,service=EJB
10:20:40,868 INFO [EntityContainer] Started jboss.j2ee:jndiName=apas.ApasSocioR
emote,service=EJB
10:20:40,868 INFO [EjbModule] Started jboss.j2ee:module=ModuleAPAS.jar,service=
EjbModule
10:20:40,868 INFO [EJBDeployer] Deployed: file:/C:/jboss-3.2.3/server/default/d
eploy/ModuleAPAS.jar
Its ok??
Ok Vyacheslav Zakovyrya thanks for answer, I will make that properties file, its better you
are Right, I modify the properties like this
properties.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.setProperty("java.naming.provider.url", "jnp://localhost:1099");
properties.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
I also make the change that Udayan Patel (thanks for answer), ant put jnp instead http
******************************************************************************
With all this change I get a new error:
javax.naming.NameNotFoundException: apas.ApasSocioRemote not bound On a try catch of my application
it seem that in the console I don't get any error. apas.ApasSocioRemote its the home JNDI name of my EJB
and I make references to it in this way:
...
Object homeObject = context.lookup("apas.ApasSocioRemote");
...
Regards Daniel -
JBoss Initial Context[ Go to top ]
- Posted by: Daniel c
- Posted on: June 04 2004 21:17 EDT
- in response to Daniel c
I forget to say I'm connecting to a SQL server:
I create this xml for the DataSource: (I name it "mssql.xml" it's that ok?, I put it on the directory: C:\Program Files\jboss-3.2.3\server\default\deploy, and I delete hsqldb-ds.xml It's that Ok?) :
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>DataSource</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://localhost:1433;user=xxx;password=yyy</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>xxx</user-name>
<password>yyy</password>
</local-tx-datasource>
</datasources>
With this I received this error on the console:
Depends On Me: , ObjectName: jboss.j2ee:jndiName=apas.ApasSocioRemote,service=E
JB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Error: can't find data
source: java:/DefaultDS; - nested throwable: (javax.naming.NameNotFoundExceptio
n: DefaultDS not bound)]
Please help me, I'm new on JBoss but I want to learn to use it, thanks. -
JBoss Initial Context[ Go to top ]
- Posted by: Vyacheslav Zakovyrya
- Posted on: June 05 2004 04:50 EDT
- in response to Daniel c
1. 'jndi.properties' file should be in your classpath. In this case body your method will be looking as:
---------------------------------8<---------------------------------
private Context getInitialContext() throws NamingException {
return new InitialContext(); // this is simple, right? :)
}
---------------------------------8<---------------------------------
2. Just try to use my 'jndi.properties'. Change only name of host (localhost) if you need it.
---------------------------------8<---------------------------------
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost
---------------------------------8<---------------------------------
3. If you don't know exactly what classes to use for support JBoss, make sure that all *.jar files from %JBOSS_HOME%\client\lib\ are also in classpath for your client app.
4. It's ok that you deleted 'hsqldb-ds.xml' but you left JBoss without default DataSource :). You can fix it in this way:
Name of your 'mssql.xml' should be ended with '-ds.xml'. Something like 'mssql-ds.xml'. JBoss recognizes this file as deployer that contains info about DataSource. Look into %JBOSS_HOME%\docs\examples\jca\ and find 'mssql-ds.xml' - this is an example for you. If you need to register MS SQL as DEFAULT DataSource in JNDI, make sure that following line exists:
---------------------------------8<---------------------------------
...
<jndi-name>DefaultDS</jndi-name>
...
---------------------------------8<---------------------------------
Copy model mssql-ds.xml, change it for compliance with your needs, and put it into %JBOSS_HOME%\server\default\deploy\.
5. Copy JDBC drivers for MS SQL into %JBOSS_HOME%\server\default\lib\. As far as I remember that should be 3 *.jar files.
6. Have fun :) -
JBoss Initial Context[ Go to top ]
- Posted by: Vyacheslav Zakovyrya
- Posted on: June 05 2004 07:19 EDT
- in response to Vyacheslav Zakovyrya
I'm really not sure about this naming convention...Name of your 'mssql.xml' should be ended with '-ds.xml'. Something like 'mssql-ds.xml'. JBoss recognizes this file as deployer that contains info about DataSource.
but... Heh, whatever! :)