Your SAS programs, embedded in web apps and elsewhere

Execute stored process from Java application

Reply
N/A
Posts: 0

Execute stored process from Java application

Hi,

I try to implement the servlet as described in the article "http://support.sas.com/kb/26/054.html", but when I launch my Web application, I receive the following error message at the moment the servlet is being loaded:

5:12:14,959 INFO [TomcatDeployer] deploy, ctxPath=/imago-sasconnector-web-1.0.0, warUrl=file:/C:/jboss-4.0.3SP1/server/nice/tmp/eploy/tmp5589imago-sasconnector-web-1.0.0-exp.war/
5:12:15,428 INFO [STDOUT] loginConfig:/WEB-INF/login.config
5:12:15,428 INFO [STDOUT] sc.getRealPath(loginConfig) : C:\jboss-4.0.3SP1\server\NICE\.\tmp\deploy\tmp5589imago-sasconnector-web
1.0.0-exp.war\WEB-INF\login.config
5:12:15,428 INFO [STDOUT] metadataName : WEB-INF/server.properties
5:12:15,616 INFO [STDOUT] deploying...
5:12:16,319 INFO [STDOUT] Before deployServices.
5:12:18,475 ERROR [0]] Exception starting filter CharacterEncodingFilter
java.lang.ClassNotFoundException: com.sas.servlet.filters.CharacterEncodingFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:211)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:308)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:79)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3540)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4110)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5005)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:280)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:88)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:357)
at org.jboss.web.WebModule.startModule(WebModule.java:68)
at org.jboss.web.WebModule.startService(WebModule.java:46)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:428)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy12.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:400)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy13.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy7.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:428)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
at org.jboss.Main.boot(Main.java:187)
at org.jboss.Main$1.run(Main.java:438)
at java.lang.Thread.run(Thread.java:534)
5:12:18,819 ERROR [StandardContext] Error filterStart

The error occurs in the following method (of the class FoundationServicesContextListener.java)

public static void deployServices(String path, ServletContext sc) throws RemoteException
{
DiscoveryServiceInterface dsi = DiscoveryService.defaultInstance();



if (null != path)
{System.out.println("deploying...");
try
{
Properties props = new Properties();
InputStream is = sc.getResourceAsStream(path);
if (null != is)
{
props.load(is);
//DiscoveryServiceInterface ds = DiscoveryService.defaultInstance();
MetadataSourceInterface metadataSource = MetadataSourceFactory.newMetadataSource(props);
if (null != metadataSource)
{
System.out.println("Before deployServices.");
ServiceLoader.deployServices(metadataSource, dsi);

System.out.println("Deployed!" +dsi.toString());
}
}
else
{
sc.log("properties Not found at "+ path);
}
}
catch (InitializationException iex)
{
iex.printStackTrace();
}
catch (IOException ioex)
{
ioex.printStackTrace();
}
catch (ServiceException svex)
{
svex.printStackTrace();
}
}
}


Does anyone has experienced the same problem, or knows wich jar to include to prevent this "class not found exception"?

Many Thanks.

Kind regards,
Benny
SAS Super FREQ
Posts: 304

Re: Execute stored process from Java application

Posted in reply to deleted_user
Have you considered using the SAS Stored Process Web Application instead of writing your own Java code?

http://support.sas.com/documentation/cdl/en/stpug/61271/HTML/default/a003152808.htm

http://support.sas.com/documentation/cdl/en/stpug/61271/HTML/default/a003152812.htm

Vince DelGobbo
SAS R&D
N/A
Posts: 0

Re: Execute stored process from Java application

Posted in reply to Vince_SAS
Hi,

No, I didn't because I am trying to integrate the execution of the SAS Stored Process in an existing web application (an existing screen with a new link which will trigger the Stored Process).

Kind regards,
Benny
SAS Super FREQ
Posts: 304

Re: Execute stored process from Java application

Posted in reply to deleted_user
In the end, the execution of a stored process using the SAS Stored Process Web Application boils down to a URL something like this:

http://serverSmiley Tongueort/SASStoredProcess/do?_program=.

Sometimes people add an HTML link to their existing Web application with the URL shown above, and just let the WebApp do all of the work. Other times they use the built-in Java methods to make the HTTP call to the URL shown above (and thus execute the stored process), read the output stream, and do whatever they like with the output from the stored process. The latter works well if the stored process creates "streaming" HTML output without graphic images, XML, RTF, and PDF output.

If you really need to write more robust Java code to handle stored processes, you might find this information useful:

http://support.sas.com/kb/26/054.html

Note that the code shown in the sample will work with SAS 9.1.3, but not SAS 9.2, as the API has changed between SAS 9.1 and SAS 9.2.

With both SAS 9.1 and SAS 9.2 we ship some sample JSP files that illustrate how to execute a stored process. They can be found under the /SASStoredProcess/jsp/examples/ tree.

For SAS 9.1 running the Tomcat server on Windows, the path is typically:

\webapps\SASStoredProcess\jsp\examples

For SAS 9.2 running the JBoss server on Windows, the path is typically:

\server\SASServer1\deploy_sas\sas.storedprocess9.2.ear\sas.storedprocess.war\jsp\examples\

If you need further help, I suggest you open a track with our Technical Support department:

http://support.sas.com/ctx/supportform/index.jsp

Most of our users are able to use the SAS Stored Process Web Application to meet their needs. If it doesn’t work out for you, we would be interested in knowing the shortcomings, and hear suggestions on how we can fix them.

Vince DelGobbo
SAS R&D
Ask a Question
Discussion stats
  • 3 replies
  • 354 views
  • 0 likes
  • 2 in conversation