I am working in a Desktop application that provides Online Backup of data. In my application i am trying to implement automatic software update feature. For this i am using java web start. I have done the following process for using java web start.
1> created jar with all resources.
2> created jnlp file as :
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+"
codebase="http://cmswebusa.com/kapil"
href="PixelVaultJNLP.jnlp">
<information>
<title>PixelVault</title>
<vendor>globussoft</vendor>
</information>
<resources>
<!-- Application Resources -->
<jar href="PixelVault.jar" main="true" />
</resources>
<application-desc
name="PixelVault"
main-class="com.pixelvault.systemtray.SysTray">
</application-desc>
<update check="background"/>
</jnlp>
where PixelVault.jar is jar of the application which is on http server location.
while i am trying to download my application using command prompt run option by typing :
javaws , i am getting AWT Permission Exception as:
java.security.AccessControlException: access denied "java.awt.AWTPermission"
it says "java.awt.AWTPermissionException""accessSystemTray". I am not getting how can i allow my application to use system tray.
Please guide to make changes in jnlp file or making any other change in my application.
I thanks to your all valuable suggestions that will help me to solve this problem.
To get rid of that error:
The JNLP will need to declare all-permissions within a security element.
The code will need to be digitally signed.
Note that the JNLP file has elements out of the correct order. Use JaNeLA to check the validity of the file as well as other aspects of the launch.
Related
I am a complete beginner in Jmeter and facing error 443 while performing android app Load testing in Jmeter(5.4.1). I have followed all required steps to connect jmeter to mobile apk.
Without knowing what "all required steps" you "have followed" we cannot provide any comprehensive input.
"All required steps" are:
Start JMeter's HTTP(S) Test Script Recorder
Locate ApacheJMeterTemporaryRootCA.crt and install it onto Android device
If you're running Android 7.0 or higher:
In the application section of your application manifest add the following attribute
android:networkSecurityConfig="#xml/network_security_config
Add the following file to your application resources folder
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
Re-build your application in debug mode by invoking gradlew assembleDebug command
Install the debug version of the .apk onto your Android device
You should be able to record now, if still not - check out jmeter.log file and Android device log
More information: Recording Using Android Devices
As the title already states JNLP cnnections are deprecated. Jenkins also gives a message and a hyperlink to
https://en.wikipedia.org/wiki/Java_Web_Start#Deprecation.
So what's the recommended way to attach a Windows agent to Jenkins now? There seems to be no real good guide on https://jenkins.io covering that topic.
There are two options: Either use an open source alternative for Java Web Start or use the Jenkins service wrapper instead. The latter gives you the most control.
Open Source Alternative to Java Web Start
There is an open source replacement called OpenWebStart which is based on IcedTeaWeb.
More information: Java Web Start is dead - long live OpenWebStart!
OpenWebStart is an open source implementation of the WebStart and JNLP
standards (JSR-56).
[...]
In IcedTeaWeb we are currently working on mapping the JNLP spec and
supporting its functions to the greatest extent possible. In addition
to OpenWebStart, which uses IcedTeaWeb as its core, IcedTeaWeb is also
used within AdoptOpenJDK to provide minimal WebStart in the Java 8
releases of AdoptOpenJDK. However, these are limited compared to
OpenWebStart because they can only use the current JVM to run
JNLP-based applications.
Using the Jenkins Service Wrapper
When installing Jenkins service through the service wrapper (winsw-*.exe), Java Web Start is no longer required. It seems that JNLP protocol is still used behind the scenes, so it may still have some deprecation issue in the future.
Official installation guide
Steps (assuming you have already set up the node in Jenkins master):
Download latest service wrapper from http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/ (e. g. "winsw-2.2.0-net4.exe")
Place it in the Custom WorkDir path and rename it to "jenkins-agent.exe"
Download "agent.jar": http://YourJenkinsServer:8080/jnlpJars/agent.jar
Place it in the Custom WorkDir path and rename it to "agent.jar"
Create "jenkins-agent.xml" in the same directory:
<service>
<id>YourJenkinsAgentServiceId</id>
<name>Your Jenkins Agent Service Name</name>
<description>This service runs an agent for Jenkins automation server.</description>
<executable>C:\Program Files\Java\bin\java.exe</executable>
<arguments>-Xrs -jar "%BASE%\agent.jar" -jnlpUrl http://YourJenkinsServer:8080/manage/computer/YourNodeName/jenkins-agent.jnlp -secret YourSecretStringConsistingOfHexadecimalCharacters -workDir=C:\YourNodeWorkDir</arguments>
<logmode>rotate</logmode>
<onfailure action="restart" />
<download from="http://YourJenkinsServer:8080/jnlpJars/agent.jar" to="%BASE%\agent.jar"/>
<extensions>
<extension enabled="true" className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension" id="killOnStartup">
<pidfile>%BASE%\jenkins_agent.pid</pidfile>
<stopTimeout>5000</stopTimeout>
<stopParentFirst>false</stopParentFirst>
</extension>
</extensions>
</service>
Adjust "jenkins-agent.xml" according to your environment. The java.exe should be the same version as used by Jenkins. Make sure to adjust all strings I prefixed with "Your" and also the path to "java.exe". You'll find the secret string and correct jnlpUrl on the node configuration page of Jenkins master (e. g. http://YourJenkinsServer:8080/manage/computer/YourNodeName/).
Official documentation
Create "jenkins-agent.exe.conf" file to prevent the executable from running on an earlier version of the .NET Framework.
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Launch "cmd.exe" as administrator and navigate to directory of "jenkins-agent.exe".
Install the service: jenkins-agent.exe install
Launch the service: sc start YourJenkinsAgentServiceId
Notes:
For simplicity I have used http protocol only. When the connection is working, I recommend to switch to https for improved security.
If you are using a self-signed certificate on the Jenkins server (typically in a LAN), you have to install the certificate on the agent into the Java certificate store (as the Windows certificate store is ignored by Java). This can be done using Java's keytool (more information).
How can I install Root CA Certificate, i.e. an Apache jmeter TemporaryRootCA created in Jmeter bin in Mobile for Android (Native) application? How can I Install that package in Mobile for recording purposes (Script Recorder)?
When you start JMeter's HTTP(S) Test Script Recorder JMeter generates ApacheJMeterTemporaryRootCA.crt in its "bin" folder. The easiest way to get it installed onto Android device is:
Send the certificate to yourself by email from the desktop computer as an attachment
Open the email on the Android device
Click the certificate in the attachment and follow Android instructions to install it
Remember that the certificate has limited life time (it is valid for 7 days) so ensure that it is up-to-date while recording.
See How do I install a user certificate? thread for more details.
Alternative solution would be using a cloud-based proxy service which automates certificate installation process. Moreover you will be able to export recorded requests in "SmartJMX" mode with automatic correlation of the dynamic parameters.
First use JMeter Recording Template
Then start JMeter's HTTP(S) Test Script Recorder, it will generate in jmeter/bin folder, a file called ApacheJMeterTemporaryRootCA.crt .
Copy file to your android device and install it as CA Certificate.
See How do I install a user certificate? thread for more details.
The certificate has limited life time (defaults to 7 days) but you can extend it by setting in user.properties
proxy.cert.validity=Number of days
Now the problem you'll face in Android >= 7.0 is that applications only use by default System installed Certificates.
So you'll need to ask developper of application to modify the APK, see why here.
Edit manifest and add :
android:networkSecurityConfig="#xml/network_security_config"
You'll get:
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
<application android:networkSecurityConfig="#xml/network_security_config"
... >
...
</application>
</manifest>
Then add in res/xml/network_security_config.xml this:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<!-- Trust preinstalled CAs -->
<certificates src="system" />
<!-- Additionally trust user added CAs -->
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
Note that this is needed whatever tool you use (Neoload, LoadRunner, ...)
For full details you can read:
https://www.ubik-ingenierie.com/blog/how-to-record-android-application-using-https-traffic-jmeter/
I'm trying to deploy a web app via tomcat manager by only specifying the context file, as described in the tomcat 7 documentation at http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_from_a_Local_Path.
I'm issuing the following call to the manager http://myhost.mydomain.com:8080/manager/text/deploy?config=file:/opt/company/product/conf/mycontext.xml
The context file looks like the following :
<!DOCTYPE project>
<Context path="/myapp" docBase="/opt/company/product/lib/myapp.war" antiResourceLocking="false" >
</Context>
And the manager indicates an error : FAIL - Invalid context path null was specified.
Now I can deploy the app if I use the call that also provides the deployment url (path). However I would expect Tomcat to read my context file and determine by itself the path from the file definition.
Is this an issue in the tomcat 7 manager and is there a way of bypassing this ?
Thanks for any pointers
As far as I can tell this is a bug with Tomcat (see comment from #devlearn).
To work around this limitation, I ended up relying on the Tomcat restart to do the initial deployment. Once Tomcat is aware of the application, then I can redeploy at will by stopping the application context, deleting the folder in webapps and manually unzipping the WAR file into a new folder that replaces the one I deleted. Ansible does all this work - I can revert back to using the Tomcat API when this bug is fixed.
I am trying to remotely deploy a war file to a websphere application server. I understand this is possible to do using wsadmin, but I am a Websphere newb.
I know I can run wsadmin and connect using SOAP to the remote app server, but that is where I am at.
This seems like it should be a common use case, can anyone help me with?
I suppose the use case follows:
1. Update the application
2. Save all changes
3. Restart the remote application server
I am going to do the deployment using either Hudson WAS Builder or Maven, whichever works.
Thanks for your help
This question is pretty old, but id like to show how we do this remotly. In this case with Ant
<target name="postbuild">
<exec executable="C:\MyThinClient\wsadmin.bat" failonerror="true">
<arg line="-conntype SOAP -host ${deployServer} -port ${deployPort} -user ${deployUser} -password ${deployPassword} -c" />
<arg value="$AdminApp update ${projectName}EAR app {-operation update -contents {${artifactsDir}/${projectName}-${buildVersion}.ear}}" />
</exec>
</target>
Given the correct setup of the wsadmin.bat you can run this from any server (without WAS installed) At least on WAS 6.1/7.0 ND this will only restart the application with the new binaries, not the whole server
Since the WAS Builder Plugin is relatively new, I haven't tested it (The evaluation is already on the ToDo list). For running deployments from the command line we use jython-scripts and wsadmin. My understanding is that I need to be on the machine where I want to deploy. You can deploy to a different machine id your local wsadmin is on the level than your target machine (same version and same feature packs).
for more information on wsadmin see http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/rxml_commandline.html
BTW, when you deploy using the web based admin console, there is a link somewhere at the end of the deployment process that shows you the jython command. Don't use jacl, since WAS 7 only uses jython.
The link to the scripts didn't show up right in my comment, so here it is: IBM SAMPLE SCRIPTS