Hi all,
This is the code to export a service :
ESBAPI api = (new ESBAPIFactoryImpl()).createConfigAPI("Domain1", "tcp://localhost:2506", "Administrator", "Administrator");
String xmlString = api.getServiceConfigAPI().exportService( "LoanApproval");
When I run I've got this error :
javax.servlet.ServletException: com.sonicsw.xqimpl.config.XQConfigurationException: Failed to generate XML (sonicsw.home or com.sonicsw.xq.home is not defined) (sonicsw.home or com.sonicsw.xq.home is not defined)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:619)
root cause
com.sonicsw.esb.mgmtapi.ESBAPIException: com.sonicsw.xqimpl.config.XQConfigurationException: Failed to generate XML (sonicsw.home or com.sonicsw.xq.home is not defined) (sonicsw.home or com.sonicsw.xq.home is not defined)
at com.sonicsw.esb.mgmtapi.impl.ConfigBase.exportConfiguration(ConfigBase.java:523)
at com.sonicsw.esb.mgmtapi.config.impl.ServiceConfigAPI.exportService(ServiceConfigAPI.java:148)
at com.alcatel.struts.ESB.action.ContainerManagementAction.execute(ContainerManagementAction.java:100)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sonicsw.xqimpl.config.XQConfigurationException: Failed to generate XML (sonicsw.home or com.sonicsw.xq.home is not defined) (sonicsw.home or com.sonicsw.xq.home is not defined)
at com.sonicsw.xqimpl.config.XQConfiguration.serializeToXMLDocument(XQConfiguration.java:262)
at com.sonicsw.xqimpl.config.XQConfiguration.serializeToXML(XQConfiguration.java:214)
at com.sonicsw.esb.mgmtapi.impl.ConfigBase.exportConfiguration(ConfigBase.java:520)
... 45 more
Caused by: com.sonicsw.xqimpl.config.XQConfigurationException: sonicsw.home or com.sonicsw.xq.home is not defined
at com.sonicsw.xqimpl.config.XQConfiguration.buildSchemaLocation(XQConfiguration.java:415)
at com.sonicsw.xqimpl.config.XQConfiguration.serializeToXMLDocument(XQConfiguration.java:254)
... 47 more
Does anybody know what is wrong ?
Tkans,
Claudia
The issue is probably the fact that the export utility needs to get the location of the schemas that are used in the XML format for the exported files. If you look at /ESB7.6/bin you can find the esbadmin.bat. This shows an example of how this is set. The key lines are:
set COMMAND_JVM_ARGS=... -Dsonicsw.home="%SONIC_HOME%"
Basically you want to pass in an environment variable to the JVM for -Dsonicsw.home="C:\Sonic" (or com.sonicsw.xq.home="C:\Sonic\ESB7.6", but you really only need the first, as the second can be inferred.)
@echo off
setlocal
set XQ_HOME=C:\Sonic\ESB7.6
set SONIC_HOME=%XQ_HOME%\..
rem Setup up environment variables:
CALL "%XQ_HOME%\bin\setenv.bat"
rem The classes for SonicXQ
set COMMAND_LIB=%XQ_HOME%\lib\xq_config.jar;%SUPPORT_LIB%;%MGMT_LIB%;%SONIC_LIB%
rem Boot xerces first so that it doesn't get picked up in jvm's lib/ext
rem Also Set the initial context factory for the transient naming service.
set COMMAND_JVM_ARGS=-Xbootclasspath/p:"C:\Sonic\MQ7.6\lib\xercesImpl.jar;C:\Sonic\MQ7.6\lib\xmlParserAPIs.jar;%XQ_HOME%\lib\xbean.jar;%XQ_HOME%\lib\jsr173_api.jar" -Dsonicsw.home="%SONIC_HOME%" %SONIC_JVM_ARGS%
echo Starting commandline tool ...
"%JAVA_HOME%\bin\java.exe" %COMMAND_JVM_ARGS% -classpath "%COMMAND_LIB%" com.sonicsw.xqimpl.tools.admin.XQCommandLine