Error while running a simple GWTP Project in eclipse - gwtp

`I'm new to gwtp and trying to learn it .I am trying to run a simple gwtp project on eclipse (Kepler) and my gwtp project contains a new presenter I have created under client package and i have only edited the UI.xml file just to check .But I dont seem to understand what the problem is ,as I'm trying to run the project in super dev mode Click here to see the console snap, i am getting this error :
Starting Jetty on port 8888
[WARN] FAILED guiceFilter: com.google.inject.ConfigurationException: Guice configuration errors:
1) No implementation for com.gwtplatform.dispatch.rpc.server.Dispatch was bound.
while locating com.gwtplatform.dispatch.rpc.server.Dispatch
for parameter 1 at com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl.(DispatchServiceImpl.java:54)
while locating com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl
2) No implementation for com.gwtplatform.dispatch.rpc.server.RequestProvider was bound.
while locating com.gwtplatform.dispatch.rpc.server.RequestProvider
for parameter 2 at com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl.(DispatchServiceImpl.java:54)
while locating com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl

You are most probably missing the installation of the GWTP needed modules.
Client Module file you need to install the GWTP modules (DefaultModule and RpcDispatchAsyncModule).
You should have something like:
public class ClientModule extends AbstractPresenterModule {
#Override
protected void configure() {
install(new DefaultModule());
install(new RpcDispatchAsyncModule()); // binds DispatchAsync to RpcDispatchAsync
install(new ApplicationModule()); //This is your main application module
// DefaultPlaceManager Places
bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.home);
bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.home);
bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.home);
}
}

Related

IntelliJ run vs running a jar, with a Springboot Kotlin, Multi module Gradle project with Social Oauth2

TL;DR: Why does everything run fine when started via IntelliJ, and why is it broken when call java -jar app.jar. And how do I fix this?
Alright, I have some issues with a backend I am trying to dockerize. I have an application created with Spring Boot (1.4.2.RELEASE) following the Spring Oauth (2.0.12.RELEASE) guide on their page. I follow the Gradle version, since I prefer Gradle over Maven. Also I am using Kotlin instead of Java. Everything is fine, I start via IntelliJ my backend with static front end, I can login via Facebook (and Google and Github), I receive a nice Principal witch holds al the information I need, and I can modify Spring Security to authorize and permit endpoints. So far so good.
Now for the bad part, when I run either ./gradlew clean build app:bootrun or ./gradlew clean build app:jar and run the jar via java -jar (like I will do in my Docker container), my backend comes up. My static front end pops up. Now I want to login via Facebook, I end up on the Facebook login page, I enter my credentials, and... nothing!
I end up back on my homepage, not logged in, no log messages that mean anything to me, just silence. The last thing I see in the log is:Getting user info from: https://graph.facebook.com/me
This Url will give me in my browser:
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "GV/58H5f4fJ"
}
}
When going to this URL via an IntelliJ start, it will give me credential details. Obviously something is going wrong, but I have no clue what. Especially since a run from IntelliJ works fine. There is some difference between how the jar is started, and how IntelliJ's run config works, but I have no clue where to search for what. I could post trace logging, or all my Gradle files, but perhaps thats too much info to put in 1 question. I will defenitly update this question if someone needs some more details :)
The structure outline of this project is as follows:
root:
- api: is going to be opensourced later, contains rest definitions and DTOs.
- core: contains the meat. Also here is included in the gradle file
spring-boot-starter, -web, -security, spring-security-oauth2, and some jackson stuff.
- rest: contains versioned rest service implementations.
- app: contains angular webjars amongst others, the front end, and
my `#SpringBootApplication`, `#EnableOAuth2Client`
and the impl of `WebSecurityConfigurerAdapter`.
Why does everything run fine when started via IntelliJ, and why is it broken using bootRun or the jar artefact. And how do I fix this?
I found it, the problem was not Multi module Graldle, Spring boot, or Oauth2 related. In fact it was due to a src set config of Gradle, where Java was supposed to be in a Java src set folder, and Kotlin in a Java src set folder:
sourceSets {
main.java.srcDirs += 'src/main/java'
main.kotlin.srcDirs += 'src/main/kotlin'
}
As Will Humphreys stated in his comment above, IntelliJ takes all source sets, and runs the app. However, when building the jar via Gradle, these source sets are stricter. I had a Java file in my Kotlin src set, which is no problem for IntelliJ. But the jar created by Gradle takes into account the source sets as defined in the build.gralde file, which are stricter.
I found my missing bean issue with the code below:
#Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
};
}
The Bean I missed was called AuthenticationController, which is a #RestController, and kinda crucial for my authentication code.

call pydev server from custom eclipse plugin

I am trying to build an eclipse plugin and want to start PyDev debugger server locally. Is it possible to make a call like this?
Calling the pydev server from the Handler's execute method:
#Override
public Object execute(ExecutionEvent event) throws ExecutionException {
//call PyDev Debug server from here
PydevRemoteDebuggerServer.startServer();
}
But, I'm getting an unsupported version error. (Tried updating the version on the class path and build. Yet, it results in same issue). Is the approach wrong or is it because of the variations in versions?
Please, correct me on this.
Add all the required pydev plugin jars. Though, I just wanted to start Pydev's Remote Debugger Server locally there are few other dependencies that needs to be handled.
Best way is to add these jars -
core.jar
pydev-debug.jar
shared_core.jar
debug.jar
Note: Update the class path after adding the jars.

Unity WCF config

Hello i am trying to implement the Unity dependency pattern into my wcf project. I have installed the required packages and am trying to setup the registeredtypes into the container. I am strictly following the examples on the codeplex website but i keep getting "WcfServiceFactory does not implement inherited abstract member ConfigureContainer." Which is kinda strange since im overriding it in the servicefactory. I had a look in the example project but i cant seem to find what im doing wrong. Please help!
namespace WCFService
{
public class WcfServiceFactory : UnityServiceHostFactory
{
protected override void ConfigureContainer(IUnityContainer container)
{
// register all your components with the container here
container
.RegisterType<IPersonRepository, PersonRepository>();
}
}
}
Well in the end it seems it was an issue with the packages installed. After removing all packages and reinstalling them there was no longer an issue... :S

ClassNotFoundException on weblogic cluster node

We have a web application(.war) deployed on a weblogic 10.3.4 cluster in 'staging' mode.
So,the .war is copied over to the staging directory of the nodes;and the application is responding to user requests fine.
However,we get a ClassNotFoundException when a processor class tries to invoke an action class dynamically.
(Note: Processor and action have nothing to do with any of the frameworks.It is just a nomenclature.)
protected Action getAction(String sActionName) throws ActionException {
Action action = null;
Object o = null;
try {
String sClassName = getActionClassName(sActionName);
Class actionClass = Class.forName(sClassName);
o = actionClass.newInstance();
} catch(Exception e) {
}
return action;
}
We have verified that the class exists within the war and can be instantiated just fine through an independent application.
Why cant the node not find it then?
Do we need to point the application .war from the staging directory to weblogic classpath explicitly?
That would be quite odd.
You can try to check if your Classpath is correct using Weblogic CAT tool.
https://docs.oracle.com/cd/E24329_01/web.1211/e24368/classloading.htm#WLPRG495
CAT is a Web-based class analysis tool which simplifies filtering classloader configuration and aids you in analyzing classloading issues, such as detecting conflicts, debugging application classpaths and class conflicts, and proposes solutions to help you resolve them

Hot re-deployment of a RESTlet

I'm interested in setting up a super lightweight web server with Restlet mostly for proofs-of-concept and low impedance collaboration with other developers. A full servlet container feels too heavy. Literally, I'm starting with something pulled directly from the "Getting Started" guide.
public class Dummy extends ServerResource {
public static void main(String[] args) throws Exception {
new Server(Protocol.HTTP, 8182, Dummy.class).start();
}
#Get("json")
public String hello() {
ST hello = new ST();
hello.add("name", "World");
return "{ \"hello\": \"World\"}";
}
}
However, I'd like to be able to watch for changes and redeploy automatically as I change code. I know Jetty can do this with some config. Has anyone done this without setting up a full servlet container? Is there something simpler?
I use Eclipse as my IDE to edit the code and launch the app, but the ideal solution wouldn't rely on that.
This what I call Continuous Delivery.
In a nutshell:
I usually use
SVN or Git to store and version source code
Jenkins to schedule the build and deployment
Gradle or Maven to build and test
The SCM plugin is able to poll the repository and invoke the process only if there is changes, or you can trigger the build with a hook.
There are plugins to copy your artifact to the target server and restart the application.