WURFL demo servelt run time error in java

Questions about the WURFL Cloud service.
tntwurfl
Posts: 7
Joined: Mon Sep 09, 2013 4:19 pm

WURFL demo servelt run time error in java

Postby tntwurfl » Tue Sep 10, 2013 11:18 am

Hello,
I am getting following error while running the cloud test application for Java. I am a member and downloaded the key to run the servlet.


11:10:00 [[ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'] E c.s.wurflcloud.CloudClient 394 - java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'api.wurflcloud.com', port: '80'
<Sep 10, 2013 11:10:00 AM CDT> <Error> <HTTP> <BEA-101020> <[ServletContext@24748248[app:_auto_generated_ear_ module:cloud path:/cloud spec-version:2.5]] Servlet failed with Exception
com.scientiamobile.wurflcloud.exc.UnreachableServerException: There is no possibility to answer. Probably the Cloud Service is unreachable, or you don't have required authorization to access it
at com.scientiamobile.wurflcloud.ThrowExceptionRecoveryManager.getRecoveryID(ThrowExceptionRecoveryManager.java:37)
at com.scientiamobile.wurflcloud.CloudClient.tryRecovery(CloudClient.java:487)
at com.scientiamobile.wurflcloud.CloudClient.detectDevice(CloudClient.java:395)
at com.scientiamobile.wurflcloud.CloudClientManager.getDeviceFromRequest(CloudClientManager.java:143)
at my.wurflcloud.example.MyCloudClientServlet.doPost(MyCloudClientServlet.java:65)
Truncated. see log file for complete stacktrace
>
<Sep 10, 2013 11:10:00 AM CDT> <Error> <Kernel> <BEA-000802> <ExecuteRequest failed
java.lang.NullPointerException.
java.lang.NullPointerException
at jsp_servlet.__error._jspService(__error.java:83)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:35)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
Truncated. see log file for complete stacktrace

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: WURFL demo servelt run time error in java

Postby sm_support2 » Tue Sep 10, 2013 3:16 pm

Can you verify that you can ping 'api.wurflcloud.com' from your server?

it seems to us that this is a problem with the network connection.

thanks

tntwurfl
Posts: 7
Joined: Mon Sep 09, 2013 4:19 pm

Re: WURFL demo servelt run time error in java

Postby tntwurfl » Tue Sep 10, 2013 3:52 pm

Error is coming from WURFL API. Yes, Servlet is unable to connect with "api.wurflcloud.com". Do I need anything from my dev env. I am unable to ping "api.wurflcloud.com" also I am unable to reach this URL from browser. What kind of call API is makingto "api.wurflcloud.com".


AbstractDevice device = manager.getDeviceFromRequest(req, resp, capabilities);


Here is the example Java code that WURFL generated
public class MyCloudClientServlet extends HttpServlet {
private final Logger logger = LoggerFactory.getLogger(getClass().getName());
private ICloudClientManager manager;
//customize with your cloud service key
private static final String TEST_API_KEY = "708005:kItTWDPl42XsfFBco0vG3Rdiy17NeaUK";
private String[] capabilities;

/**
* Create shared ICloudClientManager instance by mean of CloudClientLoader
*
* @throws ServletException
*/
public void init() throws ServletException {
System.out.println("INSIDE WURFL CLOUD INIT ");

super.init();
try {
CloudClientLoader loader = new CloudClientLoader(TEST_API_KEY);
manager = loader.getClientManager();
capabilities = loader.getSearchedCapabilities();
} catch (Throwable t) {
throw new ServletException(t);
}
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("INSIDE WURFL CLOUD DoGet ");

doPost(req, resp);
}

protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("INSIDE WURFL CLOUD DoPost ");


String useragent = req.getHeader("User-Agent");
if (useragent == null) useragent = req.getHeader("user-agent");
if (logger.isDebugEnabled()) logger.debug("user agent: " + useragent);
long start = System.currentTimeMillis();
AbstractDevice device = manager.getDeviceFromRequest(req, resp, capabilities);
long time = System.currentTimeMillis() - start;
logger.info("device: " + device);
Info i = new Info(time);
String apiVersion = manager.getAPIVersion();
if (logger.isDebugEnabled()) logger.debug("apiVersion: " + apiVersion);
i.setCloudVersion(apiVersion);
i.setClientVersion(manager.getClientVersion());
req.setAttribute("device", device);
req.setAttribute("info", i);
RequestDispatcher rd = req.getRequestDispatcher("/WEB-INF/response.jsp");
rd.forward(req, resp);
}

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: WURFL demo servelt run time error in java

Postby kamermans » Tue Sep 10, 2013 8:09 pm

Certainly there is a network issue if you are unable to ping api.wurflcloud.com. The client makes requests to that host via HTTP (port 80), although if you visit it with your browser, it will respond with something like "Not found". You must have one of these two problems:

1. DNS is not working. You can test this from a command line on Windows/Linux/Mac with "nslookup api.wurflcloud.com". You should see a response like "uk.wurflcloud.com" and an IP address. The result may vary based on your location, so it might be a different hostname, but it should not fail.

2. You have no route to the outside internet. Perhaps you have a firewall on your computer or network that is blocking outbound traffic, or maybe you need a proxy to access the internet, but in either case, you are not able to contact our servers. If you can't ping 50.57.185.227 from your location, there is something like a proxy going on (that is one of our US WURFL Cloud servers - I gave you the IP to avoid the DNS problem above).

Your development environment should work just fine without any special configuration, assuming you have outbound internet access.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

tntwurfl
Posts: 7
Joined: Mon Sep 09, 2013 4:19 pm

Re: WURFL demo servelt run time error in java

Postby tntwurfl » Wed Sep 11, 2013 12:20 pm

I can access outside internet from my computer, I am accessing your website and downloading examples etc and can also access any other website. I have set the proxy settings in Eclipse to http-proxy:80, but still I am getting connection timeout error in eclipse. I tried to deploy example war file on Weblogci server and run it, I am aslo getting connection error from WL server as well. Do I need to set anything in Eclipse or weblogic to make a connection to api.wurflcloud.com.

tntwurfl
Posts: 7
Joined: Mon Sep 09, 2013 4:19 pm

Re: WURFL demo servelt run time error in java

Postby tntwurfl » Wed Sep 11, 2013 3:28 pm

Hello,

We have a premium account with WURFL, and looking for some help to resolve this issue, please let us know why we cannot reach to api.wurflcloud.com.

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: WURFL demo servelt run time error in java

Postby sm_support2 » Wed Sep 11, 2013 3:44 pm

We will get our Java engineer to contact you and work with you on the problem. Is the email address with which you have registered the right one to contact you?

Thanks

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: WURFL demo servelt run time error in java

Postby kamermans » Wed Sep 11, 2013 3:49 pm

Have you confirmed that there is no web proxy in your environment? Most modern browsers will detect the presence of a proxy and use it for HTTP traffic, but java/weblogic will not.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!


Who is online

Users browsing this forum: No registered users and 7 guests