Hi ,
using 1.8.3.1 wurfl java API when we call rest api getting below runtime exception
SEVERE: Servlet.service() for servlet [rest] in context with path [/Add_Network_API] threw exception [Request processing failed; nested exception is com.scientiamobile.wurfl.core.exc.WURFLRuntimeException: WURFL unexpected exception] with root cause
java.lang.NullPointerException: in is null
at java.util.zip.ZipInputStream.<init>(Unknown Source)
at java.util.zip.ZipInputStream.<init>(Unknown Source)
at com.scientiamobile.wurfl.core.resource.b.a(Unknown Source)
at com.scientiamobile.wurfl.core.resource.b.a(Unknown Source)
at com.scientiamobile.wurfl.core.resource.b.c(Unknown Source)
at com.scientiamobile.wurfl.core.resource.XMLResource.getData(Unknown Source)
at com.scientiamobile.wurfl.core.resource.DefaultWURFLModel.a(Unknown Source)
at com.scientiamobile.wurfl.core.resource.DefaultWURFLModel.<init>(Unknown Source)
at com.scientiamobile.wurfl.core.GeneralWURFLEngine.a(Unknown Source)
at com.scientiamobile.wurfl.core.GeneralWURFLEngine.load(Unknown Source)
at com.rhan.adnw.controller.WurflEngineData.wurflData(WurflEngineData.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
WURFL unexpected exception] with root cause
Re: WURFL unexpected exception] with root cause
Hi Arti,
Thank you for reaching out to us. Are you able to provide us with the date of your WURFL.xml file as well as a code sample of how you have your GeneralWURFLEngine configured and the capabilities you are calling for?
Thanks,
Aaron
Thank you for reaching out to us. Are you able to provide us with the date of your WURFL.xml file as well as a code sample of how you have your GeneralWURFLEngine configured and the capabilities you are calling for?
Thanks,
Aaron
-
- Posts: 5
- Joined: Fri Mar 10, 2017 1:41 am
Re: WURFL unexpected exception] with root cause
Hi Aaron,
PFB code and zip that we are using 1.8.3.1 evaluation version and getting runtime exception(wurfl.load()):
package com.rhan.adnw.controller;
import javax.servlet.http.HttpServletRequest;
import net.sourceforge.wurfl.core.WURFLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.multipart.MultipartFile;
import com.scientiamobile.wurfl.core.Device;
import com.scientiamobile.wurfl.core.GeneralWURFLEngine;
import com.scientiamobile.wurfl.core.WURFLEngine;
@RestController
@RequestMapping("/getWurflData/")
public class WurflEngineData {
//@Autowired private WURFLManager wurflManager;
@Autowired private WURFLEngine wurfl;
@RequestMapping(value = "wurfl.data", produces = "application/json",
method = RequestMethod.POST)
public @ResponseBody String wurflData(
HttpServletRequest httpServletRequest) {
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(httpServletRequest.getSession().getServletContext());
// GeneralWURFLEngine engine = (GeneralWURFLEngine) wac.getBean(WURFLEngine.class.getName());
// GeneralWURFLEngine engine = (GeneralWURFLEngine)wac.getBean("wurflEngine");
//Device device = (Device) engine.getDeviceForRequest(httpServletRequest);
String user_agent = "Mozilla/5.0 (Linux; Android 4.2.1; N9600 Build/JOP40D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Mobile Safari/537.36";
//System.out.println("wurfl object :"+wurfl);
wurfl.load();
System.out.println("wurfl load :");
Device device=wurfl.getDeviceForRequest(user_agent);
if(device==null)
{
System.out.println("device object null");
}
else
{
System.out.println("device object not null");
}
if(wac==null)
{
System.out.println("wac null");
}
else
{
System.out.println("wac not null"+wac);
}
// GeneralWURFLEngine engine = (GeneralWURFLEngine)AppContext.context.getBean("wurflEngine");
//GeneralWURFLEngine engine = (GeneralWURFLEngine) getServletContext(). getAttribute(GeneralWURFLEngine.class.getName());
////GeneralWURFLEngine engine = (GeneralWURFLEngine)wac.getBean("wurflEngine");
// GeneralWURFLEngine engine = new GeneralWURFLEngine("wurfl-ctx.xml");
/*GeneralWURFLEngine engine = (GeneralWURFLEngine) wac.getBean(WURFLEngine.class.getName());
if(engine==null)
{
System.out.println("engine null");
}*/
// Device device1=engine.getDeviceForRequest(httpServletRequest);
System.out.println("device Id :"+device.getId());
return "Ok";
}
}
PFB code and zip that we are using 1.8.3.1 evaluation version and getting runtime exception(wurfl.load()):
package com.rhan.adnw.controller;
import javax.servlet.http.HttpServletRequest;
import net.sourceforge.wurfl.core.WURFLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.multipart.MultipartFile;
import com.scientiamobile.wurfl.core.Device;
import com.scientiamobile.wurfl.core.GeneralWURFLEngine;
import com.scientiamobile.wurfl.core.WURFLEngine;
@RestController
@RequestMapping("/getWurflData/")
public class WurflEngineData {
//@Autowired private WURFLManager wurflManager;
@Autowired private WURFLEngine wurfl;
@RequestMapping(value = "wurfl.data", produces = "application/json",
method = RequestMethod.POST)
public @ResponseBody String wurflData(
HttpServletRequest httpServletRequest) {
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(httpServletRequest.getSession().getServletContext());
// GeneralWURFLEngine engine = (GeneralWURFLEngine) wac.getBean(WURFLEngine.class.getName());
// GeneralWURFLEngine engine = (GeneralWURFLEngine)wac.getBean("wurflEngine");
//Device device = (Device) engine.getDeviceForRequest(httpServletRequest);
String user_agent = "Mozilla/5.0 (Linux; Android 4.2.1; N9600 Build/JOP40D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Mobile Safari/537.36";
//System.out.println("wurfl object :"+wurfl);
wurfl.load();
System.out.println("wurfl load :");
Device device=wurfl.getDeviceForRequest(user_agent);
if(device==null)
{
System.out.println("device object null");
}
else
{
System.out.println("device object not null");
}
if(wac==null)
{
System.out.println("wac null");
}
else
{
System.out.println("wac not null"+wac);
}
// GeneralWURFLEngine engine = (GeneralWURFLEngine)AppContext.context.getBean("wurflEngine");
//GeneralWURFLEngine engine = (GeneralWURFLEngine) getServletContext(). getAttribute(GeneralWURFLEngine.class.getName());
////GeneralWURFLEngine engine = (GeneralWURFLEngine)wac.getBean("wurflEngine");
// GeneralWURFLEngine engine = new GeneralWURFLEngine("wurfl-ctx.xml");
/*GeneralWURFLEngine engine = (GeneralWURFLEngine) wac.getBean(WURFLEngine.class.getName());
if(engine==null)
{
System.out.println("engine null");
}*/
// Device device1=engine.getDeviceForRequest(httpServletRequest);
System.out.println("device Id :"+device.getId());
return "Ok";
}
}
Re: WURFL unexpected exception] with root cause
Thanks for the follow up Arti. Would you also happen to have a web.xml file available as well, and if so, could you also provide a sample of that? Also, the net.sourceforge.wurfl repository has been depreciated so you will want to remove `import net.sourceforge.wurfl.core.WURFLManager;`
Aaron
Aaron
-
- Posts: 5
- Joined: Fri Mar 10, 2017 1:41 am
Re: WURFL unexpected exception] with root cause
Hi ,
PFB web.xml and spring xml.
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>ad-network-api</display-name>
<!-- <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>-->
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>-->
<!-- <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param> -->
<!-- <listener>
<listener-class>
com.scientiamobile.wurfl.core.web.WURFLServletContextListener
</listener-class>
</listener> -->
<context-param>
<param-name>contextClass</param-name>
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
PFB web.xml and spring xml.
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>ad-network-api</display-name>
<!-- <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>-->
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>-->
<!-- <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param> -->
<!-- <listener>
<listener-class>
com.scientiamobile.wurfl.core.web.WURFLServletContextListener
</listener-class>
</listener> -->
<context-param>
<param-name>contextClass</param-name>
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
-
- Posts: 5
- Joined: Fri Mar 10, 2017 1:41 am
Re: WURFL unexpected exception] with root cause
Hi,
PFB spring xml.
rest-servlet.xml
<import resource="database/mysql-datasource.xml" />
<import resource="customer/app-customer.xml" />
<import resource="customer/cors.xml" />
<import resource="applicationContext.xml"/>
<!-- <bean id="com.scientiamobile.wurfl.core.WURFLEngine" class="com.scientiamobile.wurfl.core.GeneralWURFLEngine">
<constructor-arg index="0" value="classpath:/wurfl.zip" /> -->
<!-- <constructor-arg index="1" value="<< patch here >>"/> -->
<!-- <constructor-arg index="2" value="<< more patches here >>"/> -->
<!-- <property name="engineTarget" value="performance" /> -->
<!-- </bean> -->
</beans>
applicationContext.xml
<bean id="wurflEngine" class="com.scientiamobile.wurfl.core.GeneralWURFLEngine">
<constructor-arg index="0" value="classpath:/wurfl.zip" />
<!-- <constructor-arg index="1" value="<< patch here >>"/> -->
<!-- <constructor-arg index="2" value="<< more patches here >>"/> -->
<!-- <property name="engineTarget" value="performance" /> -->
</bean>
PFB spring xml.
rest-servlet.xml
<import resource="database/mysql-datasource.xml" />
<import resource="customer/app-customer.xml" />
<import resource="customer/cors.xml" />
<import resource="applicationContext.xml"/>
<!-- <bean id="com.scientiamobile.wurfl.core.WURFLEngine" class="com.scientiamobile.wurfl.core.GeneralWURFLEngine">
<constructor-arg index="0" value="classpath:/wurfl.zip" /> -->
<!-- <constructor-arg index="1" value="<< patch here >>"/> -->
<!-- <constructor-arg index="2" value="<< more patches here >>"/> -->
<!-- <property name="engineTarget" value="performance" /> -->
<!-- </bean> -->
</beans>
applicationContext.xml
<bean id="wurflEngine" class="com.scientiamobile.wurfl.core.GeneralWURFLEngine">
<constructor-arg index="0" value="classpath:/wurfl.zip" />
<!-- <constructor-arg index="1" value="<< patch here >>"/> -->
<!-- <constructor-arg index="2" value="<< more patches here >>"/> -->
<!-- <property name="engineTarget" value="performance" /> -->
</bean>
Re: WURFL unexpected exception] with root cause
Thanks Arti, we will take a look into the issue and will follow up with you as soon as we have an update.
Aaron
Aaron
Re: WURFL unexpected exception] with root cause
Arti,
It appears that your WURFL.zip file is either empty, corrupt, or a .zip not in .zip format. Are you able to try downloading the WURFL.zip file once more and run it through the API?
Thanks,
Aaron
It appears that your WURFL.zip file is either empty, corrupt, or a .zip not in .zip format. Are you able to try downloading the WURFL.zip file once more and run it through the API?
Thanks,
Aaron
Who is online
Users browsing this forum: No registered users and 4 guests