Hi Philippe,
I don't understand either. We have system with something over 40 beans so
far and everything was working without any problems. Initially I copied the
code you have mentioned from Jonas examples to our beans and it didn't work.
They are tried to investigate. I still cannot find out what is wrong. I have
tried debugging, but our JBuilder3 always throws an GPF inside our beans. As
the last chance I have tried to run Jonas examples.
I always get following error message from clients
Getting a UserTransaction object from JNDI
Cannot lookup UserTransaction: javax.naming.NameNotFoundException: name
"javax.transaction.UserTransaction" not bound
If I run JonasAdmin to check exported names, UserTransaction is not there
Current EJBServer : jonas
JonasAdmin (jonas) > jndi
TMFactory
aqpjdbc
OpHome
java:comp
jonas_Adm
JonasAdmin (jonas) > quit
BTW. I forgot to mention, that we are using Jonas 2.0 with Jeremie. When I
have tried lookup using
lookup("DOCUMENT_DB_TABLE") I have got expected exception, so it looks like
lookup works
java.rmi.RemoteException: JDNI error. Original message: name
"DOCUMENT_DB_TABLE"
not bound; nested exception is:
javax.naming.NameNotFoundException: name "DOCUMENT_DB_TABLE" not
bound
javax.naming.NameNotFoundException: name "DOCUMENT_DB_TABLE" not bound
at
org.objectweb.jeremie.libs.services.registry.jndi.JRMIRegistryContext
.lookup(JRMIRegistryContext.java:166)
at
org.objectweb.jeremie.libs.services.registry.jndi.JRMIRegistryContext
.lookup(JRMIRegistryContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:354)
at
aqp.beans.core.CoreDocumentStatelessControllerBean.setSessionContext(
CoreDocumentStatelessControllerBean.java:155)
at
org.objectweb.jonas.container.JBeanSession.createContext(JBeanSession
.java:218)
at
aqp.beans.user.JOnASUserControllerBeanUserControllerHome.create(JOnAS
UserControllerBeanUserControllerHome.java:34)
at
aqp.servlets.session.LoginServlet.getController(LoginServlet.java:469
)
at
aqp.servlets.session.LoginServlet.verifyLogin(LoginServlet.java:358)
at
aqp.servlets.session.SessionServlet.service(SessionServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.mortbay.HTTP.Handler.ServletHolder.service(ServletHolder.java, Co
mpiled Code)
at
com.mortbay.HTTP.Handler.ServletHandler.handle(ServletHandler.java:18
4)
at com.mortbay.HTTP.HttpServer.handle(HttpServer.java, Compiled
Code)
at com.mortbay.HTTP.HttpListener.handleConnection(HttpListener.java,
Com
piled Code)
at com.mortbay.Util.ThreadedServer.run(ThreadedServer.java, Compiled
Cod
e)
at java.lang.Thread.run(Thread.java:479)
This made me think if the problem is not in our code or Jonas but maybe in
Jeremie. I don't have source code for Jeremie to see how you handle
"java:comp/env" names so now I am trying to rebuild our application under
RMI to see if this helps. I will let you know about progress, right now this
is the last thing I can think off to find out what is the problem.
Best Regards
Miro
-----Original Message-----
From: Philippe Coq [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 15, 2000 11:02 AM
To: Halas, Miroslav
Cc: [EMAIL PROTECTED]
Subject: Re: Can't read bean environment properties
"Halas, Miroslav" wrote:
>
> We were still unable to resolve this. Just one question, is anybody out
> there using environment properties using XML deployment descriptors with
> Jonas 2.0. Does it work? Can you send us and example? Thanks,
>
Hi Halas,
I don't understand why you cannot resolve any names in java:comp/env
context.
Have you succeeded to run the $JONAS_ROOT/examples/src/eb example?
As you can see in AccountExplBean.java the getConection method obtains
the datasource via a lookup :
initialContext.lookup("java:comp/env/jdbc/AccountExplDs");
Here is an example from our test suite where we use the environement
naming context:
In a Session Bean we have :
// Check from initial Context
try {
String value = (String) ictx.lookup("java:comp/env/myname");
if (!value.equals("mysession")) {
Trace.errln("NSession: "+method+": ictx.lookup failed:
myname="+value);
throw new EJBException("NSession 6: "+method);
}
} catch (NamingException e) {
Trace.errln("NSession: "+method+": ictx.lookup raised
exception:\n"+e);
throw new EJBException("NSession 7: "+method);
}
the corresponding part of the DD is:
<enterprise-beans>
<session>
<ejb-name>NSession</ejb-name>
<home>tests.ejb.naming.NSessionHome</home>
<remote>tests.ejb.naming.NSession</remote>
<ejb-class>tests.ejb.naming.NSessionBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>myname</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>mysession</env-entry-value>
</env-entry>
JOnAS supports also the deprecated EJBContext.getEnvironment() method
Here is an example that is running:
// Test old method (EJB 1.0 - deprecated but must be supported)
try {
String oldvalue =
ejbContext.getEnvironment().getProperty("old-prop");
if (oldvalue == null) {
Trace.errln("NSession: "+method+": myEnv.lookup failed:
old-prop=null");
throw new EJBException("NSession 5a: "+method);
}
if (!oldvalue.equals("old-prop value")) {
Trace.errln("NSession: "+method+":myEnv.lookup
failed:old-prop="+oldvalue);
throw new EJBException("NSession 5b: "+method);
}
} catch (Exception e) {
Trace.errln("NSession: "+method+": \n"+e);
throw new EJBException("NSession 5c: "+method);
}
The corresponding part of the DD is:
<env-entry>
<env-entry-name>ejb10-properties/old-prop</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>old-prop value</env-entry-value>
</env-entry>
I Hope it helps
Best regards,
--
Philippe
Philippe Coq Groupe Bulll/BullSoft/OpenMaster Phone: (33) 04 76 29 78
49
Bull S.A - 1 rue de Provence - 38432 Echirolles Cedex France
[EMAIL PROTECTED] http://www-frec.bull.com
Download our EJBServer at http://www.bullsoft.com/ejb
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".