Openejb web application and jndi.properties problem

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Openejb web application and jndi.properties problem

Mansour
Hello all:

I am trying to write a small web application using openejb. I am trying
to avoid using spring. The application is based on wicket. Basicly when
the application starts it initialize the InitialContext() and loads
openejb. Things work fine when I run the server (jetty) from a test file
that came with wicket maven archetype. In this case jndi.properties is
read properly.

Problem starts when deployed to a tomcat or ran the application with
mvn jetty:run. In both cases a war file is created. I read somewhere
that jndi.properties in never read in a web application.

I don't know what would other do, to get jndi.properties read by the
application. I appretiate any help.




Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Jacek Laskowski
On Mon, Dec 20, 2010 at 11:28 PM, Mansour Al Akeel
<[hidden email]> wrote:

> I am trying to write a small web application using openejb.
...
> I don't know what would other do, to get jndi.properties read by the
> application. I appretiate any help.

I don't either. Would you mind posting the "small web app" to the
mailing list? I'd have a look at it if you do. It'd be a huge
time-saver.

Jacek

--
Jacek Laskowski
Notatnik Projektanta Java EE - http://jaceklaskowski.pl
Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Mansour
Hello Jacek:
thank you for your help. I sent you the code directly to your private
email, since mailing lists do not allow attachements.

However, I think I resolved the problem partialy. It's working from

mvn jetty:run or mvn jetty:run-war

but not when deployed to tomcat:

FATAL - startup                    - OpenEJB has encountered a fatal
error and cannot be started: Assembler failed to build the container system.  org.apache.openejb.OpenEJBException: Invalid SecurityService provider
Tomcat Security Service.  The factory class specified, org.apache.openejb.tomcat.catalina.TomcatSecurityService, does not
implement the org.apache.openejb.spi.SecurityService interface.  Please check the configuration of Tomcat Security Service."
    at org.apache.openejb.assembler.classic.AssemblerTool.checkImplementation(AssemblerTool.java:53)
    at org.apache.openejb.assembler.classic.Assembler.createSecurityService(Assembler.java:1255)
    at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:354)
    at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
    at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
    at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
    at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
    at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
    at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
    at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
    at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
....
javax.naming.NamingException: Attempted to load OpenEJB. Invalid SecurityService provider Tomcat Security Service.  The factory class
specified, org.apache.openejb.tomcat.catalina.TomcatSecurityService, does not implement the org.apache.openejb.spi.SecurityService interface.
Please check the configuration of Tomcat Security Service." [Root exception is org.apache.openejb.OpenEJBException: Invalid
SecurityService provider Tomcat Security Service.  The factory class specified, org.apache.openejb.tomcat.catalina.TomcatSecurityService,
does not implement the org.apache.openejb.spi.SecurityService interface.  Please check the configuration of Tomcat Security Service."]
    at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:55)
    at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)






On Tue Dec 21,2010 09:13 am, Jacek Laskowski wrote:

> On Mon, Dec 20, 2010 at 11:28 PM, Mansour Al Akeel
> <[hidden email]> wrote:
>
> > I am trying to write a small web application using openejb.
> ...
> > I don't know what would other do, to get jndi.properties read by the
> > application. I appretiate any help.
>
> I don't either. Would you mind posting the "small web app" to the
> mailing list? I'd have a look at it if you do. It'd be a huge
> time-saver.
>
> Jacek
>
> --
> Jacek Laskowski
> Notatnik Projektanta Java EE - http://jaceklaskowski.pl
Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Mansour
Hello :

I have uploaded the demo project to github. The issue I was facing still
unresolved. It's described in the issues part on github.

The project cat be accessed through:

https://github.com/mansour77/wicket-openejb

I appreciate any help.

Happy new year to everyone.

Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Jean-Louis MONTEIRO
Hi,

the jety integration is still under development.
Nevertheless, i already achieve running a simple example with openejb + jetty.

There is an interesting post from Stephen. I used it to test a small application with OpenEJB + Jetty.

Could you give it a try?
If it also works for you, i can add a page to our website with a link or so.

Thanks.
Jean-Louis
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com
Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Mansour
Hello Jean:

The application I wrote, works fine with jetty. The problem start when
deployed to tomcat.

In all cases, I will  give it a try of course.

Thank you.


On Thu Dec 30,2010 08:38 am, Jean-Louis MONTEIRO wrote:

>
> Hi,
>
> the jety integration is still under development.
> Nevertheless, i already achieve running a simple example with openejb +
> jetty.
>
> There is an interesting post from Stephen. I used it to test a small
> application with OpenEJB + Jetty.
>
> Could you give it a try?
> If it also works for you, i can add a page to our website with a link or so.
>
> Thanks.
> Jean-Louis
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Openejb-web-application-and-jndi-properties-problem-tp3102659p3168499.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Mansour
In reply to this post by Jean-Louis MONTEIRO
Can you please give me a link to the jetty integration?
Where do I get it from ?


On Thu Dec 30,2010 08:38 am, Jean-Louis MONTEIRO wrote:

>
> Hi,
>
> the jety integration is still under development.
> Nevertheless, i already achieve running a simple example with openejb +
> jetty.
>
> There is an interesting post from Stephen. I used it to test a small
> application with OpenEJB + Jetty.
>
> Could you give it a try?
> If it also works for you, i can add a page to our website with a link or so.
>
> Thanks.
> Jean-Louis
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Openejb-web-application-and-jndi-properties-problem-tp3102659p3168499.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Openejb web application and jndi.properties problem

Jean-Louis MONTEIRO
Hi Mansour,

OK, got the point.
Actually, you are using a wicket extension to manage @EJB injection.

By default, i guess it's looking for resources in the Environment Naming Context (java:comp/env).
Under Tomcat and AFAIR, when you get a Context instance (new InitialContext()), Tomcat overrides your jndi properties in order to set Tomcat ones before any other.

Anyway, I gonna checkout Wicketstuff sources in order to look how they manage resource injections.
In the mid time, could you have a look and try with openejb: prefix (using the Naming Strategy i guess)?

It should automatically switch from Tomcat naming to OpenEJB naming if you use that prefix.

Let us know please.
Jean-Louis
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com