We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Words for Java License issue in UNIX environment

Hi,

I am currently experiencing an issue with the application finding the license. This occurs only when deploying the application (using Aspose.Words for Java) in a UNIX environment. When deploying it in a Windows environment it works fine. Can anyone help?

Thanks,

Andrew

-----------------------------------------

The below information comes from my lead developer:

Aspose license Issue analysis:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

As per the analysis the Aspose license is not getting set in the UNIX environment. The license is not having any issues in the Windows environment. I have attached the snapshots of Customer letter from the UNIX and Windows environment.Also, attached is the license file used. We have used the following steps as described in the Aspose website.

Aspose.Words for Java

The license can be loaded from a stream or file in the following locations:

1. Explicit path.

2. The folder that contains Aspose.Words jar.

Use the License.SetLicense method to license the component. The easiest way to set a license is to put the license file in the same folder as the Aspose.Words.DLL and specify just the file name without a path as shown in the following example:

Example LicenseFromFileNoPath

Initializes a license stored in a file or in an embedded resource.

[C#]

Aspose.Words.License license = new Aspose.Words.License();

license.SetLicense("Aspose.Words.lic");

[Visual Basic]

Dim license As Aspose.Words.License = New Aspose.Words.License()

license.SetLicense("Aspose.Words.lic")

[Java]

com.aspose.words.License license = new com.aspose.words.License();

license.setLicense("Aspose.Words.lic");

Example LicenseFromStream

Initializes a license from a stream.

[C#]

Aspose.Words.License license = new Aspose.Words.License();

license.SetLicense(myStream);

[Visual Basic]

Dim license As Aspose.Words.License = New Aspose.Words.License()

license.SetLicense(myStream)

[Java]

com.aspose.words.License license = new com.aspose.words.License();

license.setLicense(myStream);

Clarifications required in this regard will be as below

  1. Is the .lic file alone sufficient for UNIX platform or do we need to have any other file needed?

I have explained below the approach taken in application side to place the license file and to set it in the code.

  1. License file:

We have placed the license under the ${base directory}/license folder. The Aspose.Words.jdk15.jar is placed in ivy .The code of build script which copies the license file to /WEB-INF/lib is as below .Both the Aspose.Words.jdk15.jar and the Aspose.Words.lic file are in the /WEB-INF/lib folder of the deployed WAR file.

<copy todir="${lib.dir}" includeEmptyDirs="true">

<fileset dir="${license.dir}" includes="**/*.lic" />

  1. Code snippet used to set the Aspose license.

We can use one of the two approaches as explained below.

· Using a static block in a Aspose related class.

static

{

License license = new com.aspose.words.License();

try

{

license.setLicense ("Aspose.Words.lic");

}

catch (Exception e)

{

e.printStackTrace ();

}

}

· In the constructor of the Aspose related class.

public CustomerPackMailMergeDataSource(

List bookingDetailsList)

{

this.bookingDetailsList = bookingDetailsList;

mRecordIndex = -1;

License license = new com.aspose.words.License ();

try

{

license.setLicense ("Aspose.Words.lic");

//To be deleted: used to check for aspose license application

System.out.println ("LICENSE APPLIED");

}

catch (Exception e)

{

System.out.println (e.getStackTrace());

e.printStackTrace();

}

}

  1. CONSOLE OUTPUTS

· Console output of application in WINDOWS machine.

2009-11-20 18:49:14,161 com.tuiuk.plutoresort.logging.CallStackAspect INFO [http-8443-Processor23] - com.tuiuk.plutoresort.hotel.service.HotelAdministrationS

erviceImpl.getHotelReferenceData("0184156I217", "arrivalDate", Wed Aug 12 00:00:00 IST 2009) - EXIT

LICENSE APPLIED

2009-11-20 18:49:14,974 com.tuiuk.plutoresort.logging.CallStackAspect INFO [http-8443-Processor23] - com.tuiuk.plutoresort.booking.service.AsposeCustomerServi

cePackImpl.generateCustomerPack("arrivalDate", Wed Aug 12 00:00:00 IST 2009, [0184156I217, 0184156I217], 4369) - EXIT

· Console output of application in UNIX machine

2009-11-21 04:50:15,737 com.tuiuk.plutoresort.logging.CallStackAspect INFO [http-8445-Processor25] - com.tuiuk.plutoresort.hotel.service.HotelAdministrationServiceImpl.getHotelReferenceData("0184156I217", "arrivalDate", Wed Aug 12 00:00:00 GMT+05:00 2009) - EXIT

[Ljava.lang.StackTraceElement;@a42c89

java.lang.IllegalStateException: Cannot find license 'Aspose.Words.lic'.

at com.aspose.words.da.at(Unknown Source)

at com.aspose.words.da.as(Unknown Source)

at com.aspose.words.License.setLicense(Unknown Source)

at com.tuiuk.plutoresort.booking.print.CustomerPackMailMergeDataSource.(Unknown Source)

at com.tuiuk.plutoresort.booking.print.CustomerPackGenetratorImpl.generateCustomerPack(Unknown Source)

at com.tuiuk.plutoresort.booking.service.AsposeCustomerServicePackImpl.generateCustomerPack(Unknown Source)

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:585)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)

at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at $Proxy7.generateCustomerPack(Unknown Source)

at com.tuiuk.plutoresort.navigation.web.bookingsearch.action.GenerateCustomerpackAction.execute(Unknown Source)

at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at com.tuiuk.plutoresort.authentication.AbstractAfterLoginFilter.doFilter(Unknown Source)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.securechannel.ChannelProcessingFilter.doFilterHttp(ChannelProcessingFilter.java:116)

at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at com.tuiuk.plutoresort.authentication.https.FrontEndHttpsFilter.doFilter(Unknown Source)

at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:595)

2009-11-21 04:50:17,600 com.tuiuk.plutoresort.logging.CallStackAspect INFO [http-8445-Processor25] - com.tuiuk.plutoresort.booking.service.AsposeCustomerServicePackImpl.generateCustomerPack("arrivalDate", Wed Aug 12 00:00:00 GMT+05:00 2009, [0184156I217, 0184156I217], 4369) - EXIT

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request.

No, you do not need any additional files to apply the license on unix environment.

As I can see from stack trace you provided, Aspose.Words just cannot find the license file. Here is what you can try:

1. Make sure the license file is accessible.

2. Try reading the license file to stream and apply the license from stream.

3. Try setting the license from explicit path.

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.

Best regards.