Jump to content
We've recently updated our Privacy Statement, available here ×

aphalke

Members
  • Posts

    23
  • Joined

  • Last visited

aphalke's Achievements

Explorer

Explorer (4/14)

  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. If you use the java.util.Date() i.e (new Date()) function in Expression to generate the HH:mm:ss then it won't calculate the exact hours and minutes and seconds. First of all Date function will accept the values in milliseconds, not in seconds, so even if you provide any value it reads as milliseconds and calculate the date-time. It is designed to calculate the date in the format "January 10, 2020, 00:00:00 GMT". in more detail than the method actually calculates the provided milliseconds from the date January 1, 1970, 00:00:00 GMT and gives it as an output. i.e If you pass the value as a new Date(624000) then the output is according to the calculated time from the timestamp January 1, 1970, 00:00:00 GMT. So, in this case, if you want to achieve and show the result as 173:20:00 for the input 624000 then you have to use the scriptlets, and using the java code you can achieve this. In the scriptlet use the below java method to calculate HH:mm:ss from the given time : ==================================================================================== int secondsLeft = timeInSeconds % 3600 % 60; int minutes = (int) Math.floor(timeInSeconds % 3600 / 60); int hours = (int) Math.floor(timeInSeconds / 3600); String HH = ((hours < 10) ? "0" : "") + hours; String MM = ((minutes < 10) ? "0" : "") + minutes; String SS = ((secondsLeft < 10) ? "0" : "") + secondsLeft; return ""+HH + ":" + MM + ":" + SS+"";[/code]==================================================================================== For more details on scriptlets, you can refer to below articles: https://community.jaspersoft.com/blog/scriptlet-example-jaspersoft-6x-begineers-hello-world-sample-example also, complete details are given here : https://community.jaspersoft.com/documentation/ireport-ultimate-guide
  2. JasperReports uses the Apache Commons Logging API for logging Logging can be enabled by including a logging implementation such as Log4j, and configuring it to enable debug logging for JasperReports classes E.g. if you have Log4j2 with an XML configuration file, you can use something like this Which would enable debug logging for all JasperReports classes Similarly, if you want to enable the logging for one specific class then add the logger name as shown below :
  3. To use the JNDI connection for subreport, you can use the following Expression : ((javax.sql.DataSource)(new javax.naming.InitialContext().lookup("java:comp/env/jdbc/foodmart"))).getConnection() Use the expression in the "Connection Expression" while passing to the subreport. You need to make sure you have added the JNDI connection details in the context.xml (<tomcat>/webapps/jasperserver-pro/META-INF/) and restarted the server to apply the changes.
  4. SQL Server allows for the installation of multiple database instances per server. A specific name identifies each instance. To connect to a named instance of SQL Server, you can specify the port number of the named instance (preferred), or you can specify the instance name as a JDBC URL property or a data source property. If no instance name or port number property is specified, a connection to the default instance is created. Note: When connecting to a specific instance on a SQL Server, you should use either the port number OR the instance name. Using both variables will cause a connection error, as the component will only accept one or the other. In addition to multiple SQL Server instances, you need to set one of the following properties: To use a port number, enter the following:jdbc:sqlserver://localhost:1433;integratedSecurity=true;<more properties as required> To use a JDBC URL property, enter the following:jdbc:sqlserver://localhost;instanceName=instance1;integratedSecurity=true;<more properties as required>
  5. Starting Talend CommandLine and executing a command, results in the following error message: java -Xms64m -Xmx1024m -Dfile.encoding=utf-8 -jar plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar --disableShellInput -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002!ENTRY org.talend.dataservice.commandline 4 0 2020-03-09 10:47:08.025!MESSAGE FrameworkEvent ERROR!STACK 0org.osgi.framework.BundleException: Could not resolve module: org.talend.dataservice.commandline [414]Unresolved requirement: Require-Bundle: org.talend.commandlineat org.eclipse.osgi.container.Module.start(Module.java:451)at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1783)[/code]Root Cause : The error log indicates that the CommandLine OSGi folder is corrupt "org.osgi.framework.BundleException: Could not resolve module: org.talend.dataservice" Solution:Perform one of the following workarounds to resolve this issue: Workaround 1Navigate to the CommandLine installation directory, cmdline_installation_dir}/studio/configuration/, and delete the org.eclipse.osgi, org.eclipse.update, and org.talend.configurator folders. Create a new workspace. Relaunch the CommandLine by pointing it to the new workspace, for example, -data Commandline-workspace-new. Workaround 2Verify that you are using a compatible Java version, and update it if necessary. Verify the JAVA_HOME and PATH variables are set correctly on the platform hosting the CommandLine.
  6. Issue: Errors were encountered when compiling report expressions class file: 1. com.jasper.scriptlet.test cannot be resolved to a type Solution: After adding the scriptlet to the report build path, you need to place the respective JAR files in the <tomcat>/webapps/jasperserver-pro/WEB-INF/lib folder.
  7. This can be achieved using "PrintWhen Expression" on the textField. where you can compare the Input Control value and decide to show/hide the column. For eg, you can write below expression in printwhen condition of textField $P{parameter} == 'Column1'[/code]So, if the value of a parameter is equal to Column1 then only the textField will be visible in the report. if you have two different columns and only one has to be visible then you need to place these two columns on top of each other and add printWhen condition respectively
  8. On starting JasperReport Server, if you are getting the below error java.io.StreamCorruptedException: invalid stream header: 162CBF9Ethen one of the possible reasons is .jslic file which is present in the user/home location is not updated with the new license file. To resolve the problem, you can delete the .jslic file and restart the application server.
  9. 1) Locate the "import-export.xml" file under your buildomaticbin directory. 2) Edit "import-export.xml" file: <run-import-export type="import" archive="${exportDir}/js-catalog-${dbType}-minimal-pro.zip" edition="pro" checkDBMSConnection="true">[/code]3) Change to: <run-import-export type="import" archive="${exportDir}/js-catalog-${dbType}-minimal-pro.zip" edition="pro" checkDBMSConnection="false">[/code]4) Save the change and run your "js-ant import-minimal-pro" script.
  10. Issue : Import failed: com.jaspersoft.jasperserver.export.service.ImportFailedException: Import failed. Reason: Internal error: Error while looking up data source (jdbc/foodmart) Resolution : Check if you have configured the jdbc/foodmart JNDI connection in your application server META-INF/context.xml file If not, please add the below JNDI connection details and restart the server to proceed. <Resource name="jdbc/foodmart" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="postgres" password="postgres" driverClassName="org.postgresql.Driver" accessToUnderlyingConnectionAllowed = "true" validationQuery="SELECT 1" testOnBorrow="true" url="jdbc:postgresql://localhost:5432/foodmart" factory="com.jaspersoft.jasperserver.tomcat.jndi.JSCommonsBasicDataSourceFactory"/>[/code]
  11. While creating a JSON data source, on test connection below error is received : GET https://myapplication.com HTTP/1.1 Additional informations: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target'. Resolution : The issue is because the trust certificates are not added into your studio root. To get the certificates you can follow the steps as below Open your web service URL in chrome: https://www.dev.workflow.aimplutus.azlifem.azl.pvtIf the website is loaded successfully, open the lock icon as shown below :Then click on certificates, which will open a certificate window. Then navigate to the Details tab in the window as shown below :Click on Copy to File and follow the Next till you get to enter file name option.Enter a file name(sitecetficate) and export it to your file system.Then import the certificate into your jaspersoft studio root using the following steps : 1. navigate to Jaspersoft Studio installation directory within a folder similar to featuresjre.win32.win32.x86_64.feature_1.7.0.u67jrebin and open command promt 2. Run the following command with the below arguments -importcert-alias <provide_an_alias>-file <certificate_file>-keystore <your_path_to_jre with the Jaspersoft Installation dir>/lib/security/cacerts keytool -importcert -alias tomcatTest -keystore "C:/Program Files/TIBCO/Jaspersoft Studio Professional-7.5.0/features/jre.win32.win32.x86_64.feature_1.8.0.u151/jre/lib/security/cacerts" -file "C:/Users/testuser/cert.pem" If prompted for a password enter "changeit", then accept it. Once you are done with all the above steps, restart the studio and test the JSON datasource connection.
  12. Please follow the steps as given below : 1. Add the below custom function in applicationContext-semanticLayer.xml in WEB-INF/ Find the id="postgreSQLGenerator" in the file and add below new entry <entry key="AddDelay"> <value>"Date(" + sqlArgs[0] + ") + INTERVAL '1 day' * "+ sqlArgs[1]</value> </entry>[/code] the key will be the function name. 2. Add below bean in WEB-INF/applicationContext-el-operators.xml Find the bean name with operatorDefinitionList and add it below in the bean : <bean parent="functionDef"> <property name="name" value="AddDelay"/> <property name="javaType" value="java.util.Date"/> <property name="argumentTypes"> <list> <value>#{ objectTypeMapper.checkType('Date') }</value> <value>#{ objectTypeMapper.checkType('Integer').optional() }</value> </list> </property> <property name="properties"> <map> <!-- show in calc field dialog --> <entry key="inAvailableFunctions" value="true"/> <!-- always run in SQL --> <entry key="alwaysInSQL" value="true"/> </map> </property> <property name="inMemory" value="false"/> </bean>[/code] Once you are done with the above steps, restart the server by clearing the tomcat/temp and tomcat/work folder. 3. Then you will get the AddDelay function in the list of functions in the ad-hoc view while creating a calculated field. e.x AddDelay("DateField","Delay") This will calculate the delay and display the date in return
  13. If you want to get all the reports and some other resources in the search view os jasperserver, you can follow the steps below : In this example we are going to create a filter that will show only Reports & Ad-hoc View in the search view by default : 1. Add following Entry into the <util:map id="proFilterOptionToResourceTypes"> bean, which is defined in applicationContext-search-pro.xml file <entry key="resourceTypeFilter-reports-adhoc"> <list> <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit</value> <value>com.jaspersoft.ji.adhoc.AdhocReportUnit</value> <value>com.jaspersoft.ji.adhoc.AdhocDataView</value> </list> </entry>[/code] 2. Add new bean as below <bean class="com.jaspersoft.jasperserver.search.common.Option"> <property name="id" value="resourceTypeFilter-reports-adhoc"/> <property name="labelId" value="SEARCH_TYPE_REPORT_ADHOC"/> <property name="roleAccessList" ref="${bean.resourceTypeFilter.All.RoleAccessList}"/> </bean>[/code] into the <util:list id="resourceTypeFilterOptionsPro">[/code]defined in applicationContext-search-pro.xml file 3. Add the below line SEARCH_TYPE_REPORT_ADHOC=Reports & Views[/code] in jasperserver_messages.properties file located under WEB-INF/bundles/ 4. As of now, we created a separate filter for reports and views. add the new filter resourceTypeFilter-reports-adhoc into the default filter defination in applicationContext-search.xml as below : <util:map id="defaultCustomFiltersMap"> <entry key="accessTypeFilter" value="accessTypeFilter-all"/> <entry key="timeFilter" value="timeFilter-anyTime"/> <entry key="scheduleFilter" value="scheduleFilter-anySchedule"/> <entry key="resourceTypeFilter" value="resourceTypeFilter-reports-adhoc"/> </util:map>[/code] Once adding all the details, save the files and restart the server.
  14. Issue : By default, the search view will display/list all the resources in the search view. To change it to show only reports by default please follow the below steps Resolution :Open file jasperserver-pro/WEB-INF/applicationContext-search.xml Change the <entry key="resourceTypeFilter" value="resourceTypeFilter-all"/>[/code]to <entry key="resourceTypeFilter" value="resourceTypeFilter-reports"/>[/code]in <util:map id="defaultCustomFiltersMap">[/code]bean. After making changes your beand will lool like below : <util:map id="defaultCustomFiltersMap"> <entry key="accessTypeFilter" value="accessTypeFilter-all"/> <entry key="timeFilter" value="timeFilter-anyTime"/> <entry key="scheduleFilter" value="scheduleFilter-anySchedule"/> <entry key="resourceTypeFilter" value="resourceTypeFilter-reports"/> </util:map>[/code]Save the changes, restart the application, and when you go the View->Search Result the default option on resource type will be Reports.
  15. If you are using token based authentication and would like to pass a token via HTTP header. Here is sample code in JRS 7.8.0: visualize({ auth: { token: token, preAuth: true, tokenName: "pp", loginFn: function(properties, request) { return request({ url: url, type: "get", headers: { pp: properties.token, Accept: "application/json" } }); } } }The method will fail with an error Access to XMLHttpRequest at 'https://myCustomApp/jasperserver-pro/' from origin 'https://localhost' has been blocked by CORS policy: Request header field pp is not allowed by Access-Control-Allow-Headers in preflight response. Since jasperserver 7.8.0 all the CORS policy are pre-defined in the WEB-INF/applicationContext-security-pro-web.xml as given below : <property name="allowedHeaders"> <list> <value>Cache-Control</value> <value>X-Suppress-Basic</value> <value>Origin</value> <value>Accept</value> <value>X-Requested-With</value> <value>Content-Type</value> <value>Pragma</value> <value>accept-timezone</value> <value>withCredentials</value> <value>X-Remote-Domain</value> <value>X-Is-Visualize</value> <value>x-jrs-base-url</value> <value>Content-Disposition</value> <value>Content-Description</value> </list> </property> To resolve the error you need to add your principalParameter name in above allowedHeaders list as <value>PP</value>. save the changes and restart the server.
×
×
  • Create New...