Eclipse Scout Neon : service registry does not contain a service of type - service

I try to call scout service from Scout Form, so I create interface in shared folder
#TunnelToServer
public interface IPersonsFormService extends IService {
void test();
}
and in server I created implementation of this interface
public class PersonsFormService implements IPersonsFormService {
#Override
public void test() {
System.out.println("TEST");
}
}
but I get
o.e.scout.rt.platform.exception.ExceptionHandler - SecurityException:service registry does not contain a service of type com.sixt.leasing.contract.scout.shared.person.IPersonsFormService [majorPrincipal: 'marko']
java.lang.SecurityException: service registry does not contain a service of type com.sixt.leasing.contract.scout.shared.person.IPersonsFormService
It looks like interface is not registered, but in Neon I thought that service is registered with #TunnelToServer annotation.
Where else should I register service ?
This project is extension project of main project.
In Main project all services works,....

Solution: put scout.xml with default content in src/main/resources/META-INF folder of the server project.
Why did this happen? Since this is an extension we apparently forgot to copy this file and Scout Neon seems to ignore projects that don't contain this file.
Figured this out by putting a PlatformListener in that project and since that never triggered it was easier to track down the issue.

This annotation is requested for Remote-Service (see also the 3.5.1. #TunnelToServer section). The implementation class (or the interface) should have the #ApplicationScoped annotation.
For Local-Service, use either the #Bean or the #ApplicationScoped annotation to register the service.
If your annotations are correct, your Jandex index might be broken.
Start the application with -Djandex.rebuild=true to rebuild the application on startup.
This will recalculate each of your target/classes/META-INF/jandex.idx files.
Of course, you can also delete each file manually. Running mvn clean also clean those files.

Related

Using Fabric8's Openshift Client, is there a way I can tell if a Project Name is available, as a regular user?

In the recent versions of OpenShift when you delete a project, the project will be taken off of the project list, but for whatever reason - the namespace will be unavailable until after some time. I imagine it is still cleaning up and/or shutting down resources in the background.
Before, I was using client.projects.list() to get access to the projects, to verify that the new project I wish to create did not already exist. But now a project may not be in this list, but it's name may still be unavailable (if it were recently deleted), thus throwing an error when I submit a new project request for creation (i.e. stating "This name is already in use").
How can I easily verify, as a regular user, if a project name is available for use?
OpenShiftClient can watch the state of the project.
Project project = new ProjectBuilder().withNewMetadata().addToLabels("key", "label").endMetadata().build();
client.resource(project).watch(new Watcher<Project>() {
#Override
public void eventReceived(Action action, Project resource) {
// logic goes here
}
#Override
public void onClose(KubernetesClientException cause) {
}
});

GWT Request Factory. Where to put Proxies?

I have multimodule maven project. Root Module: parent contain: server, shared, client submodules.
I wonder where in that structure should I put Proxy classes? Now I have them in client module, but I would like to put them into shared module.
Please give me your thought about that. Is this make any sens. I am asking, cause I saw diferent versions.
Here is my proxy class:
package pl.derp.web.proxy;
import java.util.List;
import pl.derp.server.entity.User;
import com.google.web.bindery.requestfactory.shared.ProxyFor;
import com.google.web.bindery.requestfactory.shared.ValueProxy;
#ProxyFor(value = User.class)
public interface UserProxy extends EntityProxy {
public String getName();
public void setName( String name );
}
The Proxy interfaces need to be available to the client (browser) and server. So they need to be somewhere that both can see the source and classes.
Although your server side source will not reference them directly it is used by the server side part of the build and runtime.
The client source code uses them heavily for your domain code and in the generated plumbing.
We have a web client module that is split in to server/shared/client packages. Having a different module should be OK but I think your shared module will need to export the source.

Eclipse 4 declarative service injection in a declarative service

I am creating declarative services, lets call them Service1 and Service2.
Everything works fine in my eclipse RCP application.
Now I want my Service1 to be injected into Service2, so my Service2 class have a new field like this :
#Inject
Service1 myService1;
This never gets injected and Debugging a little the Declarative Service instanciation in Eclipse 4 (org.eclipse.equinox.internal.ds.model.ServiceComponent) it seems that nothing get injected after the class has been instanciated.
Is this a limitation of the DS implementation in eclipse ?
Is there a way to fix this ?
Thanks.
No, it is not possible by default. You can make some utility class which is called on #Acivate which searching the coresponding service on tracker and sets the #Inject service with reflection, but in that case you will lose all of lifecycle, so its not a nice osgi way.
If you would line to use #Inject annotation you can use pax-cdi for that, but on that case you cannot use the declarative service annotations on that class - because in that case the pax will instantiate and register the service on the tracker.

JBoss ESB pipeline interceptors

I am new to JBoss ESB and I am trying to intercept and handle all messages that happen on my application server.
I found that pipeline interceptors are what I am looking for. However, I am unable to make them work. Could you direct me to any tutorial concerning this problematigue? I tried documentation for JBoss ESB but this section is very vague. Is there any working sample with pipeline interceptors? I have not found any...
Here is what I have tried:
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.message.PipelineInterceptor;
import org.jboss.soa.esb.message.Message;
public class Interceptor implements PipelineInterceptor {
#Override
public void processMessage(Message msg, ConfigTree arg1) {
System.out.println("Intercepted" + msg.getContext());
}
}
I programmed this very simple class and converted it into a .jar file and placed it in the root directory of my project. I also copied jbossesb-properties.xml next to it and uncommented the interceptors section. What else should I do? Where do I specify the path to my interceptor class?
Any help is appreciated...
Ok, after a day of trying everything possible, I think I have solved it. You have to place the .jar file with Interceptor somewhere in the path of ESB (the best way is probably to the folder with deployed ESB in AS) and specify path to it in jbossesb-properties.xml file...

Second compilation of same sources produces different set of gwt.rpc files

I would like to follow up on this question gwt-serialization-policy-hosted-mode-out-of-sync. In short - when I do a RPC from hosted browser then this call fails on server with the exception.
INFO: GwtRpcEventSrvc: ERROR: The serialization policy file '/84EC7BA65AF8175BAA99B47877FDE163.gwt.rpc' was not found; did you forget to include it in this deployment?
SEVERE: GwtRpcEventSrvc: WARNING: Failed to get the SerializationPolicy '84EC7BA65AF8175BAA99B47877FDE163' for module 'http://host:19980/MYAPP/'; a legacy, 1.3.3 compatible, serialization policy will be used. Youmay experience SerializationExceptions as a result.
SEVERE: Exception while dispatching incoming RPC call
While when I do the same RPC from browser then the request is performed successfully on server.
In addition I observed a strange behavior of GWT compiler that could result in a problem with hosted browser mode.
I assume when I do two subsequent compilations of an exact same code then the result of the individual compilations is supposed to be same. I mean at least the xxxxx.html and yyyyy.gwt.rpc files have to be same. (Where xxxxx and yyyyy are the long numbers such as 84EC7BA65AF8175BAA99B47877FDE163.)
Currently I have two versions of my project.
An old project compiled by GWT 1.7 that does not suffer from problem with the hosted browser described in gwt-serialization-policy-hosted-mode-out-of-sync
A new project that is compiled by GWT 2.0.4. This new project is based on the old project. This project suffer from the hosted browser problem.
Case 1: Old project with GWT 1.7
I took my old project that was compiled by GWT 1.7. I did two compilations and I compared compilation artifacts. gwt.rpc files were same while html files had different content and name. Since the gwt.rpc files were alwas same I did not have a problem with hosted browser.
Case 2: New project with GWT 2.0.4
I compiled it twice and both gwt.rpc and html files were different. Therefore RPC call in hosted browser failed on server because of missing gwt.rpc file.
Case 3: Old project with GWT 2.0.4
I compiled it twice and both gwt.rpc and html files were different. Therefore RPC call in hosted browser failed on server because of missing gwt.rpc file.
I did some investigation and identified that when I comment out a data member in a class Data that is transmitted from server to client, then compiled files start being same.
class Data implements IsSerializable {
List<IsSerializable> data;
...
}
I wanted to do same thing in the new project but it seems that there are many classes to be modified. So the problem is growing as the project is growing.
I don't know what to use instead of
List<IsSerializable> data;
to transfer data.
You need to read some more on GWT serialization policies:
Serializable Types
Usually you don't mingle with .rpc files unless your are doing advanced RPC calls directly to your server.
Your serializable object :
class Data implements IsSerializable {
List<IsSerializable> data;
...
}
A user-defined class is serializable if all of the following apply:
It is assignable to IsSerializable or Serializable, either because it directly implements one of these interfaces or because it derives from a superclass that does
All non-final, non-transient instance fields are themselves serializable, and
As of GWT 1.5, it must have a default (zero argument) constructor (with any access modifier) or no constructor at all.
So you should probably have something like:
class Data implements IsSerializable {
List<YOUR_TYPE> data;
...
}
Your list's template is a type, you don't set 'IsSerializable'... it should be something like :
List<int> data;