Getting Error from IBM Workilght Server [It is not a function, it is \"object\".] - worklight-adapters

Using IBM Worklight version 6.1.0.02-20160314-1430
Implemented AES at adapter with reference to below link.
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/server-side-development/javascript-adapters/using-java-adapters/
Its working fine as expected in Eclipse in my local server. Generated war file and same given deployment for server. From server when I am trying to accessing getting below error response.
Below things are crosschecked.
Collected war file from server, crosschecked for class file and its present in that
Restart of server is taken after war file deployment
I am unable to identify where the bug is.
Error response from Server :
{
"status": 200,
"invocationContext": null,
"errorCode": "PROCEDURE_ERROR",
"errorMsg": "Procedureinvocationerror.EcmaError: TypeError: Cannotcallpropertyencryptinobject[ JavaPackagecom.winjit.EncryptionDecryption ].Itisnotafunction, itis\"object\". (API_Adapter-impl.js#7)",
"invocationResult": {
"isSuccessful": false,
"warnings": [
],
"errors": [
"Ecma Error: TypeError: Cannot call property encrypt in object [JavaPackage com.winjit.EncryptionDecryption]. It is not a function, it is \"object\". (API_Adapter-impl.js#7)"
],
"responseID": "3161",
"info": [
]
}
}

Update your JDK to 1.8
Add two Security Policy JAR files at /jre/lib/security
local_policy.jar
US_export_policy.jar

This error due to because of JDK mismatch of development server (Eclipse) and Server(Web sphere). Server is running on JDK 1.6. I downgraded my Eclipse's Java Version. Steps as follows(on mac).
Eclipse -> Preferences -> Java -> Compiler
Select Compiler compliance lever -> 1.6
Eclipse -> Preferences -> Java ->Installed JREs
Add JDK 1.6 location (/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home)
Apply ok
Rebuild project (Restart server if necessary)
Give war file deployment to server which is re-generated bin folder
Its working for me now as expected

Related

error while reading extension file 'intellij_info_bundled.bzl'

we are trying to create a Scala project which uses Spark also but we are facing issue Encountered error while reading extension file 'intellij_info_bundled.bzl': no such package '#intellij_aspect//': No WORKSPACE file found in C:/users//_bazel_user/i45wuf6d/external/intellij_aspect. Is it has something missing in Intellij?
Scala file
package src.main.scala
object HelloWorld extends App {
def main(args: Array[String]) {
println("Hello, world!")
}
}
Build file
package(default_visibility = ["//visibility:public"])
load("#io_bazel_rules_scala//scala:scala.bzl", "scala_library", "scala_test")
scala_library(
name = "hello-world",
srcs = glob(["src/main/scala/*.scala"]),
)
scala_test(
name = "Hello_test",
srcs = glob(["src/main/scala/*.scala"]),
size = "small", # Expect this test to run quickly
)
Work Space
workspace(name = "scala_example")
rules_scala_version="7522c866450cf7810eda443e91ff44d2a2286ba1" # update this as needed
http_archive(
name = "io_bazel_rules_scala",
url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip"%rules_scala_version,
type = "zip",
strip_prefix= "rules_scala-%s" % rules_scala_version
)
load("#io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()`enter code here`
# register default scala toolchain
load("#io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()
Command and Error from console
Command: C:\ProgramData\chocolatey\bin\bazel.exe build --tool_tag=ijwb:IDEA:community --keep_going --curses=no --color=yes --experimental_ui=no --progress_in_terminal_title=no --aspects=#intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect --override_repository=intellij_aspect=C:\Users\ADMIN.IdeaIC2017.3\config\plugins\ijwb\aspect --output_groups=intellij-compile-java,intellij-compile-py -- //...:all
INFO: Loading complete. Analyzing...
ERROR: Encountered error while reading extension file 'intellij_info_bundled.bzl': no such package '#intellij_aspect//': No WORKSPACE file found in C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/external/intellij_aspect.
INFO: Found 3 targets...
WARNING: failed to create one or more convenience symlinks for prefix 'bazel-':
cannot create symbolic link bazel-out -> C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/execroot/scala_example/bazel-out: Cannot create junction (name=C:\users\admin\scalaprojects\example1\bazel-out, target=C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\admin\scalaprojects\example1\bazel-out, C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file.cc(128): CreateJunction(\?\C:\users\admin\scalaprojects\example1\bazel-out): Cannot create a file when that file already exists.
cannot create symbolic link bazel-out -> C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/execroot/scala_example/bazel-out: Cannot create junction (name=C:\users\admin\scalaprojects\example1\bazel-out, target=C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\admin\scalaprojects\example1\bazel-out, C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file.cc(128): CreateJunction(\?\C:\users\admin\scalaprojects\example1\bazel-out): Cannot create a file when that file already exists.
.
INFO: Building...
ERROR: command succeeded, but not all targets were analyzed.
INFO: Elapsed time: 18.108s, Critical Path: 0.05s
Make failed
This is a sample Helloworld program only
In general, like #Ittai, I would suggest you open an issue in the intellij plugin github repo.
Unfortunately, your version of the plugin is no longer supported. I, too, previously ran into an issue with an older version of the plugin and was recommended to upgrade to the latest version. Which resolved the specific issue I was facing.
When reporting the issue make sure to include the following bits of information:
intellij build number
plugin version number
rules_scala version
operating system (it seems your using Windows, while most users use unix based systems)
bazel release number
how you have opened the intellij project (BUILD file, WORKSPACE, .blazeproject)
Additionally, to verify this is in fact an issue with the plugin, I would also suggest you try to reproduce this issue on a Unix based system. It seems you are using Intellij
compile on Windows. This may be Windows specific issue with aspects not being recognized.
When attempting to reproduce, make sure to clone your repository in a separate directory, close the intellij project, and reopen the project

mvn archetype:create SHA-256 MessageDigest not available

This is my first time to try maven. My os in linuxmint.I have install maven successful.
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /home/gzx/danale/environment/apache-maven-3.3.9
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_111/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-53-generic", arch: "amd64", family: "unix"
But when I have used mvn archetype:create
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch03 -DartifactId=simple -DpackageName=org.sonatype.mavenbook
it showed a strange error.
[WARNING] Error injecting: org.sonatype.plexus.components.cipher.DefaultPlexusCipher
com.google.inject.ProvisionException: Unable to provision, see the following errors:Error injecting constructor, org.sonatype.plexus.components.cipher.PlexusCipherException: java.security.NoSuchAlgorithmException: SHA-256 MessageDigest not available
at org.sonatype.plexus.components.cipher.DefaultPlexusCipher.(Unknown Source)
while locating org.sonatype.plexus.components.cipher.DefaultPlexusCipher
It was so strange, how should I do?
I think maybe you have already figured your problem. But I got this bug yesterday and I fixed it today. I should write my solution down. Maybe someone will fall this trap.
Actually this problem is because Java cannot find the class "SHA-256 MessageDigest". But it is provided by JRE default. It should be found automatically.
If you access your JAVA_HOME, you may find a file whose name is jsse.pack in JAVA_HOME/jre/lib, and there is not a file named jsse.jar. That is the problem. Type
unpack200 jsse.pack jsse.jar
(unpack200 will be recognized as soon as you have set your Java path)
and the problem should be soloved.
Note:
Some JDK's have jsse.rar not jsse.pack, therefore, running "unpack200 jsse.rar jsse.jar" command will get the desired result, and will not delete the "jsse.rar" file (in case of *.pack files, they get replaced by the *.jar files).

Worklight 6.2 Consumer Edition : Error in deploying worklight applications and adapters

I have build my project through "build-all" Ant Task and I have deployed the war file using the "install" ant task. After Deployment through this I was getting "No Runtime Environment Found" message on the screen. But After removing following JNDI entries in "server.xml" file the browse button appear on the screen:
<jndiEntry jndiName="MyProject/publicWorkLightProtocol" value='http'/>
<jndiEntry jndiName="MyProject/publicWorkLightPort" value='9080'/>
<jndiEntry jndiName="MyProject/ibm.worklight.admin.environmentid" value='WL_UAT_Config1'/>
Following message is also coming above browse button : FWLSE0023E: application 'myProjecy' not found, please redeploy. [project MyProject]
Then I tried to deployed my adapter and application files and Server is giving following errors on console :
[ERROR ] FWLSE0228E: Failed to deploy the application deployable. Reason: null [project MyProject]
[ERROR ] Preparation to deploy 'myProject' failed
java.lang.NullPointerException
[ERROR ] Result: MyProject: WL_UAT_Server///1.2.3.4: ApplicationDeploymentException:java.lang.NullPointerException
[ERROR ] Preparation to deploy adapter '' failed.
Missing xml file
[ERROR ] Result: MyProject: WL_UAT_Server///1.2.3.4: RuntimeException:Missing xml file
However, If I use this "server.xml" file and deploy the war using "deploy-war" ant task. Everything just works fine. Also, if I deploy everything on server through eclipse everything works fine. Let me know if you guys need any more info over this.
The class loader of the project WAR file is not set to parent last
<application context-root="/MyProject" id="MyProject" location="MyProject.war" name="MyProject" type="war">
<classloader commonLibraryRef="worklight-6.2.0">
<privateLibrary>
<fileset dir="${wlp.user.dir}/shared/resources" includes="org.hsqldb.hsqldb_2.2.5.jar"/>
</privateLibrary>
</classloader>
</application>
It should -- see https://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.deploy.doc/admin/t_configuring_liberty_profile_manually.html
Ant tasks do install the hsqldb library, which is not listed in the supported software for Worklight http://www-01.ibm.com/support/docview.wss?uid=swg27024838 .... This file was probably crafted manually related to the Worklight Install part.

grails startup error when run-app

When I copied my old project from my old computer and typed grails run-app in project folder, I get the following error:
| Error Compilation error: startup failed:
G:\Windows NT 5.0 Workstation Profile\.grails\2.0.0\projects\timesheet\plugins\g
orm-labs-0.8.5\src\groovy\GormLabsHibernateCriteriaBuilder.groovy: 35: The retur
n type of java.lang.Object order(java.lang.String) in grails.orm.GormLabsHiberna
teCriteriaBuilder is incompatible with org.grails.datastore.mapping.query.api.Cr
iteria order(java.lang.String) in grails.orm.HibernateCriteriaBuilder
. At [35:5] # line 35, column 5.
Object order(String propertyName) {
^
1 error
Can anyone tell me what this relates to?
Thanks
You said you just copied the project, but you must have at least partially upgraded it since your error shows that you're using Grails 2.0.0. The error message has to do with the Gorm Labs plugin, which has been abandoned for over a year and is unlikely to be compatible with newer versions of Grails. I'd remove that and any usage of it and see where you get from there.

ftp task hangs with ant

I'm trying to pull out the file through ftp within ant, it get hung with after printing "getting files", so I enabled debug in ant and my output is
[root#LODIVM11SE001 net]# ant -d -f ftp_t.xml
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: ftp_t.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: /root/jdk1.6.0_10/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.5 compiled on June 2 2005
Setting ro project property: ant.file -> /Test_Framework/tasks/net/ftp_t.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /Test_Framework/tasks/net/ftp_t.xml with URI = file:///Test_Framework/tasks/net/ftp_t.xml
Setting ro project property: ant.project.name -> FTP simple interface - ftp.xml
Adding reference: FTP simple interface - ftp.xml
Setting ro project property: ant.file.FTP simple interface - ftp.xml -> /Test_Framework/tasks/net/ftp_t.xml
Project base dir set to: /Test_Framework/tasks/net
+Target:
+Target: ftpget
Setting project property: ftpServerName -> xxxxx
Setting project property: ftpUser -> xxxxx
Setting project property: ftpPassword -> xxxx
Setting project property: ftpRemoteDir -> /test
Setting project property: ftpRemoteFile -> ReadMe.txt
Setting project property: ftpLocalDir -> /local/test
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `ftpget' is [ftpget]
Complete build sequence is [ftpget, ]
ftpget:
[echo] FTP getting 'ReadMe.txt' from '/test' to '/local/test'
[ftp] Opening FTP connection to xxxxx
[ftp] connected
[ftp] logging in to FTP server
[ftp] login succeeded
[ftp] changing the remote directory
[ftp] getting files
Could not load a dependent class (com/sun/media/jai/codec/FileSeekableStream) for type image
Could not load a dependent class (com/jcraft/jsch/UserInfo) for type sshexec
Could not load a dependent class (com/jcraft/jsch/UserInfo) for type scp
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (junit/framework/Test) for type junit
fileset: Setup scanner in dir /local/test with patternSet{ includes: [ReadMe.txt] excludes: [] }
My code
<target name="ftpget" description="Get file over FTP">
<fail message="Build Abrted! Failed to find property:ftpRemoteFile" unless="ftpRemoteFile"/>
<fail message="Build Abrted! Failed to find property:ftpLocalDir" unless="ftpLocalDir"/>
<echo message="FTP getting '${ftpRemoteFile}' from '${ftpRemoteDir}' to '${ftpLocalDir}'"/>
<ftp action="get"
server="${ftpServerName}"
userid="${ftpUser}"
password="${ftpPassword}"
verbose="true"
remotedir="${ftpRemoteDir}"
skipFailedTransfers="true">
<fileset dir="${ftpLocalDir}">
<include name="${ftpRemoteFile}"/>
</fileset>
</ftp>
Note: Normal ftp is working fine. I'm using Linux 64bit, ant 1.6.5 and java 1.6.10
Looks like everything works fine until you actually try and retrieve the data. FTP uses two channels; one for control and one for data. This works out fine until a firewall denies the data connection. Passive mode attempts to work around this. Does your FTP library work have a 'passive mode', or 'PASV' option?
Ant FTP task has require dependencies, Libraries that must be on classpath for it to function properly. See link below,
http://ant.apache.org/manual/install.html#commons-net
To use the FTP task, you need jakarta-oro 2.0.8 or later, and commons-net

Resources