1

i am trying to run the example java code for the Q&A starter application from

https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/getting_started/gs-full-java.shtml

i see this error in my project's Markers view

enter image description here

note that i am still able to run the application but when i hit the Ask button, i get

enter image description here

Please advise on how i can properly set up my project.

EDIT

i can see that i have liberty installed

enter image description here

is this the correct plugin i should be installing?

also in my targeted runtimes for the project

enter image description here

and my project facets

enter image description here

finally, my java build path

enter image description here

i know its a lot of information but i am really struggling with the set up here.

any help is appreciated.

EDIT2

here is what i see in my project servers

enter image description here

in the server view, when i try to add a new server, i see these options

enter image description here

is that how it should be ?

further, do i need to enable any of the following websphere options in my project facets?

enter image description here

ok, so after much struggle i was able to set up my liberty profile correctly. but now when i hit the Ask button, i get

enter image description here

and here is the piece of code that causes it

    JSONObject questionJson = new JSONObject();

but why, i have all the imports properly set up and i do not see any compilation errors?

Another EDIT

Please tell me if i am missing anything

here is a view of my servers

enter image description here

and here is a view of my targeted runtimes

enter image description here

and here is my build path

enter image description here

Am i missing something? Could this be causing the aforementioned NoClassDefFound error ?

Server.xml

enter image description here

How can i get all the requisite features in my server?

AbtPst
  • 7,778
  • 17
  • 91
  • 172

1 Answers1

1

The problem is that you don't have liberty installed. The project is expecting that has target.

Here you have a guide on how to install liberty profile in eclipse: https://developer.ibm.com/wasdev/downloads/liberty-profile-using-eclipse/

Once you have it installed you will need to create a server and deploy the app in that server.

Eclipse has a good guide on how to create servers.

UPDATE: If you have liberty installed, set it as server and make sure it is as target runtime too. See this animated gif.

German Attanasio
  • 22,217
  • 7
  • 47
  • 63
  • please see the edit. i can see that liberty is installed – AbtPst Oct 16 '15 at 17:20
  • 1
    I added an animated gif with the things you need to do. http://g.recordit.co/cruCL86kUI.gif – German Attanasio Oct 16 '15 at 17:27
  • cool ! thanks. please see the edit2 for my servers. i do not see the same server as you have displayed in your gif. is it just because you are developing on MAC? – AbtPst Oct 16 '15 at 17:37
  • 1
    In the last image you have, add the liberty server and deploy the app there. – German Attanasio Oct 16 '15 at 17:39
  • you mean the second option? but i already have such a server added – AbtPst Oct 16 '15 at 17:50
  • i have added another image, please take a look – AbtPst Oct 16 '15 at 17:51
  • hi, i was able to set up the profile correctly, but now i run into a different error. please see the latest part – AbtPst Oct 16 '15 at 19:12
  • 1
    Check the gif I've created. Seems like the application can't find a jar that is part of the liberty target. – German Attanasio Oct 16 '15 at 21:32
  • hi German, i have the target runtime and build paths set up correctly. where else would i need to specify the JARs? – AbtPst Oct 19 '15 at 15:36
  • 1
    1. server and target should have liberty server selected. 2. The jars lin the lib folder should be included in the classpath. – German Attanasio Oct 19 '15 at 17:10
  • so liberty server is different from WAS liberty profile? how do i get that? how do i include the jars in my classpath? i thought that all i had to do for that was to add them in the java build path – AbtPst Oct 19 '15 at 17:23
  • 1. Liberty/WAS are the same. 2. Adding to the build-path is part of adding them to the classpath. Make sure that json is in the features pack for the liberty server you have: http://i.imgur.com/dnPxuI7.png – German Attanasio Oct 19 '15 at 17:39
  • thanks! but i see that my view is different from yours. please see the edit. what do i need to do in order to get all the features installed? – AbtPst Oct 19 '15 at 19:15
  • 1
    did you click on "add"? – German Attanasio Oct 19 '15 at 19:23
  • ok, i was able to add the json feature. but now i get connection timeout error Error: Connect to stream.watsonplatform.net:443 [stream.watsonplatform.net/23.246.237.53] failed: Connection timed out: connect – AbtPst Oct 19 '15 at 19:24
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/92767/discussion-between-german-attanasio-and-abtpst). – German Attanasio Oct 19 '15 at 19:46
  • thanks, but unfortunately, i cant use chat at work as the chat website is barred here – AbtPst Oct 19 '15 at 20:43
  • why would i be getting a connection timeout? – AbtPst Oct 19 '15 at 20:46
  • thanks for the help German. i have opened up another question for the connection timeout. http://stackoverflow.com/questions/33237872/cannot-connect-to-gateway-watsonplatform-net443 would be great if you can help me out there as well :) – AbtPst Oct 20 '15 at 13:25