You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Andre Brito <an...@gmail.com> on 2011/06/07 23:00:51 UTC

OpenEJB's Context doesn't support bind, rebind and unbind?

Hey guys.

The question is the subject's one: OpenEJB's Context object doesn't support
rebind? I'm using that in JBoss, and when I'm using OpenEJB I get a
OperationNotSupportedException.

Checking the code from the JNDIContext class, I found this:

public void bind(String name, Object obj) throws NamingException {
>     throw new OperationNotSupportedException();
> }
> 
> public void bind(Name name, Object obj) throws NamingException {
>     bind(name.toString(), obj);
> }
> 
> public void rebind(String name, Object obj) throws NamingException {
>     throw new OperationNotSupportedException();
> }
> 
> public void rebind(Name name, Object obj) throws NamingException {
>     rebind(name.toString(), obj);
> }
> 
> public void unbind(String name) throws NamingException {
>     throw new OperationNotSupportedException();
> }
> 
> public void unbind(Name name) throws NamingException {
>     unbind(name.toString());
> }

And my suspicious was right! If I re-instantiate Context object, will that
produce the same result?

Thansk in advance,
Regards,
Andre.

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3580780.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
David, I'm not using anything like that. Apparently, the developers that were
using JBoss didn't used that kind of naming too.

To tell you the truth, I'm not using a lot of EJB features. Just the basics.
It's not a very sophisticated app, apparently. It uses JavaMail, WebServices
(Axis2), and Multithreading (something like Producer - Consumer). The client
- remote communication was very easy, almost nothing to change. The app has
like 100 Sesion Beans, and the server should be online 16/7, but nothing
crucial.

Right now I'm having some troubles in configuring JKS or client certificate.
The app was using a SAR in JBoss. Now, since OpenEJB startup is very fast,
we don't have any trouble or concern in waiting to start and ask a session
to start this service.

My problem doesn't have anything to do with the rebind, but I'll try to
explain it.

I have 2 situations.
First is using 3 different JVMs. JVM 1 is the standalone OpenEJB. JVM 2 is
this service (first, not in the Session). It looks up Session beans in a
remote way (using RemoteInitialContextFactory). When the service starts (in
JVM 2), it's perfect, a dream. It's even faster than JBoss, actually, so the
architect (I'm a programmer) is very excited (but not putting a lot of work
on this, leaving allll the trouble to me. At least I'm learning and getting
to know lot of people in OpenEJB community). This second JVM is responsible
for getting data from database (using Eclipselink, database has something
like 300 tables) and consuming a few webservices. The problem is when the
third JVM appears. This third JVM is a Swing client, that consumes these
webservices too. And the problem is related do authentication using pfx and
jks files. Since the auth configuration is in different JVMs, I understand
that the error must occurr (the auth is configured in JVM 2, not the server.
So, when JVM 2 access OpenEJB server, JVM 2 has everything configured
working. But when JVM 3 tries to consume, it gets this auth error, because
there's nothing configured).

I'm working in the second situation, trying to solve the error I described
in the first. I'm starting OpenEJB in the Embedded Remotable way. So I have
2 JVMs, the OpenEJB server (with the SAR in it, this time in a Session bean)
and the Swing client (this guy can lookup Session beans without problems).
But now, I'm getting the error that JVM 3 is getting when trying to consume
the webservice in JVM 1, in the first situation!

Now, this I can't understand!

Sorry for my bad english. Past few weeks I have to write tons of e-mails in
Portuguese and Spanish.

Regards,
Andre.

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3594040.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
Hey David. Sorry the absence.

Just for the record, we solve the problem. We aren't using
System.setProperty anymore. Now we're registering the public certificate
using protocols and dynamic socket factories. It's very tricky (at least for
me), but solved the problem.

Just a few more days and the product will be ready to be shipped. More
OpenEJBs servers up and running in Brazil :-)

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3634505.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by David Blevins <da...@gmail.com>.
On Jun 22, 2011, at 4:54 AM, Andre Brito wrote:

> It's not OpenEJB specific. We use the same properties to configure a JKS
> public certificate in JBoss too.
> 
> 
>> System.setProperty("javax.net.ssl.trustStoreType", "JKS");
>> System.setProperty("javax.net.ssl.trustStore", "the path to the JKS
>> file");
>> System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
>> 
> 

Ok, so it isn't all system properties that give you trouble, it's these specifically.  I can't imagine that there is any real chance of system properties in general being broken, but I certainly can see that some might not "work".  And when I say "work" what I really mean is that there are plenty of system properties that are only evaluated once.  If you set them after that moment, they have no effect.  So it could simply be a matter that these properties are not getting set soon enough.

To rule out all other possibilities, try setting these properties as plain -Djavax.net.ssl.trustStoreType=JKS JVM properties.  If that works, then we know this is just a timing issue.  From there we can probably figure out another way to set those properties if doing it on the command line is not the way you'd like to do it.

If it doesn't work, then I probably need to get some info from you on what those properties do specifically and how you're verifying they don't work.

The OpenEJB SystemInstance code won't help with VM-specific properties like the ones above, just OpenEJB properties, so no need to pursue that angle any further.

> The architect says that everything should stay in one VM. I actually agree
> with him, since the change that we'd have to make would be enormous (I tried
> and got a lot of problems along the way... very VERY weird problems - we
> have a Mail object that it's returned from a Session. The client that uses
> this Session gets this Mail object null and I don't know why, since there's
> no Exception). The architecture would have to change too much, so I guess
> that we're not in a very nice situation in this migration.

I'm not sure I can give too much advice on architecture and what two VMs vs one VM might mean, but certainly if things like injection of Mail sessions are not working we can absolutely help get to the bottom of it.  We just need some specific details like what the configuration looks like, the startup log output which should show the session being created, and then what the lookup or injection code looks like.


-David


Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
David, 

It's not OpenEJB specific. We use the same properties to configure a JKS
public certificate in JBoss too.


> System.setProperty("javax.net.ssl.trustStoreType", "JKS");
> System.setProperty("javax.net.ssl.trustStore", "the path to the JKS
> file");
> System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
> 

I tried


> SystemInstance.get().setProperty("javax.net.ssl.trustStoreType", "JKS",
> true);
> SystemInstance.get().setProperty("javax.net.ssl.trustStore", "the path to
> the JKS file", true);
> SystemInstance.get().setProperty("sun.security.ssl.allowUnsafeRenegotiation",
> "true", true);
> 
Thinking about what you said, I tried the "true" there because the
SystemInstance code apparently set the System.setProperties too. Didn't work
either.

The architect says that everything should stay in one VM. I actually agree
with him, since the change that we'd have to make would be enormous (I tried
and got a lot of problems along the way... very VERY weird problems - we
have a Mail object that it's returned from a Session. The client that uses
this Session gets this Mail object null and I don't know why, since there's
no Exception). The architecture would have to change too much, so I guess
that we're not in a very nice situation in this migration.

I'm running out of ideas :-|

Thanks in advance,
Regards,
Andre.

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3616780.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by David Blevins <da...@gmail.com>.
On Jun 21, 2011, at 12:51 PM, Andre Brito wrote:

> 
> David Blevins-2 wrote:
>> If anything we ignore the System properties after startup.
> Hey David, so even if I use SystemInstance.use().setProperty, OpenEJB won't
> recognize that? This system uses OpenEJB, Axis2 and a JKS file for security.
> Have you ever heard someone using something like this?

I haven't heard of a general issue with getting System properties to work.  Is that what we're talking about or is there an OpenEJB specific property that isn't getting recognized?


-David


Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
David Blevins-2 wrote:
> If anything we ignore the System properties after startup.
Hey David, so even if I use SystemInstance.use().setProperty, OpenEJB won't
recognize that? This system uses OpenEJB, Axis2 and a JKS file for security.
Have you ever heard someone using something like this?

Thanks in advance,
Regards,
Andre.


--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3615122.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
That gave me hope, but I tried and doesn't work either. Not a problem, I will
leave it with 2 JVMs. Thanks David :-)

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3605268.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by David Blevins <da...@gmail.com>.
On Jun 16, 2011, at 6:59 AM, Andre Brito wrote:

> This question came up in a meeting: is it possible that OpenEJB "protects" or
> "locks" its JVM? We try to set some properties (using System.setProperty)
> and it doesn't work. We start another JVM (OpenEJB independent), set the
> properties and, guess what, it works.

If anything we ignore the System properties after startup.

Our code almost exclusively uses this:

http://svn.apache.org/repos/asf/openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java

Sort of our own version of java.lang.System.  We start with a copy of the System properties, then add in other sources of properties we support such as conf/system.properties and InitialContext properties. For the most part after that we check only the merged set of properties.

-David


Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
This question came up in a meeting: is it possible that OpenEJB "protects" or
"locks" its JVM? We try to set some properties (using System.setProperty)
and it doesn't work. We start another JVM (OpenEJB independent), set the
properties and, guess what, it works.

Regards,
Andre.

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3602558.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by David Blevins <da...@gmail.com>.
On Jun 13, 2011, at 6:46 AM, Andre Brito wrote:

> I don't think the effort is valid. As you probably remember, I'm trying to
> migrate our server. We were using JBoss, and apparently the rebind method
> has been used without the knowledge of what really is for (I was not at the
> company when it was wrote). I removed and didn't had any problems without
> it. One dinossaur less to kill with this JBoss - OpenEJB migration.

:)

Have you eliminated all your "java:myDb" kind of names yet?

In Java EE 6 there are three new standard namespaces you can use now:

  - java:comp/env   (the original)
  - java:module/    (new)
  - java:app/       (new)
  - java:global/    (new)

Anything that is a standalone webapp can still just use the 'java:comp/env', but bigger apps can benefit from broader scoped JNDI namespaces.

These work in the trunk version of OpenEJB.  The released version still only supports 'java:comp/env'.  Not sure which version you may be switching to.


-David


Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by Andre Brito <an...@gmail.com>.
I don't think the effort is valid. As you probably remember, I'm trying to
migrate our server. We were using JBoss, and apparently the rebind method
has been used without the knowledge of what really is for (I was not at the
company when it was wrote). I removed and didn't had any problems without
it. One dinossaur less to kill with this JBoss - OpenEJB migration.

Thanks, David.

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-s-Context-doesn-t-support-bind-rebind-and-unbind-tp3580780p3593877.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB's Context doesn't support bind, rebind and unbind?

Posted by David Blevins <da...@gmail.com>.
On Jun 7, 2011, at 2:00 PM, Andre Brito wrote:

> Hey guys.
> 
> The question is the subject's one: OpenEJB's Context object doesn't support
> rebind? I'm using that in JBoss, and when I'm using OpenEJB I get a
> OperationNotSupportedException.

In general we don't as inside apps for example it's non-compliant to allow binding.  But on remote clients and anything not technically "inside" the app we could do it.

We could even do it inside the app itself provided we had some kind of flag a user could turn on to allow it.

Where are you trying to do the binding?  Is this a remote client/server kind of thing?

Also side note is that @Singletons could be a more portable runtime storage/directory mechanism.


-David