You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ganesh <ga...@wipro.com> on 2003/10/20 14:32:47 UTC

Velocity in EJB Container

Hi,
I am trying to use Velocity inside an EJB Container. There are
programming restriction of EJB 1.1 spec (section 18.1.2), as given below
in using the File System.
 
"An enterprise bean must not use the java.io package to attempt to
access files and directories in the file system. 

The file system APIs are not well-suited for business components to
access data. Business components should use a resource manager API, such
as JDBC API, to store data. "

In this scenario,which is best resource loader for Velocity to be used?
Will the selected resource loader, provide the caching facility as well?
Please let me know if there any know issues of using Velocity inside an
EJB container. Apart from the fact that I can see some 'synchronized'
keywords being used in the velocity source code.

Regards,
Ganesh

**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************

Re: Velocity in EJB Container

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On Tuesday, October 21, 2003, at 01:06 PM, Jeff Schnitzer wrote:

> Ganesh wrote:
>> <G> In the Programming restriction section of EJB 1.1 spec(section
>> 18.1.2), it is mentioned that any kind of synchronization should not
>> used so that the container can manage the threads. Though this
>> restriction are provided, I could get velocity working in EJB as well,
>> but this doesn't solve my problem as I am not compliant to the spec. 
>> " An enterprise Bean must not use thread synchronization primitives >> to
>> synchronize execution of multiple instances.
>> Same reason as above. Synchronization would not work if the EJB
>> Container distributed enterprise bean's instances across multiple 
>> JVMs.
>> "
>
> You will find, if you work with EJBs for more than a few months, that 
> the quality of your life increases in inverse proportion to how 
> closely you pay attention to these little spec tidbits.
>
> There is nothing wrong with synchronization in an EJB.  There is 
> nothing wrong with file I/O in an EJB.  Just be careful not to do 
> anything stupid, in the same way that you have to avoid doing stupid 
> things with synchronization and file I/O using any other kind of 
> multithreaded, distributed application technology.
>
> Remember, the appserver itself is built using these technologies.  
> They don't suddenly stop working because an academic at Sun (who in 
> all likelyhood has themselves never written an appplication more 
> complicated than hello world) decided to add some silly text to a spec 
> document.

ROTFL.

+1

geir

>
> Jeff Schnitzer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity in EJB Container

Posted by Jeff Schnitzer <je...@infohazard.org>.
Ganesh wrote:
> <G> In the Programming restriction section of EJB 1.1 spec(section
> 18.1.2), it is mentioned that any kind of synchronization should not
> used so that the container can manage the threads. Though this
> restriction are provided, I could get velocity working in EJB as well,
> but this doesn't solve my problem as I am not compliant to the spec. 
> " An enterprise Bean must not use thread synchronization primitives to
> synchronize execution of multiple instances.
> Same reason as above. Synchronization would not work if the EJB
> Container distributed enterprise bean's instances across multiple JVMs.
> "

You will find, if you work with EJBs for more than a few months, that 
the quality of your life increases in inverse proportion to how closely 
you pay attention to these little spec tidbits.

There is nothing wrong with synchronization in an EJB.  There is nothing 
wrong with file I/O in an EJB.  Just be careful not to do anything 
stupid, in the same way that you have to avoid doing stupid things with 
synchronization and file I/O using any other kind of multithreaded, 
distributed application technology.

Remember, the appserver itself is built using these technologies.  They 
don't suddenly stop working because an academic at Sun (who in all 
likelyhood has themselves never written an appplication more complicated 
than hello world) decided to add some silly text to a spec document.

Jeff Schnitzer


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Velocity in EJB Container

Posted by Ganesh <ga...@wipro.com>.

On Monday, October 20, 2003, at 08:32 AM, Ganesh wrote:

>
> Hi,
> I am trying to use Velocity inside an EJB Container. There are 
> programming restriction of EJB 1.1 spec (section 18.1.2), as given
> below
> in using the File System.
>
> "An enterprise bean must not use the java.io package to attempt to 
> access files and directories in the file system.
>
> The file system APIs are not well-suited for business components to 
> access data. Business components should use a resource manager API,
> such
> as JDBC API, to store data. "
>
> In this scenario,which is best resource loader for Velocity to be 
> used? Will the selected resource loader, provide the caching facility
as
> well?
> Please let me know if there any know issues of using Velocity inside
an
> EJB container. Apart from the fact that I can see some 'synchronized'
> keywords being used in the velocity source code.

I think the best resource loader is the webapp resource loader, if you  
are in the servlet part of the container, or the classpath resource  
loader.

<G>I am using Velocity in the EJB container only, may be I should use
classpath resource loader for making the EJB portable. Thanks for the
info.

What's the problem with synchronization?

<G> In the Programming restriction section of EJB 1.1 spec(section
18.1.2), it is mentioned that any kind of synchronization should not
used so that the container can manage the threads. Though this
restriction are provided, I could get velocity working in EJB as well,
but this doesn't solve my problem as I am not compliant to the spec. 
" An enterprise Bean must not use thread synchronization primitives to
synchronize execution of multiple instances.
Same reason as above. Synchronization would not work if the EJB
Container distributed enterprise bean's instances across multiple JVMs.
"
>
> Regards,
> Ganesh
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity in EJB Container

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On Monday, October 20, 2003, at 08:32 AM, Ganesh wrote:

>
> Hi,
> I am trying to use Velocity inside an EJB Container. There are
> programming restriction of EJB 1.1 spec (section 18.1.2), as given  
> below
> in using the File System.
>
> "An enterprise bean must not use the java.io package to attempt to
> access files and directories in the file system.
>
> The file system APIs are not well-suited for business components to
> access data. Business components should use a resource manager API,  
> such
> as JDBC API, to store data. "
>
> In this scenario,which is best resource loader for Velocity to be used?
> Will the selected resource loader, provide the caching facility as  
> well?
> Please let me know if there any know issues of using Velocity inside an
> EJB container. Apart from the fact that I can see some 'synchronized'
> keywords being used in the velocity source code.

I think the best resource loader is the webapp resource loader, if you  
are in the servlet part of the container, or the classpath resource  
loader.

What's the problem with synchronization?

>
> Regards,
> Ganesh
>
> **************************Disclaimer*********************************** 
> *
>
> Information contained in this E-MAIL being proprietary to Wipro  
> Limited is
> 'privileged' and 'confidential' and intended for use only by the  
> individual
>  or entity to which it is addressed. You are notified that any use,  
> copying
> or dissemination of the information contained in the E-MAIL in any  
> manner
> whatsoever is strictly prohibited.
>
> *********************************************************************** 
> ****
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org