is compile and ofbiz restart still needed for java changes?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

is compile and ofbiz restart still needed for java changes?

chris snow
Everytime I make a change to java code, I run "ant" and then restart the ofbiz service to pick up the changes.

Is this still necessary?  I am running r4.0.  What about 9.04
Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Jacques Le Roux
Administrator
As long as you modify Java code, you will still need to compile, hence to stop and restart the server (else you get a conflict on
jars used when compiling)

Jacques

From: "snowc" <[hidden email]>

>
> Everytime I make a change to java code, I run "ant" and then restart the
> ofbiz service to pick up the changes.
>
> Is this still necessary?  I am running r4.0.  What about 9.04
> --
> View this message in context:
> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

chris snow
Although I much prefer editing java over bsh, I keep finding myself using bsh over java to overcome the lengthy compile/restart cycle (similar to the problem with fat ejb versus thin pojo development).  Is there a way to reduce this cycle?

jacques.le.roux wrote
As long as you modify Java code, you will still need to compile, hence to stop and restart the server (else you get a conflict on
jars used when compiling)

Jacques

From: "snowc" <chsnow123@gmail.com>
>
> Everytime I make a change to java code, I run "ant" and then restart the
> ofbiz service to pick up the changes.
>
> Is this still necessary?  I am running r4.0.  What about 9.04
> --
> View this message in context:
> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Jacques Le Roux
Administrator
OFBiz has been conceived with this idea in mind. I mean reducing the need to restart the server. That's one of the reason why the
minilang exists...

Jacques

From: "snowc" <[hidden email]>

> Although I much prefer editing java over bsh, I keep finding myself using bsh
> over java to overcome the lengthy compile/restart cycle (similar to the
> problem with fat ejb versus thin pojo development).  Is there a way to
> reduce this cycle?
>
>
> jacques.le.roux wrote:
>>
>> As long as you modify Java code, you will still need to compile, hence to
>> stop and restart the server (else you get a conflict on
>> jars used when compiling)
>>
>> Jacques
>>
>> From: "snowc" <[hidden email]>
>>>
>>> Everytime I make a change to java code, I run "ant" and then restart the
>>> ofbiz service to pick up the changes.
>>>
>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>> --
>>> View this message in context:
>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Ruth Hoffman-2
Hi Jacques:
True, but I have found that many times Java is the preferable way to go.
That said, I wonder, Chris, are you building (running ant) at the
component level? If so, then I wonder why it would take that long. If
you build at the root level, yes, that is a pain. But locally in the
component...that, to me is worth the small amount of time it takes build
and restart.
Just my 2 cents.
Ruth
Jacques Le Roux wrote:

> OFBiz has been conceived with this idea in mind. I mean reducing the
> need to restart the server. That's one of the reason why the minilang
> exists...
>
> Jacques
>
> From: "snowc" <[hidden email]>
>> Although I much prefer editing java over bsh, I keep finding myself
>> using bsh
>> over java to overcome the lengthy compile/restart cycle (similar to the
>> problem with fat ejb versus thin pojo development).  Is there a way to
>> reduce this cycle?
>>
>>
>> jacques.le.roux wrote:
>>>
>>> As long as you modify Java code, you will still need to compile,
>>> hence to
>>> stop and restart the server (else you get a conflict on
>>> jars used when compiling)
>>>
>>> Jacques
>>>
>>> From: "snowc" <[hidden email]>
>>>>
>>>> Everytime I make a change to java code, I run "ant" and then
>>>> restart the
>>>> ofbiz service to pick up the changes.
>>>>
>>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html 
>>
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

chris snow
Hi Ruth - I am compiling at the component level.

Ruth Hoffman-2 wrote
Hi Jacques:
True, but I have found that many times Java is the preferable way to go.
That said, I wonder, Chris, are you building (running ant) at the
component level? If so, then I wonder why it would take that long. If
you build at the root level, yes, that is a pain. But locally in the
component...that, to me is worth the small amount of time it takes build
and restart.
Just my 2 cents.
Ruth
Jacques Le Roux wrote:
> OFBiz has been conceived with this idea in mind. I mean reducing the
> need to restart the server. That's one of the reason why the minilang
> exists...
>
> Jacques
>
> From: "snowc" <chsnow123@gmail.com>
>> Although I much prefer editing java over bsh, I keep finding myself
>> using bsh
>> over java to overcome the lengthy compile/restart cycle (similar to the
>> problem with fat ejb versus thin pojo development).  Is there a way to
>> reduce this cycle?
>>
>>
>> jacques.le.roux wrote:
>>>
>>> As long as you modify Java code, you will still need to compile,
>>> hence to
>>> stop and restart the server (else you get a conflict on
>>> jars used when compiling)
>>>
>>> Jacques
>>>
>>> From: "snowc" <chsnow123@gmail.com>
>>>>
>>>> Everytime I make a change to java code, I run "ant" and then
>>>> restart the
>>>> ofbiz service to pick up the changes.
>>>>
>>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html 
>>
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Ruth Hoffman-2
Hi Chris:
I guess I'm just use to the inconvenience. :-( The other thing I do to
try and minimize restart time is to comment out the components I might
not be using.
Ruth
snowc wrote:

> Hi Ruth - I am compiling at the component level.
>
>
> Ruth Hoffman-2 wrote:
>  
>> Hi Jacques:
>> True, but I have found that many times Java is the preferable way to go.
>> That said, I wonder, Chris, are you building (running ant) at the
>> component level? If so, then I wonder why it would take that long. If
>> you build at the root level, yes, that is a pain. But locally in the
>> component...that, to me is worth the small amount of time it takes build
>> and restart.
>> Just my 2 cents.
>> Ruth
>> Jacques Le Roux wrote:
>>    
>>> OFBiz has been conceived with this idea in mind. I mean reducing the
>>> need to restart the server. That's one of the reason why the minilang
>>> exists...
>>>
>>> Jacques
>>>
>>> From: "snowc" <[hidden email]>
>>>      
>>>> Although I much prefer editing java over bsh, I keep finding myself
>>>> using bsh
>>>> over java to overcome the lengthy compile/restart cycle (similar to the
>>>> problem with fat ejb versus thin pojo development).  Is there a way to
>>>> reduce this cycle?
>>>>
>>>>
>>>> jacques.le.roux wrote:
>>>>        
>>>>> As long as you modify Java code, you will still need to compile,
>>>>> hence to
>>>>> stop and restart the server (else you get a conflict on
>>>>> jars used when compiling)
>>>>>
>>>>> Jacques
>>>>>
>>>>> From: "snowc" <[hidden email]>
>>>>>          
>>>>>> Everytime I make a change to java code, I run "ant" and then
>>>>>> restart the
>>>>>> ofbiz service to pick up the changes.
>>>>>>
>>>>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html 
>>>>>>
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>            
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>        
>>>
>>>      
>>
>>    
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Bob Morley
We typically execute Ofbiz from Eclipse and some people have reported that the hot-swapping works fairly well.  (Usually we do not run an ant build until right before check-in and then just to ensure we are compiling and avoiding classpath issues).

The approach I often take is to write my unit test in conjunction with the service implementation I am working on.  I have added some mocking capabilities in our Ofbiz installation, so I can avoid starting up the container at all and still exercise all of the logic in the service method.  Result is usually a sub-second unit test.  Naturally an integration test would require container start-up and a reasonably heavy penalty.

Another approach others have used is to write the service method in groovy and once working convert this into java.  From memory there is really only a single sample of a groovy implemented service, and when I went to do there there was at least one bug I had to resolve.  But this is a feasible way and the groovy is quite a bit like java.  :)

- Bob

Ruth Hoffman-2 wrote
Hi Chris:
I guess I'm just use to the inconvenience. :-( The other thing I do to
try and minimize restart time is to comment out the components I might
not be using.
Ruth
Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

chris snow
Hi Bob,  The mocking code sounds great.  Would you be happy to share?

Bob Morley wrote
We typically execute Ofbiz from Eclipse and some people have reported that the hot-swapping works fairly well.  (Usually we do not run an ant build until right before check-in and then just to ensure we are compiling and avoiding classpath issues).

The approach I often take is to write my unit test in conjunction with the service implementation I am working on.  I have added some mocking capabilities in our Ofbiz installation, so I can avoid starting up the container at all and still exercise all of the logic in the service method.  Result is usually a sub-second unit test.  Naturally an integration test would require container start-up and a reasonably heavy penalty.

Another approach others have used is to write the service method in groovy and once working convert this into java.  From memory there is really only a single sample of a groovy implemented service, and when I went to do there there was at least one bug I had to resolve.  But this is a feasible way and the groovy is quite a bit like java.  :)

- Bob

Ruth Hoffman-2 wrote
Hi Chris:
I guess I'm just use to the inconvenience. :-( The other thing I do to
try and minimize restart time is to comment out the components I might
not be using.
Ruth
Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Tim Ruppert
+1 - would be super helpful.

Cheers,
Tim
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

On Aug 18, 2009, at 12:05 AM, snowc wrote:

>
> Hi Bob,  The mocking code sounds great.  Would you be happy to share?
>
>
> Bob Morley wrote:
>>
>> We typically execute Ofbiz from Eclipse and some people have  
>> reported that
>> the hot-swapping works fairly well.  (Usually we do not run an ant  
>> build
>> until right before check-in and then just to ensure we are  
>> compiling and
>> avoiding classpath issues).
>>
>> The approach I often take is to write my unit test in conjunction  
>> with the
>> service implementation I am working on.  I have added some mocking
>> capabilities in our Ofbiz installation, so I can avoid starting up  
>> the
>> container at all and still exercise all of the logic in the service
>> method.  Result is usually a sub-second unit test.  Naturally an
>> integration test would require container start-up and a reasonably  
>> heavy
>> penalty.
>>
>> Another approach others have used is to write the service method in  
>> groovy
>> and once working convert this into java.  From memory there is  
>> really only
>> a single sample of a groovy implemented service, and when I went to  
>> do
>> there there was at least one bug I had to resolve.  But this is a  
>> feasible
>> way and the groovy is quite a bit like java.  :)
>>
>> - Bob
>>
>>
>> Ruth Hoffman-2 wrote:
>>>
>>> Hi Chris:
>>> I guess I'm just use to the inconvenience. :-( The other thing I  
>>> do to
>>> try and minimize restart time is to comment out the components I  
>>> might
>>> not be using.
>>> Ruth
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25019021.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Ruth Hoffman-2
In reply to this post by Bob Morley
Hi Bob:
Yes, I forgot. Its been a while since I've done any hardcore
development. I also write as much of what I can in the Bean Shell (I
haven't converted to Groovy yet. :-( Once I get things working, I
convert to Java. That does save lots of time :-)
Ruth
Bob Morley wrote:

> We typically execute Ofbiz from Eclipse and some people have reported that
> the hot-swapping works fairly well.  (Usually we do not run an ant build
> until right before check-in and then just to ensure we are compiling and
> avoiding classpath issues).
>
> The approach I often take is to write my unit test in conjunction with the
> service implementation I am working on.  I have added some mocking
> capabilities in our Ofbiz installation, so I can avoid starting up the
> container at all and still exercise all of the logic in the service method.
> Result is usually a sub-second unit test.  Naturally an integration test
> would require container start-up and a reasonably heavy penalty.
>
> Another approach others have used is to write the service method in groovy
> and once working convert this into java.  From memory there is really only a
> single sample of a groovy implemented service, and when I went to do there
> there was at least one bug I had to resolve.  But this is a feasible way and
> the groovy is quite a bit like java.  :)
>
> - Bob
>
>
> Ruth Hoffman-2 wrote:
>  
>> Hi Chris:
>> I guess I'm just use to the inconvenience. :-( The other thing I do to
>> try and minimize restart time is to comment out the components I might
>> not be using.
>> Ruth
>>
>>    
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: is compile and ofbiz restart still needed for java changes?

Bob Morley
In reply to this post by Tim Ruppert
I have created a first shot at making use of mocking in unit tests.  You can take a look at https://issues.apache.org/jira/browse/OFBIZ-2842.  There are more notes on the ticket; but here are some highlights:

- selected "mockito" framework (MIT lic)
- created a new BaseTestCase
- extended to an OfbizMockTestCase (in services) with mocked delegator, disaptcher, and dctx.  Also has some testcase extensions to make checking success/error of services easier, creating service context, etc.
- wrote CommonDimensionServicesTest

This guy does not require an ofbiz container and runs inside my Eclipse in about .5s (granted it does not test a whole lot).  It tests some failure scenarios as well as a successful "creation" of a DateDimension entity.  One thing you will notice is that it is easy to test "exception" scenarios.  So testing error handling for situations like database deadlocks become very easy to do.  Moreover, you can test third party integration logic using similar techniques.

Tim Ruppert wrote
+1 - would be super helpful.

Cheers,
Tim
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

On Aug 18, 2009, at 12:05 AM, snowc wrote:

>
> Hi Bob,  The mocking code sounds great.  Would you be happy to share?
>
>