You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Martin Elkjær <ma...@elkjaer-it.dk> on 2009/11/24 14:11:34 UTC

Where to place my third party jars ?

Hi,

Just started using OpenEJB last week - but so far I'm very satisfied!
I've migrated an web application running on Tomcat with GWT on top an
Hibernate in the bottom. So far every things seems to be running, but I need
some advice for fine-tuning. I've read through the documentation, but some
questions still keeps coming... :-)


1. Where should I place 3rd party libs for my application ? If I put them in
WEB-INF/lib the openEJB startup is very very slow - guess it is because it's
scanning all the jars - if I put them in the openEJB/lib folder it starts
very fast. So my question is: Is there a way to tell OpenEJB not to scan the
whole WEB-INF/lib folder but only WEB-INF/classes ??


2. I'm planning to use JMS in the near future.
My plan is to use ActiveMQ in embedded mode, mostly because of the simple
setup and speed (same JVM). But is this OK ?
I've done some testing trying to use MySQL for storing messages, but it
doesn't seem to work (no tables are created in the database scheme?!?!) My
setup is :
-------------------------------------------------------------
<Resource id="My JMS Resource Adapter" type="ActiveMQResourceAdapter">
  # Broker configuration URI as defined by ActiveMQ
  # see http://activemq.apache.org/broker-configuration-uri.html

  BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false

  # Broker address

  ServerUrl vm://localhost?async=true

  # DataSource for persistence messages

  DataSource jmsDatabase
</Resource>

<Resource id="jmsDatabase" type="DataSource">
  JdbcDriver com.mysql.jdbc.Driver
  JdbcUrl jdbc:mysql://localhost:3306/jms
  UserName jms
  Password jms
  ValidationQuery select 1
  MinIdle 2
  MaxIdle 10
  MaxActive 50
  MaxWait 10000
  InitialSize 2
  JtaManaged false
</Resource>


-------------------------------------------------




Best regards
Martin

Re: Where to place my third party jars ?

Posted by David Blevins <da...@visi.com>.
On Nov 24, 2009, at 4:06 PM, Jean-Louis MONTEIRO wrote:

>
>
>
> Martin Elkjær wrote:
>>
>> Hi,
>>
>> Just started using OpenEJB last week - but so far I'm very satisfied!
>> I've migrated an web application running on Tomcat with GWT on top an
>> Hibernate in the bottom. So far every things seems to be running,  
>> but I
>> need
>> some advice for fine-tuning. I've read through the documentation,  
>> but some
>> questions still keeps coming... :-)
>>
> Thanks for that!
>
> Martin Elkjær wrote:
>>
>> 1. Where should I place 3rd party libs for my application ? If I  
>> put them
>> in
>> WEB-INF/lib the openEJB startup is very very slow - guess it is  
>> because
>> it's
>> scanning all the jars - if I put them in the openEJB/lib folder it  
>> starts
>> very fast. So my question is: Is there a way to tell OpenEJB not to  
>> scan
>> the
>> whole WEB-INF/lib folder but only WEB-INF/classes ??
>>
> IMO, you should not put your jars in openejb/lib. It's better to fit  
> servlet
> API and put your jars in WEB-INF/lib
> By the way, you can exclude jars to avoid full application scanning.  
> By
> default, OpenEJB scans all jars.
> In the last release (or may be in the trunk), we added a set of jars  
> to
> exclude, but you can definitely exclude/include whatever you want.
>
> https://issues.apache.org/jira/browse/OPENEJB-1107
> https://issues.apache.org/jira/browse/OPENEJB-1107  --> builtin  
> exclude list
>
> If you need to exclude/include some jars, have a look here
> http://openejb.apache.org/3.0/application-discovery-via-the-classpath.html
> http://openejb.apache.org/3.0/application-discovery-via-the-classpath.html 
>  .
>
> Don't forget the note at the bottom of the page.

You know I don't think that takes effect when scanning a webapp  
classpath, but it does seem like functionality almost everyone will  
need.  Maybe we should come up with a nice xml format and push for  
some standardization next spec round (Java EE 7).

> Martin Elkjær wrote:
>>
>> 2. I'm planning to use JMS in the near future.
>> My plan is to use ActiveMQ in embedded mode, mostly because of the  
>> simple
>> setup and speed (same JVM). But is this OK ?
>> I've done some testing trying to use MySQL for storing messages,  
>> but it
>> doesn't seem to work (no tables are created in the database  
>> scheme?!?!) My
>> setup is :
>> -------------------------------------------------------------
>> <Resource id="My JMS Resource Adapter"  
>> type="ActiveMQResourceAdapter">
>>  # Broker configuration URI as defined by ActiveMQ
>>  # see http://activemq.apache.org/broker-configuration-uri.html
>>
>>  BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false
>>
>>  # Broker address
>>
>>  ServerUrl vm://localhost?async=true
>>
>>  # DataSource for persistence messages
>>
>>  DataSource jmsDatabase
>> </Resource>

I think you have to use "vm:" instead of "tcp:" or ActiveMQ won't  
really go into embedded mode.  There is a "persistent" property that  
can be used in the BrokerXmlConfig -- you'd think they wouldn't need  
it by the fact that a DataSource was set, but it can't hurt to set it  
explicitly.

Try this for your ActiveMQResourceAdapter config:

<Resource id="My JMS Resource Adapter" type="ActiveMQResourceAdapter">
  # Broker configuration URI as defined by ActiveMQ
  # see http://activemq.apache.org/broker-configuration-uri.html

  BrokerXmlConfig broker:()/localhost?persistent=true

  # Broker address

  ServerUrl vm://localhost?async=true

  # DataSource for persistence messages

  DataSource jmsDatabase
</Resource>

Let us know if that works out cause we could document this on our site  
and hopefully save people some time.

-David


Re: Where to place my third party jars ?

Posted by Quintin Beukes <qu...@skywalk.co.za>.
On the same machine as you're running the JMS example, can you run:
mysql -h localhost -u jms -p jms jms

And it works?

If so, try enabling debug logging for the whole ActiveMQ and OpenEJB
and send that.

Q

>> 2. I'm planning to use JMS in the near future.
>> My plan is to use ActiveMQ in embedded mode, mostly because of the simple
>> setup and speed (same JVM). But is this OK ?
>> I've done some testing trying to use MySQL for storing messages, but it
>> doesn't seem to work (no tables are created in the database scheme?!?!) My
>> setup is :
>> -------------------------------------------------------------
>> <Resource id="My JMS Resource Adapter" type="ActiveMQResourceAdapter">
>>   # Broker configuration URI as defined by ActiveMQ
>>   # see http://activemq.apache.org/broker-configuration-uri.html
>>
>>   BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false
>>
>>   # Broker address
>>
>>   ServerUrl vm://localhost?async=true
>>
>>   # DataSource for persistence messages
>>
>>   DataSource jmsDatabase
>> </Resource>
>>
>> <Resource id="jmsDatabase" type="DataSource">
>>   JdbcDriver com.mysql.jdbc.Driver
>>   JdbcUrl jdbc:mysql://localhost:3306/jms
>>   UserName jms
>>   Password jms
>>   ValidationQuery select 1
>>   MinIdle 2
>>   MaxIdle 10
>>   MaxActive 50
>>   MaxWait 10000
>>   InitialSize 2
>>   JtaManaged false
>> </Resource>
>>
>> Best regards
>> Martin
>>
>
> It should work.
> Do you have a runnable example?
> If so, can you send us a sample to reproduce the issue?
>
> Hope it helps,
> Jean-Louis
>
>
> --
> View this message in context: http://old.nabble.com/Where-to-place-my-third-party-jars---tp26495607p26497483.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>

Re: Where to place my third party jars ?

Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.


Martin Elkjær wrote:
> 
> Hi,
> 
> Just started using OpenEJB last week - but so far I'm very satisfied!
> I've migrated an web application running on Tomcat with GWT on top an
> Hibernate in the bottom. So far every things seems to be running, but I
> need
> some advice for fine-tuning. I've read through the documentation, but some
> questions still keeps coming... :-)
> 
Thanks for that!

Martin Elkjær wrote:
> 
> 1. Where should I place 3rd party libs for my application ? If I put them
> in
> WEB-INF/lib the openEJB startup is very very slow - guess it is because
> it's
> scanning all the jars - if I put them in the openEJB/lib folder it starts
> very fast. So my question is: Is there a way to tell OpenEJB not to scan
> the
> whole WEB-INF/lib folder but only WEB-INF/classes ??
> 
IMO, you should not put your jars in openejb/lib. It's better to fit servlet
API and put your jars in WEB-INF/lib
By the way, you can exclude jars to avoid full application scanning. By
default, OpenEJB scans all jars.
In the last release (or may be in the trunk), we added a set of jars to
exclude, but you can definitely exclude/include whatever you want.

https://issues.apache.org/jira/browse/OPENEJB-1107
https://issues.apache.org/jira/browse/OPENEJB-1107  --> builtin exclude list

If you need to exclude/include some jars, have a look here 
http://openejb.apache.org/3.0/application-discovery-via-the-classpath.html
http://openejb.apache.org/3.0/application-discovery-via-the-classpath.html .

Don't forget the note at the bottom of the page.


Martin Elkjær wrote:
> 
> 2. I'm planning to use JMS in the near future.
> My plan is to use ActiveMQ in embedded mode, mostly because of the simple
> setup and speed (same JVM). But is this OK ?
> I've done some testing trying to use MySQL for storing messages, but it
> doesn't seem to work (no tables are created in the database scheme?!?!) My
> setup is :
> -------------------------------------------------------------
> <Resource id="My JMS Resource Adapter" type="ActiveMQResourceAdapter">
>   # Broker configuration URI as defined by ActiveMQ
>   # see http://activemq.apache.org/broker-configuration-uri.html
> 
>   BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false
> 
>   # Broker address
> 
>   ServerUrl vm://localhost?async=true
> 
>   # DataSource for persistence messages
> 
>   DataSource jmsDatabase
> </Resource>
> 
> <Resource id="jmsDatabase" type="DataSource">
>   JdbcDriver com.mysql.jdbc.Driver
>   JdbcUrl jdbc:mysql://localhost:3306/jms
>   UserName jms
>   Password jms
>   ValidationQuery select 1
>   MinIdle 2
>   MaxIdle 10
>   MaxActive 50
>   MaxWait 10000
>   InitialSize 2
>   JtaManaged false
> </Resource>
> 
> Best regards
> Martin
> 

It should work.
Do you have a runnable example?
If so, can you send us a sample to reproduce the issue?

Hope it helps,
Jean-Louis


-- 
View this message in context: http://old.nabble.com/Where-to-place-my-third-party-jars---tp26495607p26497483.html
Sent from the OpenEJB User mailing list archive at Nabble.com.