OpenEJB Startup Performance

2009-09-07 Thread Vikrant Yagnick
Hi All,

We are creating a  offline version of an online application using Oracle 
Lite, i.e. basically our J2EE application will work in a stand-alone mode on a 
laptop with the embedded Oracle Lite database.

Since, Oracle Lite comes in-built with it's own web-serve (WebToGo) we decided 
to embed openEJB as our EJB container intra-vm so that we could deploy our EAR 
as is. It works like a charm!!!

I had a couple of questions(Sorry, we are new with openejb):


1)  Is it correct to use openejb in such a way, since it will be used in 
production environments. (Any tips on tuning could help).

2)  OpenEJB builds up the application assembly everytime we start the 
webtogo server(it is a disguised Oracle 10.1.3 Standalone OC4J Server) on the 
client.  This does take 2-3 minutes due to the number of EJB's we have. Is 
there a way for OpenEJB to persist this application assembly so that when it 
startups a second time, it does not build the entire assembly again. This way 
there will be no delay if the server has to be re-started.

Cheers,
Vikrant Yagnick
Software Designer
MajescoMastek Ltd | Mastek Millennium Center,Millennium Business Park, Mahape, 
Navi  Mumbai 400-710   |
(T) 91 22 6695 Extn - 5230 | Mobile: +919833490598 | www.mastek.com

MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~
Opinions expressed in this e-mail are those of the individual and not that of 
Mastek Limited, unless specifically indicated to that effect. Mastek Limited 
does not accept any responsibility or liability for it. This e-mail and 
attachments (if any) transmitted with it are confidential and/or privileged and 
solely for the use of the intended person or entity to which it is addressed. 
Any review, re-transmission, dissemination or other use of or taking of any 
action in reliance upon this information by persons or entities other than the 
intended recipient is prohibited. This e-mail and its attachments have been 
scanned for the presence of computer viruses. It is the responsibility of the 
recipient to run the virus check on e-mails and attachments before opening 
them. If you have received this e-mail in error, kindly delete this e-mail from 
desktop and server.
~~


Re: Chaining InitialContexts ???

2009-09-07 Thread uglything

Hello David


David Blevins wrote:
 
 
 On Sep 1, 2009, at 6:07 AM, uglything wrote:
 

 Hello everyone.

 After having worked on something else (conception mainly with loads  
 of UML2)
 I'm coming back to the Plain Old Java Coding...

 I'm willing to give a try to the @Remote concepts which I don't know  
 at all.
 Basically, I have an OpenEJB + Tomcat combo hosting my server  
 application
 which itself contains many @Remote classes. On the other hand I want  
 the
 same combo hosting my client application which rely on the remoted  
 classes
 from the server.

 I would like to know if ther is some kind of configuration to let the
 server InitialContext merge into the client InitialContext might  
 sound
 ridiculous and/or naïve... Just let me know... but as far as I've  
 searched I
 don't find anything of interrest...
 What I've done so far - 80% of code monkey copy/paste your examples  
 - is
 starting a OpenEJB + Tomcat server and starting a JUnit test case  
 with a
 RemoteInitialContextFactory linked to the server through httpejbd (I  
 guess)
 whithout problem. I can easily hit the remoted beans that works great.
 But this initial context does not discover my client ejbs as the
 LocalInitialContextFactory does.
 
 If by client ejbs you mean the @LocalClient injection support, then  
 right, the RemoteInitialContextFactory doesn't yet support that.  We  
 do plan to add support for an @RemoteClient which will work with the  
 RemoteInitialContextFactory in a similar way.  There's a jira you can  
 watch if you want to keep updated on progress there:
 
http://issues.apache.org/jira/browse/OPENEJB-1025
   
 https://issues.apache.org/jira/secure/ViewIssue.jspa?id=12425175watch=true 
(for notifications)
 
 

I'll take a closer look to @LocalClient which I overlooked. But as you point
out, this will not apply directly to my issue.


David Blevins wrote:
 
 On the other hand, I didn't find anything to tell a
 LocalInitialContextFactory to search also into a remote directory...
 So far my only guess is to manually create a Locator-like object  
 wrapping a
 RemoteICF and make manual lookups into it. Maybe it's just the way  
 to go...
 
 Right, at the moment a service locator is the best approach.
 
http://openejb.apache.org/3.0/service-locator.html
 
 We have some code in the openejb-client jar you can use or copy:
 
   
 http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/server/openejb-client/src/main/java/org/apache/openejb/client/ServiceLocator.java
   
 http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/server/openejb-client/src/main/java/org/apache/openejb/client/GenericServiceLocator.java
 

Great, these classes seem to fit my needs !
thanks.


David Blevins wrote:
 

 Another question arises from that...
 Is there any support to propagate a transaction started from the  
 client to
 the server ? It seems that this is an optional requierement of the  
 EJB3
 specs...
 
 There hasn't been any demand for it, but if you need it we can put it  
 on the list.
 

Well I think it could be a valuable add to OpenEJB (not mentioning my own
interrest :thinking: ).
If I am allowed to speak my dreams, I can easily think of an embedded
OpenEJB client (with RemoteICF) as a seamless gate to the server it links
to... Providing that :
 - the RemoteICF is able to manage it's own EJBs (just like the LocalICF
does)
   and inject them with EJBs coming from the server
 - the server is able to participate in transactions managed by the client

Well this might be a terrible idea, let me know...


David Blevins wrote:
 
 BTW : Is there any registering to do to post answers to other people's
 questions ? I would like to pay back a little for your great support  
 by
 helping some people here (up to my little knowledge though)
 
 That's fantastic.  We can always use more help on the user list and  
 elsewhere.  We're a small team and every bit helps.  Feel free to jump  
 in anytime.  You can post through nabble or by sending mail directly  
 to the list.
 
 
 -David
 

Gr8, I'll try to prove myself useful :-D

Cheers and thanks for your support !

Juan Manuel
-- 
View this message in context: 
http://www.nabble.com/Chaining-InitialContexts-tp25240021p25331122.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: OpenEJB Startup Performance

2009-09-07 Thread Quintin Beukes
Hey,

I'm no EJB master either, but I can answer your questions with what I do know.

1. Perfectly fine. If you run it in something like Geronimo, it's
basically just embedded in Geronimo. Your web server is nothing more
than a Java Application, and OpenEJB has 2 modes, Standalone and
Embedded (I think there is another one I can't recall). So you're just
initializing the OpenEJB application inside your VM, and have the same
stability/functionality provided in any other mode. In fact, I would
recommend doing this with OpenEJB any day.

2. How many EJBs do you have for it to take this long? If you have a
huge classpath you can try trimming down the search to only the
desired JARs. See:
http://openejb.apache.org/3.0/application-discovery-via-the-classpath.html.
Alternatively you can try and specify static bean configurations in
ejb-jar.xml. They would be something like this:

?xml version=1.0 encoding=UTF-8 ?
ejb-jar xmlns=http://java.sun.com/xml/ns/javaee; version=3.0
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd;
   enterprise-beans
  session
 ejb-nameTestBean/ejb-name
 localnet.kunye.test.TestLocal/local
 remotenet.kunye.test.TestRemote/remote
  /session
  session
 ejb-namePersonnelBean/ejb-name
 localnet.kunye.platform.personnel.PersonnelLocal/local
 remotenet.kunye.platform.personnel.PersonnelRemote/remote
  /session
   /enterprise-beans
/ejb-jar

When you do this all the beans that are listed will be loaded from XML
(no annotation interpretation afaik) and the rest of the beans will be
loaded the normal way.

What you can do is perhaps hook in a compile-time task to generate
this list for you. If you already have such a file with other
configurations, you can perhaps make a template and generate the
ejb-jar.xml everytime you compile.

I'm not sure how much this will help. I've never really had to deal
with this problem. The most EJBs I've loaded was around 50 I think,
and it went quick. Some of the other guys might be able to help with
this.

Q


On Mon, Sep 7, 2009 at 2:01 PM, Vikrant Yagnick
vikrant.yagn...@mastek.com wrote:
 Hi All,

 We are creating a  offline version of an online application using Oracle 
 Lite, i.e. basically our J2EE application will work in a stand-alone mode on 
 a laptop with the embedded Oracle Lite database.

 Since, Oracle Lite comes in-built with it's own web-serve (WebToGo) we 
 decided to embed openEJB as our EJB container intra-vm so that we could 
 deploy our EAR as is. It works like a charm!!!

 I had a couple of questions(Sorry, we are new with openejb):


 1)      Is it correct to use openejb in such a way, since it will be used in 
 production environments. (Any tips on tuning could help).

 2)      OpenEJB builds up the application assembly everytime we start the 
 webtogo server(it is a disguised Oracle 10.1.3 Standalone OC4J Server) on the 
 client.  This does take 2-3 minutes due to the number of EJB's we have. Is 
 there a way for OpenEJB to persist this application assembly so that when it 
 startups a second time, it does not build the entire assembly again. This way 
 there will be no delay if the server has to be re-started.

 Cheers,
 Vikrant Yagnick
 Software Designer
 MajescoMastek Ltd | Mastek Millennium Center,Millennium Business Park, 
 Mahape, Navi  Mumbai 400-710   |
 (T) 91 22 6695 Extn - 5230 | Mobile: +919833490598 | www.mastek.com

 MASTEK LTD.
 Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
 In the US, we're called MAJESCOMASTEK

 ~~
 Opinions expressed in this e-mail are those of the individual and not that of 
 Mastek Limited, unless specifically indicated to that effect. Mastek Limited 
 does not accept any responsibility or liability for it. This e-mail and 
 attachments (if any) transmitted with it are confidential and/or privileged 
 and solely for the use of the intended person or entity to which it is 
 addressed. Any review, re-transmission, dissemination or other use of or 
 taking of any action in reliance upon this information by persons or entities 
 other than the intended recipient is prohibited. This e-mail and its 
 attachments have been scanned for the presence of computer viruses. It is the 
 responsibility of the recipient to run the virus check on e-mails and 
 attachments before opening them. If you have received this e-mail in error, 
 kindly delete this e-mail from desktop and server.
 ~~




-- 
Quintin Beukes


Problem when scanning for applications in a Manifest Classpath

2009-09-07 Thread Quintin Beukes
Hey,

I have an odd problem when doing unit tests.

In production we have a bunch of EJB JAR files and a bunch of app
library dependencies.

The one library specifically causes a cyclic dependency.  Which is
fine, since it's a runtime dependency and doesn't need to have it
compiled against. So everything compiles fine.

When in production it all works fine, because everything is on the
classpath only once. When i do unit tests in netbeans though, I have
dependencies configured, and this causes the following.

KMSPlatform-ejb contains persistence unit KMSPlatform-PU, and
depends on app library X. It also has a special persistence.xml when
doing unit tests, since they transaction manager is different.
App library X depends on KMSPlatform-ejb

So when I run the application I have the test classpath for the EJB
project, and X added onto this classpath. The problem is that

Initial Context Properties - Start
-- listing properties --
java.naming.factory.initial=net.kunye.platform.appclient.context
testPool.UserName=kms
testPool=new://Resource?type=DataSource
net.kunye.platform.tests.appclient.auth.admin.pass=kmsTESTpassword
net.kunye.platform.tests.appclient.auth.admin.username=testuser-admin
testPool.Password=kms
testPool.JdbcUrl=jdbc:postgresql://localhost:5432/test...
hibernate.hbm2ddl.auto=
net.kunye.platform.tests.appclient.auth.lamp-room.username=testuser-lamproom
hibernate.show_sql=true
net.kunye.platform.tests.appclient.auth.lamp-room.pass=kmsTESTpassword
testPool.JdbcDriver=org.postgresql.Driver
Initial Context Properties - End
Apache OpenEJB 3.0build: 20080408-04:13
http://openejb.apache.org/
INFO - openejb.home = /home/quintin/dev/kms/KMSPlatform/KMSPlatform-ejb
INFO - openejb.base = /home/quintin/dev/kms/KMSPlatform/KMSPlatform-ejb
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=testPool, type=Resource,
provider-id=Default JDBC Database)
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
INFO - Found EjbModule in classpath:
/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar
INFO - Found EjbModule in classpath:
/home/quintin/dev/kms/KMSPlatform/KMSPlatform-ejb/build/jar
INFO - Configuring app:
/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar
INFO - Configuring Service(id=Default Stateless Container,
type=Container, provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean SiteBean:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Configuring PersistenceUnit(name=KMSPlatform-PU,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Auto-creating a Resource with id 'testPoolNonJta' of type
'DataSource for 'KMSPlatform-PU'.
INFO - Configuring Service(id=testPoolNonJta, type=Resource,
provider-id=testPool)
INFO - Adjusting KMSPlatform-PU jta-data-source to 'testPool'
INFO - Adjusting KMSPlatform-PU non-jta-data-source to 'testPoolNonJta'
INFO - Loaded Module:
/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar
INFO - Configuring app:
/home/quintin/dev/kms/KMSPlatform/KMSPlatform-ejb/build/jar
INFO - Configuring PersistenceUnit(name=KMSPlatform-TestPU,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting KMSPlatform-TestPU non-jta-data-source to 'testPoolNonJta'
INFO - Loaded Module:
/home/quintin/dev/kms/KMSPlatform/KMSPlatform-ejb/build/jar
INFO - Assembling app:
/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar
INFO - PersistenceUnit(name=KMSPlatform-PU,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Undeploying app:
/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar
ERROR - Application could not be deployed:
/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar
org.apache.openejb.OpenEJBException: createApplication.failed
[/home/quintin/dev/kms/KMSPlatform/ApplicationClientLib/dist/lib/KMSPlatform-ejb.jar]:
org/apache/geronimo/kernel/KernelRegistry
at 
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:592)
at 
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:338)
at 
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:250)
at org.apache.openejb.OpenEJB$Instance.init(OpenEJB.java:149)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:288)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:267)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at