java 7 update 45 webstart applications are not receiving properties - java-web-start

I have an application which use webstart where the properties are passed on as . But since i upgraded my jre to update 45, its no longer working. It was working fine with update 40. I donot see anything in the revision history which might have broken this.
When i searched on http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html, i can see that i might have to start the property name with "javaws." or "jnlp.". I have a large number of properties (~50). Is this the only way in which i can make it work? (If yes, its a bit strange that the revision history donot mention this). Is this is way in which properties are being handled in javaws?

As suggested here you will either have to prefix the properties with jnlp or javaws, or you need to sign the jnlp (place an exact copy of your jnlp named APPLICATION.JNLP in the JNLP-INF directory of the jar that contains the main class, before signing the jar)

Faced the same issue while upgrading our application from java 1.6 to 1.8
Solution is:
add jnlp as a prefix to the property name passed in the jnlp template
property name="dev.env" value="DEV" change to property name="jnlp.dev.env" value="DEV"
Get system properties in the main method of the Main class passed in the jnlp template.
If original property parameter in code was dev.env then just get the Jnlp properties and set it to the older one
String devProps= System.getProperty("jnlp.dev.env");
System.setProperty("dev.env",devProps);

Related

how to disclude development.conf from docker image creation of play framework application artifact

Using scala playframework 2.5,
I build the app into a jar using sbt plugin PlayScala,
And then build and pushes a docker image out of it using sbt plugin DockerPlugin
Residing in the source code repository conf/development.conf (same where application.conf is).
The last line in application.conf says include development which means that in case development.conf exists, the entries inside of it will override some of the entries in application.conf in such way that provides all default values necessary for making the application runnable locally right out of the box after the source was cloned from source control with zero extra configuration. This technique allows every new developer to slip right in a working application without wasting time on configuration.
The only missing piece to make that architectural design complete is finding a way to exclude development.conf from the final runtime of the app - otherwise this overrides leak into production runtime and obviously the application fails to run.
That can be achieved in various different ways.
One way could be to some how inject logic into the build task (provided as part of the sbt pluging PlayScala I assume) to exclude the file from the jar artifact.
Other way could be injecting logic into the docker image creation process. this logic could manually delete development.conf from the existing jar prior to executing it (assuming that's possible)
If you ever implemented one of the ideas offered,
or maybe some different architectural approach that gives the same "works out of the box" feature, please be kind enough to share :)
I usually have the inverse logic:
I use the application.conf file (that Play uses by default) with all the things needed to run locally. I then have a production.conf file that starts by including the application.conf, and then overrides the necessary stuff.
for deploying to production (or staging) I specify the production/staging.conf file to be used
This is how I solved it eventually.
conf/application.conf is production ready configuration, it contains placeholders for environment variables whom values will be injected in runtime by k8s given the service's deployment.yaml file.
right next to it, conf/development.conf - its first line is include application.conf and the rest of it are overrides which will make the application run out of the box right after git clone by a simple sbt run
What makes the above work, is the addition of the following to build.sbt :
PlayKeys.devSettings := Seq(
"config.resource" -> "development.conf"
)
Works like a charm :)
This can be done via the mappings config key of sbt-native-packager:
mappings in Universal ~= (_.filterNot(_._1.name == "development.conf"))
See here.

WildFly 8.2, after every change in html file I need to perform full publish to see the changes, why?

After every change in HTML(XHTML) page of a web project, either it is JSF or a simple WAR I need to perform a Full Publish to see the changes. After some googling I found the solution to change in Management Console - Publishing settings to Automatically publishing when resources change and set publishing interval to 0, but it doesns't help. What can I do more to resolve this issue?
I'm using WildFly 8.2 on Mac Maverick.
Thank you in advance.
you can deploy exploded war file instead of war archive. Only make sure that folder name has .war in its name e.g myApp.war.
After that you can configure wildfly deployment-scanner to auto deploy exploded content. This can be done in your config file e.g. standalone.xml.
See https://docs.jboss.org/author/display/WFLY8/Deployment+Scanner+configuration
Config example:
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" auto-deploy-zipped="true" auto-deploy-exploded="true"/>
Had the same problem. In standalone.xml i added the attribute
auto-deploy-exploded="true"
and the problem started. After removing the attribute it returned to the same behaviour as before.
There was a bug in JBoss 7 which was about processing this attribute not properly (or at all) but its status is resolved and it should work now. Obviously it doesn't or i am doing something wrong.
After setting auto-deploy-exploded="true" I was't able to deploy application. Deployment copies stuff in "deployment" and then scanner triggers and starts another deployment of the same app witch results in error

Passing RAILS_ENV into Torquebox without using a Deployment Descriptor

I am wondering if there is a way to pass a value for RAILS_ENV directly into the Torquebox server without going through a deployment descriptor; similar to how I can pass properties into Java with the -D option.
I have been wrestling with various deployment issues with Torquebox over the past couple weeks. I think a large part of the problem has to do with packaging the gems into the Knob file, which is the most practical way for managing them on a Window environment. I have tried archive deployment and expanded deployment; with and without external deployment descriptor.
With an external deployment descriptor, I found the packaged Gem dependencies were not properly deployed and I received errors about missing dependencies.
When expanded, I had to fudge around a lot with the dependencies and what got included in the Knob, but eventually I got it to deploy. However, certain files in the expanded Knob were marked as failed (possible duplicate dependencies?), but they did not affect the overall deployment. The problem was when the server restarted, deployment would fail the second time mentioning it could not redeploy one of the previously failed files.
The only one I have found to work consistently for me is archive without external deployment descriptor. However, I still need a way to tell the application in which environment it is running. I have different Torquebox instances for each environment and they only run the one application, so it would be fairly reasonable to configure this at the server level.
Any assistance in this matter would be greatly appreciated. Thank you very much!
The solution I finally came to was to pass in RAILS_ENV as a Java property to the Torquebox server and then to set ENV['RAILS_ENV'] to this value in the Rails boot.rb initializer.
Step 1: Set Java Property
First, you will need to set a Rails Environment java property for your Torquebox server. To keep with standard Java conventions, I called this rails.env.
Dependent on your platform and configuration, this change will need to be made in one of the following scripts:
Using JBoss Windows Service Wrapper: service.bat
Standalone environment: standalone.conf.bat (Windows) or standalone.conf (Unix)
Domain environment:: domain.conf.bat (Windows) or domain.conf (Unix)
Add the following line to the appropriate file above to set this Java property:
set JAVA_OPTS=%JAVA_OPTS% -Drails.env=staging
The -D option is used for setting Java system properties.
Step 2: Set ENV['RAILS_ENV'] based on Java Property
We want to set the RAILS_ENV as early as possible, since it is used by a lot of Rails initialization logic. Our first opportunity to inject application logic into the Rails Initialization Process is boot.rb.
See: http://guides.rubyonrails.org/initialization.html#config-boot-rb
The following line should be added to the top of boot.rb:
# boot.rb (top of the file)
ENV['RAILS_ENV'] = ENV_JAVA['rails.env'] if defined?(ENV_JAVA) && ENV_JAVA['rails.env']
This needs to be the first thing in the file, so Bundler can make intelligent decisions about the environment.
As you can see above, a seldom mentioned feature of JRuby is that it conveniently exposes all Java system properties via the ENV_JAVA global map (mirroring the ENV ruby map), so we can use it to access our Java system property.
We check that ENV_JAVA is defined (i.e. JRuby is being used), since we support multiple deployment environments.
I force the rails.env property to be used when present, as it appears that *RAILS_ENV* already has a default value at this point.

The Web server is configured to not list the contents of this directory

Using Visual Studio 2012:
I created an "ASP.NET Empty Web Application" (using C#).
I used NuGet to install the FubuMVC package.
When I run the application (using IIS Express), I get the "Welcome to FubuMVC!" page which tells me to delete the FubuMVC.GettingStarted.dll file and to set the home page.
So I do both of those things, implementing a HomeController that simply returns "Hello World" from Index.
Rather than the expected "Hello World", I get an IIS error: The Web server is configured to not list the contents of this directory.
What have I done wrong?
try this
cmd => don't forget to run as administrator
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
Just tried reproducing your problem with a brand new project; it turns out that problem is that the instructions in the example haven't kept up with the changes in FubuMVC.
The instructions tell you to create a class called 'MyHomeController' and add the Index() method to it. This used to work, because one of the default rules for routes was to use any class with a name that ends in 'Controller'.
But the default has been changed in more recent versions, and the rule now looks for classes ending in 'EndPoint'.
So if you change the name of the class from 'MyHomeController' to 'MyHomeEndpoint', it should work.
Also, remember that the application pool needs to restart for the new configuration to take effect, so you might have to touch your web.config (or force IISExpress to restart).
Did you activate FubuMVC in your Global.asax? I usually see that error when there is no FubuMVC application.
So in Application_Start() (or whatever it's really called), you'll need something like:
FubuApplication.DefaultPolicies().StructureMap(new Container()).Bootstrap();
Where you're telling it:
1.) What are the policies/conventions to use
2.) What's your IoC container
Usually if I run into this it's because I've got a conflict with a route and a folder in the project. For example, I might have a folder called 'Unit' and inside it I have a class called 'UnitEndpoint' with a method 'get_unit' (which should map to '/unit' as a route, assuming I'm using the FubuMVC defaults).
In that case, browsing to '/unit' will result in this error because IIS thinks I'm trying to list the contents of the 'Unit' folder. Renaming the endpoint or the folder to remove the conflict will fix it (e.g., renaming the 'Unit' folder to 'Units').
I suggest that you recompile your application or at least touch your global.asax -- looks like you need to rerun the App_Start method.

Is it possible to change P4TICKET within P4Eclipse?

I installed Eclipse Juno recently and after it I installed the p4Eclipse 4.2 plugin from this repository:
http://www.perforce.com/downloads/http/p4-eclipse/install/4.2
Then I tried to create a new perforce connection.I entered the name of server and username and password. But I got an error message when clicking on next:
com.perforce.p4java.exception.ConfigException: java.io.FileNotFoundException: \p4tickets.txt (Access is denied)
Reading the P4Eclipse help I understood that because I didn't define the user environment variable P4TICKETS the P4Eclipse tried to define it by itself. On the help has mentioned that if the value is not explicitly is set it will be defined for windows as %USERPROFILE%\p4tickets.txt
and for all other platforms as
$HOME/.p4tickets
It seems that P4Eclipse has configured for other platforms and therefore it tried to find the file somewhere which it was not allowed. When I defined the User Environment variable P4TICKETS with the value %USERPROFILE%\p4tickets.txt it worked. The problem is that we have many clients and I don't want to define an environment variable for all of them. So I wonder if there is a set to configure P4Eclipse for Windows platform or define the P4TICKETS within eclipse and not with an environment variable!
Yes, I think you can go to the advanced configuration for the plugin and set P4TICKETS. In the release notes they describe this method for setting P4HOST:
470897 (Bug #042451)
Support for P4HOST variable. To set P4HOST variable,
either set the environment variable P4HOST (For example,
export P4HOST=123.456.789.0) or in the the preference page,
Preference>Team>Perforce>Advanced, set P4HOST properties,
(For example, name: P4HOST value: 123.456.789.0). Then
restart Eclipse to make it affect.
I'm not 100% sure that will work but you can give it a try.