Message Boards

Changes to ServiceBuilder not visible after redeploy with Developer Studio

Marc-Andre Gauthier, modified 2 Years ago.

Changes to ServiceBuilder not visible after redeploy with Developer Studio

New Member Posts: 21 Join Date: 7/30/15 Recent Posts

I'm developing with Dev Studio 3.9.4.

Localhost server is Liferay CE 7.4.2 GA3

  1. Start localhost server from Dev Studio
  2. Change the interface of my ServiceBuilder project (new method, method signature change etc.)
  3. Rebuild my service (BuildService Gradle task)
  4. Build is successful. Console shows "myservice stopped" "myservice started"
  5. In eclipse, intellisense detects with my new code (method or method signature)
  6. I get runtime errors (eg: nosuchmethod exceptions etc.)
  7. I have to restart my local server and then runtime errors are gone and everything is ok

Is there a way to avoid from restarting the server? I don't have this problem for other projects (eg: portlet). Changes for these projects are immediately available. 

Am I missing something for ServiceBuilder?

Thanks in advance.

thumbnail
Olaf Kock, modified 2 Years ago.

RE: Changes to ServiceBuilder not visible after redeploy with Developer Stu

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

Do you store any of the services or objects outside of the service projects? This way the classes couldn't be unloaded and you'd see unexpected results with stale old class code in random locations.

If you stick with @Reference and forget about those objects after you've used them in a request, nothing bad should happen. But if you hold them any longer (including the model objects), you might see weird behavior - especially if you're calling methods on them while two of the class's definitions are around.

Marc-Andre Gauthier, modified 2 Years ago.

RE: Changes to ServiceBuilder not visible after redeploy with Developer Stu

New Member Posts: 21 Join Date: 7/30/15 Recent Posts

Hi Olaf. Thanks for your time.

I mainly do simple stuff like: 

  1. Create a ResourceCommand class
  2. Declare @Reference to MyServiceBuilder in the resource command. eg:
    1. @Reference
    2. private volatile MyLocalService myLocalService
  3. Call a method
    1. myLocalService.dosomething();

Only thing out of the ordinary is that I have declared a class inside the servicebuilder project that i use in the other projects. eg:

  1. CustomClassDefinedInServiceBuilder something = myLocalService.doSomething();

Don't know if this could cause the problem. I also get errors for things that are not related to that custom class. I also get a nosuchmethod exception on myLocalService.doSomething() if I change the signature of doSomething() for example. 

Anyway this is not a blocking problem. Just takes a takes a bit more time waiting for the server to restart. 

Thanks again.

Scarletake Bwi, modified 2 Years ago.

RE: RE: Changes to ServiceBuilder not visible after redeploy with Developer

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

in my experience

sometime, even you use @Reference, it won't update.

i will delete all in temp of tomcat, and delete all module of osgi, and restart with clean(if you use studio to start server)

i do believe it not good practice, but it work on me.