Re: Eclipse Multiple Projects and Missing persistence.xml

2008-04-02 Thread David Blevins


On Mar 30, 2008, at 8:29 PM, Chad and Doria Skinner wrote:
I have a project I am working on and we have separated our business  
model from our business logic by placing them into different  
projects in eclipse. These projects are both jars that are placed in  
our ear file. When I try to run a test on one of our session beans  
in the EJB project I keep getting errors that it is missing the  
persistence.xml file that is in our BusinessLogic project. The code  
is compiling properly, but the tests will not run until I copy the  
persistence.xml into the EJB project. Does anyone know if having  
separate jars for the SessionBeans and entities is supported?


I think there might be an issue with the module getting picked up if  
it only contains a peristence.xml and nothing else.  An alternate  
technique to moving the persistence.xml into the BusinessLogic project  
is to add an empty ejb-jar.xml file to the BusinessModel project  
containing only ejb-jar/


That should tide you over till we can get this fixed.

-David



Re: OpenEJBListener and Eclipse

2008-04-02 Thread David Blevins

Hi Mike,

I'm not too sure how Eclipse starts and manages Tomcat.

Dario, I seem to recall you mentioning this exact situation in your  
Tomcat/OpenEJB article.  Do you happen to have any insight?


-David


On Apr 1, 2008, at 3:29 AM, Mike Otto wrote:


Hello
I am testing out openejb 3.0 beta 2 release with tomcat 6.0.16 and  
jdk 1.6.0_05


openejb.war and ejb-examples-1.0.war work fine as long as I start  
tomcat

manually in bin/catalina.bat

Starting tomcat in eclipse leads to a error (see below)

in server.xml
Listener className=org.apache.openejb.loader.OpenEJBListener/

I guess this is because

StandardServer server = (StandardServer)ServerFactory.getServer();

is null in this context. But I don't know why.

Any hints?

Best Regards, Mike



java.lang.NullPointerException
at  
org.apache.openejb.loader.OpenEJBListener.init(OpenEJBListener.java: 
79)

at
org 
.apache 
.openejb.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java: 
62)

at
org 
.apache 
.catalina 
.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at  
org 
.apache.catalina.core.StandardServer.initialize(StandardServer.java: 
770)

at org.apache.catalina.startup.Catalina.load(Catalina.java:530)
at org.apache.catalina.startup.Catalina.load(Catalina.java:550)
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.catalina.startup.Bootstrap.load(Bootstrap.java:260)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
java.lang.reflect.InvocationTargetException





EJB in Tomcat with OpenEJB

2008-04-02 Thread Dru Devore
I am sending this again because I have no proof that it actually made it to
the list.

If anyone has any suggestions I would appreciate them. I would like to get
this solved by the weekend.


I am REALLY new to openejb, though not ejbs, and I am having problems.

I am trying to deploy a project developed in NetBeans for Glassfish to
Tomcat/OpenEJB. I need to develop a method of reliably deploying a project
being developed in NB as an enterprise project using GF as the server to
Tomcat/OpenEJB. I am going to explain the project then tell you what I have
attempted with the hopes it will be enough information to get something
working. So on with the situation.

I have 2 projects, part of an enterprise project in NB, They are OH-war and
OH-ejb. The war contains a set of services that access the stateless session
beans (3.0) in the OH-ejb project, it also contains a servlet that starts a
timer to perform a scheduled task that is also in an ejb from the OH-ejb
project. I know the task and services are setup properly and they run
without problems in GF though I cannot get any of it to work in TC/OEJB.

What I have tried:
I was told that I should be able to simply throw the war file from NB in the
webapps directory and it will work. Well it didn't really work so much.

I think I have the OpenEJB installed correctly because the install seemed to
work and it says it deploys it when the server comes up. I can see it saying
that it is deploying /openejb and the /OH-war projects but that is just
about all the good there is.

1. I can't find a wsdl anywhere, in a browser or on the HD, so the services
are unaccessable.

2. As for the servlet, I put prints in the init around where it starts the
task for timing and they are simply not being printed out. Figuring that it
might be the @EJB in the servlet that might be making it not work correctly
I removed everything related to EJBs.

At this time I don't have any idea what it is doing but I can say that it is
not doing what I thought I was asking it to do...

If anyone has any suggestions I would be willing to try them. If anyone has
any examples of web services or servlets I will look at them also. I know it

must be something I am doing I just don't know what it is..

-- 
Dru Devore
Moongate Technologies
212 West 10th Street
Suite D405
Indianapolis, IN 46202
[EMAIL PROTECTED]


Re: Web Service and EJB 3 problem

2008-04-02 Thread David Blevins


On Mar 31, 2008, at 12:03 PM, Dru Devore wrote:

I am REALLY new to openejb, though not ejbs, and I am having problems.

I am trying to deploy a project developed in NetBeans for Glassfish to
Tomcat/OpenEJB. I need to develop a method of reliably deploying a  
project
being developed in NB as an enterprise project using GF as the  
server to
Tomcat/OpenEJB. I am going to explain the project then tell you what  
I have
attempted with the hopes it will be enough information to get  
something

working. So on with the situation.

I have 2 projects, part of an enterprise project in NB, They are OH- 
war and
OH-ejb. The war contains a set of services that access the stateless  
session
beans (3.0) in the OH-ejb project, it also contains a servlet that  
starts a
timer to perform a scheduled task that is also in an ejb from the OH- 
ejb

project. I know the task and services are setup properly and they run
without problems in GF though I cannot get any of it to work in TC/ 
OEJB.


What I have tried:
I was told that I should be able to simply throw the war file from  
NB in the
webapps directory and it will work. Well it didn't really work so  
much.


I think I have the OpenEJB installed correctly because the install  
seemed to
work and it says it deploys it when the server comes up. I can see  
it saying
that it is deploying /openejb and the /OH-war projects but that is  
just

about all the good there is.

1. I can't find a wsdl anywhere, in a browser or on the HD, so the  
services

are unaccessable.

2. As for the servlet, I put prints in the init around where it  
starts the
task for timing and they are simply not being printed out. Figuring  
that it
might be the @EJB in the servlet that might be making it not work  
correctly

I removed everything related to EJBs.

At this time I don't have any idea what it is doing but I can say  
that it is

not doing what I thought I was asking it to do...

If anyone has any suggestions I would be willing to try them. If  
anyone has
any examples of web services or servlets I will look at them also. I  
know it

must be something I am doing I just don't know what it is..


We have a few fixes in the pending OpenEJB 3.0 final release that  
should address #2.  Not sure what might be going on with #1.


I've put together a new openejb.war file for you with all of our  
latest fixes:


  http://people.apache.org/~dblevins/3.0-SNAPSHOT/openejb.war

Give that a try and see if it doesn't fix the issue.

In that same directory I've added an example of a war file that has a  
web service.


  http://people.apache.org/~dblevins/3.0-SNAPSHOT/ejb-examples/

Hopefully, between the two we might be able to figure out what's going  
on.


Also, excuse the slight delay on responses; we've been trying for  
three weeks to get 3.0 final out the door and have exactly one issue  
left blocking it we're trying to resolve.


-David






Re: Tomcat - Injection: No such property

2008-04-02 Thread David Blevins


On Mar 29, 2008, at 1:14 PM, ebaxt wrote:


I'm trying to run my application with Tomcat+openEJB, but I can't  
figure out
why the EntityManager isn't injected correctly into the EAO  
sessionbean.

My war file is packed with the ejb.jar in \WEB-INF\lib.

The client is able to lookup the facade, but when the facade  
delegates the

EntityManager actions to the EAO a null pointer exception is thrown.

Here's the log.

INFO  - PersistenceUnit(name=sp2k,
provider=org.apache.openjpa.persistence.PersistenceProviderImpl)
INFO  - Jndi(name=TaxaEAOBeanLocal) -- Ejb(deployment-id=TaxaEAOBean)
INFO  - Jndi(name=Sp2kServiceBeanRemote) --
Ejb(deployment-id=Sp2kServiceBean)
INFO  - Created Ejb(deployment-id=TaxaEAOBean, ejb-name=TaxaEAOBean,
container=My Stateless Container)
INFO  - Created Ejb(deployment-id=Sp2kServiceBean, ejb- 
name=Sp2kServiceBean,

container=My Stateless Container)
INFO  - Deployed
Application(path=F:\tomcat\apache-tomcat-6.0.16\webapps\fddb-war-1.0- 
SNAPSHOT)

WARN  - Injection: No such property
'no.uib.gyro.domain.classification.TaxaEAOBean/em' in class
no.uib.gyro.domain.classification.TaxaEAOBean
WARN  - Injection: No such property
'no.uib.gyro.domain.classification.TaxaEAOBean/em' in class
no.uib.gyro.domain.classification.TaxaEAOBean

The @PersistenceContext annotation is inside the TaxaEAOBean, so  
it's not

past to the EAO from the facade.

The strange thing is that when I put the EJB's in the war archive,  
it all

works fine. Is there a difference to openEJB between adding ejb.jar in
WEB-INF\lib or to put the beans directly in the WEB-INF\classes?


There shouldn't be a difference, no.  There might be something we need  
to fix here.  Give the latest code a try and see if the problem  
doesn't go away:


  http://people.apache.org/~dblevins/3.0-SNAPSHOT/openejb.war

If it's still there, then if you can file a jira at http://issues.apache.org/jira/browse/OPENEJB 
, that'd be great.  If you could include a detailed description of  
your setup or a small app that reproduces the issue, that'd be great.


Thanks for your patience!

-David



Re: Tomcat - Injection: No such property

2008-04-02 Thread ebaxt

Thank you Kenneth!

I have tried to set the properties you talked about, but I don't really know
how to configure it to lookup Tomcat's JNDI context.

I have tried this with no luck:

Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.openejb.client.LocalInitialContextFactory);
p.put(Context.URL_PKG_PREFIXES, org.apache.naming.factory.XXX);

Do you know how to configure this correctly?

Erik


klewelling wrote:
 
 FYI I got the injection to work. When I was putting together a
 demonstration the injection started working. The problem has to do with
 dependencies in the pom.xml. I am not sure if there was something extra
 causing the problem or perhaps the order of the jars in the classpath. I
 am uploading an example
 
  http://www.nabble.com/file/p16421933/injection-example.zip
 injection-example.zip 
 
 By the way this example demonstrations embedding openEJB in Jetty. The
 important piece of the puzzle is in the WAR/pom.xml:
 
 plugin
 groupIdorg.mortbay.jetty/groupId
   artifactIdmaven-jetty-plugin/artifactId
   configuration
   scanIntervalSeconds5/scanIntervalSeconds
   contextPath/example/contextPath
   systemProperties
   systemProperty
   namejava.naming.factory.initial/name
   
 valueorg.apache.openejb.client.LocalInitialContextFactory/value
   /systemProperty
   systemProperty
   namejava.naming.factory.url.pkgs/name
   valueorg.mortbay.naming/value
   /systemProperty
   /systemProperties
   /configuration
   dependencies
   /dependencies
 /plugin
 
 
 The system property java.naming.factory.url.pkgs is the key. From what I
 can tell openEJB's IvmContext will attempt to do JNDI lookups and if it
 fails will look for additional ObjectFactories and delegate to them. By
 adding the org.morbay.naming system property IvmContext finds the Jetty
 JNDI context. Without this setting the jetty plugin will fail with the
 error: javax.naming.NameNotFoundException: Name java:comp not found.
 
 It took me a while to figure this out so it may be useful to add to the
 openEJB docs. 
 
 Hope this helps,
 Kenneth
 

-- 
View this message in context: 
http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452163.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: Tomcat - Injection: No such property

2008-04-02 Thread klewelling


You may want to try setting the properties as system properties, i.e. java
...
-Djava.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory
-Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX

or something like that. I think it may be important that openEJB's
initialContext is the first to start up rather than tomcats. If I have some
free time I can try to get my setup working with tomcat.

Kenneth


ebaxt wrote:
 
 Thank you Kenneth!
 
 I have tried to set the properties you talked about, but I don't really
 know how to configure it to lookup Tomcat's JNDI context.
 
 I have tried this with no luck:
 
 Properties p = new Properties();
 p.put(Context.INITIAL_CONTEXT_FACTORY,
 org.apache.openejb.client.LocalInitialContextFactory);
 p.put(Context.URL_PKG_PREFIXES, org.apache.naming.factory.XXX);
 
 Do you know how to configure this correctly?
 
 Erik
 
 
 klewelling wrote:
 
 FYI I got the injection to work. When I was putting together a
 demonstration the injection started working. The problem has to do with
 dependencies in the pom.xml. I am not sure if there was something extra
 causing the problem or perhaps the order of the jars in the classpath. I
 am uploading an example
 
  http://www.nabble.com/file/p16421933/injection-example.zip
 injection-example.zip 
 
 By the way this example demonstrations embedding openEJB in Jetty. The
 important piece of the puzzle is in the WAR/pom.xml:
 
 plugin
 groupIdorg.mortbay.jetty/groupId
  artifactIdmaven-jetty-plugin/artifactId
  configuration
  scanIntervalSeconds5/scanIntervalSeconds
  contextPath/example/contextPath
  systemProperties
  systemProperty
  namejava.naming.factory.initial/name
  
 valueorg.apache.openejb.client.LocalInitialContextFactory/value
  /systemProperty
  systemProperty
  namejava.naming.factory.url.pkgs/name
  valueorg.mortbay.naming/value
  /systemProperty
  /systemProperties
  /configuration
  dependencies
  /dependencies
 /plugin
 
 
 The system property java.naming.factory.url.pkgs is the key. From what
 I can tell openEJB's IvmContext will attempt to do JNDI lookups and if it
 fails will look for additional ObjectFactories and delegate to them. By
 adding the org.morbay.naming system property IvmContext finds the Jetty
 JNDI context. Without this setting the jetty plugin will fail with the
 error: javax.naming.NameNotFoundException: Name java:comp not found.
 
 It took me a while to figure this out so it may be useful to add to the
 openEJB docs. 
 
 Hope this helps,
 Kenneth
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452221.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: Tomcat - Injection: No such property

2008-04-02 Thread David Blevins


On Apr 2, 2008, at 3:30 PM, klewelling wrote:



You may want to try setting the properties as system properties,  
i.e. java

...
- 
Djava 
.naming 
.factory.initial=org.apache.openejb.client.LocalInitialContextFactory

-Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX

or something like that. I think it may be important that openEJB's
initialContext is the first to start up rather than tomcats. If I  
have some

free time I can try to get my setup working with tomcat.


That's definitely true of most third-party JNDI implementations; i.e.  
we should be first as we will delegate to them, whereas they usually  
won't delegate to us.  But for Tomcat specifically, we have some code  
that exports all of our JNDI entries into Tomcat so that there only  
needs to be one JNDI impl controlling the show -- Tomcat's.


Not sure why the EntityManager isn't getting picked up with the beans  
in WEB-INF/lib/ vs WEB-INF/classes/.  We did add some very detailed  
logging around the resolution of EntityManager references specifically  
since 3.0-beta-2 that might help (in the new openejb.war i just put  
up).  Hopefully there'll be something in the log that might illuminate  
what's going on.


-David


ebaxt wrote:


Thank you Kenneth!

I have tried to set the properties you talked about, but I don't  
really

know how to configure it to lookup Tomcat's JNDI context.

I have tried this with no luck:

   Properties p = new Properties();
   p.put(Context.INITIAL_CONTEXT_FACTORY,
org.apache.openejb.client.LocalInitialContextFactory);
   p.put(Context.URL_PKG_PREFIXES,  
org.apache.naming.factory.XXX);


Do you know how to configure this correctly?

Erik


klewelling wrote:


FYI I got the injection to work. When I was putting together a
demonstration the injection started working. The problem has to do  
with
dependencies in the pom.xml. I am not sure if there was something  
extra
causing the problem or perhaps the order of the jars in the  
classpath. I

am uploading an example

http://www.nabble.com/file/p16421933/injection-example.zip
injection-example.zip

By the way this example demonstrations embedding openEJB in Jetty.  
The

important piece of the puzzle is in the WAR/pom.xml:

plugin
   groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
configuration
scanIntervalSeconds5/scanIntervalSeconds
contextPath/example/contextPath
systemProperties
systemProperty
namejava.naming.factory.initial/name
valueorg.apache.openejb.client.LocalInitialContextFactory/ 
value

/systemProperty
systemProperty
namejava.naming.factory.url.pkgs/name
valueorg.mortbay.naming/value
/systemProperty
/systemProperties
/configuration
dependencies
/dependencies
/plugin


The system property java.naming.factory.url.pkgs is the key.  
From what
I can tell openEJB's IvmContext will attempt to do JNDI lookups  
and if it
fails will look for additional ObjectFactories and delegate to  
them. By
adding the org.morbay.naming system property IvmContext finds  
the Jetty
JNDI context. Without this setting the jetty plugin will fail with  
the
error: javax.naming.NameNotFoundException: Name java:comp not  
found.


It took me a while to figure this out so it may be useful to add  
to the

openEJB docs.

Hope this helps,
Kenneth






--
View this message in context: 
http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452221.html
Sent from the OpenEJB User mailing list archive at Nabble.com.