Removing package with Chef - java

Can you please tell me, is this possible to remove Java JDK package with Chef, with windows_package, or I have to execute command to silent uninstall? Much better would be the first option.
I've tried this way:
windows_package node['name']['JDK1.6'] do
action :remove
end
and even added option installer_type :custom, still got this error:
FATAL: Mixlib::ShellOut::ShellCommandFailed: windows_package[Java(TM) SE Development Kit 6 Update 35] (line 4) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0, 42, 127], but received '1603'
---- Begin output of MsiExec.exe /I{32A3A4F4-B792-11D6-A78A-00B0D0160350} /qn ----
STDOUT:
STDERR:
---- End output of MsiExec.exe /I{32A3A4F4-B792-11D6-A78A-00B0D0160350} /qn ----
Ran MsiExec.exe /I{32A3A4F4-B792-11D6-A78A-00B0D0160350} /qn returned 1603
Well, I am out of ideas. On official Opscode site I've found this information:
:remove: remove a package. The remove action is completely hit or miss as many application uninstallers do not support a full silent/quiet mode.
But as far as I know, JDK supports silent uninstall.
So - how should I do this in order to properly uninstall packages? Is this even possible?
Many thanks for every help.
Specification:
Chef 12.4.1
Windows 7
Java JDK in versions: 6u35, 7u79, 8u45
If you need additional information, feel free to ask.

Well, I've ended up with my own implementation. For those, who would need this, too:
# variable 'code' is for JDK version code from registry.
# Uninstall comand: MsiExec.exe /quiet /X[CODE]
# Codes are in regkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. Be aware to check key for JDK, not JRE!
remove_command = "MsiExec.exe /quiet /X#{code}"
execute "Remove JDK from system" do
command remove_command
returns [0,1605] # 1605 for non-existing product error
end
For example, for JDK 1.6.35 (mentioned in question) code should be
code = '{32A3A4F4-B792-11D6-A78A-00B0D0160350}'
So it seems like this is different command than used by Chef:
used by Chef
MsiExec.exe /I{32A3A4F4-B792-11D6-A78A-00B0D0160350} /qn
this command
MsiExec.exe /quiet /X{32A3A4F4-B792-11D6-A78A-00B0D0160350}
Maybe somebody will find this useful.

This looks like it might not be a chef problem as such. The uninstaller is hitting an error for some reason. Try googling for "java install error 1603" and you'll see a bunch of posts, including one that's apparently a bug that's currently under investigation https://www.java.com/en/download/help/error_1603.xml - though it sounds like that might be install not uninstall.
Try removing it manually and debug that, then once you understand it you can chef it.

I did something similar to your answer, but it only requires the package name rather than the code from the registry.
execute 'uninstall_jdk8u72' do
command "wmic product where name=\"#{node[:java8u72][:package_name]}\" call uninstall"
end
I got the idea from https://github.com/chef-cookbooks/windows/issues/89

Related

Build OpenJDK 9 in CentOS5

I was trying to build OpenJDK 9 in Centos 5. I used
sh ./configure --disable-warnings-as-errors
make all
I am getting the following error.
Building target 'all' in configuration 'linux-x86_64-normal-server-release'
/root/jdk9/build/linux-x86_64-normal-server-
release/support/native/java.base/libjava/io_util_md.o: In function
`handleSetLength':
/root/jdk9/jdk/src/java.base/unix/native/libjava/io_util_md.c:228:
undefined reference to `fallocate64'
collect2: ld returned 1 exit status
/usr/bin/objcopy: '/root/jdk9/build/linux-x86_64-normal-server-
release/support/modules_libs/java.base/libjava.so': No such file
gmake[3]: *** [/root/jdk9/build/linux-x86_64-normal-server-
release/support/modules_libs/java.base/libjava.so] Error 1
gmake[2]: *** [java.base-libs] Error 2
ERROR: Build failed for target 'all' in configuration 'linux-x86_64-normal-
server-release' (exit code 2)
=== Output from failing command(s) repeated here ===
* For target support_native_java.base_libjava_BUILD_LIBJAVA_link:
/root/jdk9/build/linux-x86_64-normal-server-
release/support/native/java.base/libjava/io_util_md.o: In function
`handleSetLength':
/root/jdk9/jdk/src/java.base/unix/native/libjava/io_util_md.c:228:
undefined reference to `fallocate64'
collect2: ld returned 1 exit status
* All command lines available in /root/jdk9/build/linux-x86_64-normal-
server-release/make-support/failure-logs.
=== End of repeated output ===
No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See common/doc/building.html#troubleshooting for assistance.
make[1]: *** [main] Error 2
make: *** [all] Error 2
I also tried other make targets such as make images and make install. But still getting the same error. My GCC version is gcc (GCC) 4.4.7 which I manually installed because Centos 5 by default has an older version.
Building JDK requires at least GCC 5.0 (see Building the JDK: CC).
This seems to be a problem in the glibc version (see redhat-issue, util-linux). So, updating your glibc to the latest version might solve it.
If you don't want to update your system's glibc, here is another alternative:
By looking at the man page of fallocate, we find that the description mentions that posix_fallocate(3) is a portable, POSIX.1-specified version of it, in case the mode parameter has the default value (0). The same applies to fallocate64.
Since all the occurrences of the aforementioned error already use the default mode value, you can replace them with posix_fallocate64() (instead of commenting them out as you mentioned in another comment).
The denoted man page says that:
This default behavior [of fallocate with mode=0] closely resembles the
behavior of the posix_fallocate(3) library function, and is intended
as a method of optimally implementing that function.

Gradle aapt error: syntax ")" not found on Android Studio 1.5.1 Linux

Unburden
First of all, I would like to unburden: Android Studio completely sucks and it is by far the worst big IDE I've used all my life long! I got stuck on errors just for opening that thing! And when I have hardly fixed one, seventeen new ones come rightly from the hell to my screen! I am (trying) to use that piece of [you know] for 4 days now, and till now I was not able to code one single line of code! What does an IDE is supposed to be useful for again?
-- Edit1: I just installed the full 1.4.1 version right now and first thing it showed me was: WizardException: Ignoring unknown package filter 'source-25' and others errors.
-- Edit2: I did a new FRESH Mint 18 install in a completely clean partition, installed only Java 7 (Oracle) and tried to run the AS-1.5.1 but... the same error on install and a subtle different log of error messages (please, see the log here) when gradleing.
The problem
Ok, the last problem (1.5.1) is that now I am trying to make gradle to build the "project" (it is just an empty activity created by the wizard, default code untouched) and I get this error:
~/AndroidStudioProjects/MyApplication $ gradle clean build --stacktrace
Incremental java compilation is an incubating feature.
:clean UP-TO-DATE
:app:clean
//...[other succesfull msgs here]...
:app:mergeDebugResourcesAAPT err(Facade for 16120822): /home/sidney/Android/Sdk/build-tools/25.0.0/aapt: 3: /home/sidney/Android/Sdk/build-tools/25.0.0/aapt: Syntax error: Unterminated quoted string
AAPT err(Facade for 22545775): /home/sidney/Android/Sdk/build-tools/25.0.0/aapt: 3: /home/sidney/Android/Sdk/build-tools/25.0.0/aapt: Syntax error: Unterminated quoted string
//...[other repeated errors here]...
Exception in thread "png-cruncher_8" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at /home/sidney/Android/Sdk/build-tools/25.0.0/aapt can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 60 seconds
at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:108)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:110)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
//...[other repeated errors here]...
--- UPDATE: Please, see this other log of the external terminal used to run AS ---
What I've tried to solve that:
Install aapt system-wide;
Switch from Java 8 to Java 7;
Change gradle to off-line;
Change JDK configs to switch from the AS one to the system one;
Set SLAVE_AAPT_TIMEOUT to 30 (I changed back as you can see in the log link)
Set ANDROID_EMULATOR_FORCE_32BIT to true;
Install via ubuntu-make and also via ppa;
And so many others things I could find over Internet.
Environment specs
Linux Mint 18 (32 bits)
AS 1.5.1 (now (trying to use) 2.1.0)
Java Oracle 8 (Already tried the 7)
Why don't I just switch to Eclipse with plug-in
I have a course in mind (in Udacity) and they use that "thing" and it is a prerequisite. I've sent 3 e-mails to them questioning about the possibility of use other IDEs but without answer after 4 days, unfortunately.
Thank you so much for any help!
That error looks like your build tools aren't properly installed/set up. The aapt distributed with the build tools is versioned/linked with the tools, so studio probably isn't going to grab the random system level one. Have you attempted to install them, or did the older Studio version fail to prompt you to do so?
Beyond that, I'm afraid that Studio 1.4 is very deprecated and was missing many, many fixes that are in the newer versions, so it's somewhat likely that you would run into random errors with that version :-( What errors were you encountering with 2.2.1? It would be easier for the Studio team to help address those versus anything you find in 1.4.
My solution? Buy a 64 bits laptop! No installation error, no gradle error, no java error, no error anymore.

JRuby 9.0.5.0 cannot load compiled ruby files

Our application is a RoR app, and currently uses JRuby version 1.7.22, and JRE 8_65. Our app is an on-prem solution, so we use JRuby to host our application on JVM at the target, Windows Server 2012 R2 system. We compile our ruby code, using
jruby -S jrubyc
This takes the .rb file and compiles it to a .class file. In the original .rb, it loads in the class file, like so.
load __FILE__.sub(/\.rb$/, ".class")
This all works with JRuby 1.7.22
Now, we want to update JRuby to 9.0.5.0, but are experiencing some problems when it comes to deploying our application. Basically, that line of code above inside of the .rb file is not working anymore, and we get the error when trying to run a rake db:setup
rake aborted!
LoadError: C:/appname/app/models/app_attribute.class is not compiled Ruby; use java_import to load normal classes
C:/appname/app/models/app_attribute.rb:1:in `<top>'
C:/appname/db/seeds.rb:10:in `<top>'
C:/appname/db/seeds.rb:9:in `block in (root)'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Great. So I replace load with java_import
rake aborted!
ArgumentError: not a valid Java identifier: C:/appname/app/models/app_attribute.class
uri:classloader:/jruby/java/core_ext/object.rb:43:in `block in java_import'
uri:classloader:/jruby/java/core_ext/object.rb:34:in `java_import'
C:/appname/app/models/app_attribute.rb:1:in `<top>'
C:/appname/db/seeds.rb:10:in `<top>'
C:/appname/db/seeds.rb:9:in `block in (root)'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Still not working, no matter what I try. I looked at this post: https://github.com/jruby/jruby/issues/3018
I tried to pass the parameter
jruby -Xaot.loadClasses=true
But I get a warning saying that aot.LoadClasses is not recognized. EVEN THOUGH I see it in the properties when I type
jruby -Xproperties
I have done A LOT of research on this, and have probably have looked at everything on the internet regarding this. Any input will be greatly appreciated. Is there something I missing? I am not fully adept in Java.
Thank you.
might be the same issue as https://github.com/jruby/jruby/issues/3651
which means you'll need to wait for 9.1 or use a snapshot http://ci.jruby.org/
since, the error is slightly different you should look into reproducing with snapshot and if it fails (might be Windows related) a step-by-step reproduction might speed-up getting the issue resolved.
jruby -Xaot.loadClasses=true
this is not needed with Warbler
But I get a warning saying that aot.LoadClasses is not recognized. EVEN THOUGH I see it in the properties when I type
hmm, could you reproduce this with an empty script and no JRUBY_OPTS ?
I have done A LOT of research on this, and have probably have looked at everything on the internet regarding this. Any input will be greatly appreciated.
you might want to try looking into the issue next time :) or considering getting some support
Is there something I missing? I am not fully adept in Java.
you shouldn't be missing anything - its not a Java issue ...

Java error while running maxent in biomod2

I am running maxent from R, in the package biomod2 and the following error appeared. I do not come from a technical background and wasn't sure why is this error happening. Is it a memory problem or someone said the java path is not set. But I followed the instructions to set maxent to run in R and also downloaded Java Platform, Standard Edition Development Kit and set a path for it as explained in this pdf: http://modata.ceoe.udel.edu/dev/dhaulsee/class_rcode/r_pkgmanuals/MAXENT4R_directions.pdf
I would be really grateful if you could help me understand this problem and any solution to it.
Thanks a lot
Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: running command 'java' had status 1
2: running command 'java -mx512m -jar E:\bioclim_2.5min\model/maxent.jar environmentallayers
="rainfed/models/1432733200/m_47203134/Back_swd.csv"
samplesfile="rainfed/models/1432733200/m_47203134/Sp_swd.csv"
projectionlayers="rainfed/models/1432733200/m_47203134/Predictions/Pred_swd.csv"
outputdirectory="rainfed/models/1432733200/rainfed_PA1_Full_MAXENT_outputs"
outputformat=logistic redoifexists visible=FALSE linear=TRUE quadratic=TRUE
product=TRUE threshold=TRUE hinge=TRUE lq2lqptthreshold=80 l2lqthreshold=10
hingethreshold=15 beta_threshold=-1 beta_categorical=-1 beta_lqp=-1
beta_hinge=-1 defaultprevalence=0.5 autorun nowarnings notooltips
noaddsamplestobackground' had status 1
3: In file(file, "rt") :
cannot open file 'rainfed/models/1432733200/rainfed_PA1_Full_MAXENT_outputs/rainfed_PA1_
Full_Pred_swd.csv': No such file or directory
I've just manage to solve this problem - it is a problem with the file path specified. For me, I had a space in one of the folder names which was not accepted in the path to the maxent.jar file. From looking at your error, it looks like it might be the two backslashes.
E:\bioclim_2.5min\model/maxent.jar
should probably read
E:/bioclim_2.5min/model/maxent.jar

Hibernate fails with NullPointerException in EntityTuplizerFactory.constructTuplizer? Why?

I have a problem when I try to instantiate Hibernate and connect with a MySQL database (see error message below).
Curiously enough the connection works fine using the exact same hibernate.cfg.xml file when running Junit tests but it refuses to work when run from Tomcat...
I am starting to run out of ideas.
Any clues or tip where to look?
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.DynamicMapEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.(EntityEntityModeToTuplizerMapping.java:69)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:323)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:456)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:131)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:267)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at se.fmt.atlantism.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:16)
... 38 more
Caused by: java.lang.NullPointerException
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)
... 47 more
I'm writing this for future Googlers and reference.
I've done some more research and the root source of the problem is still not known. However the following article throw me on the right track.
http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/
It seems like the Tomcat (version 6 at least) packages available in Ubuntu (and Debian) are not working correctly. Instead I installed Tomcat using the following guide:
http://www.ctrip.ufl.edu/tomcat6-debian-lenny-howto
While this might not be the premium choice of installation it seems necessary to get Tomcat version 6 running without problems on Ubuntu and/or Debian Lenny.
In my case, this error was resolved by switching the <dependency/> order in my pom.xml. When hibernate (3.2.7.ga) comes before hibernate-annotations (3.4.0.GA) this error occurs. The other way around, it works fine. This is the case even with scope=compile.
I would guess that you need to tweak your classpath, except that (assuming you've dropped both jars in WEB-INF/lib) it should alpha-sort in the correct order. But maybe this will give someone a hint on how to move forward.
In my case it was a simple mistake - the config file *.hbm.xml had a property that the mapped object didnt have! I also heard of cases of that error apearing when you misspell a get/set function - very similar to my case.
I was facing the same problem. It went away after I downloaded "javassist.jar" and put it in the classpath: http://www.java2s.com/Code/Jar/JKL/Downloadjavassistjar.htm
This is how the Tomcat daemon process looks:
root 2605 0.0 0.0 16584 376 ? Ss 15:39 0:00
/usr/bin/jsvc -user tomcat6
-cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar
-outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid
-Djava.awt.headless=true -Xmx128M
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
-Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6
-Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager
-Djava.security.policy=/var/lib/tomcat6/work/catalina.policy
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties
org.apache.catalina.startup.Bootstrap
This is how the Tomcat process looks when run from within Eclipse using the Sysdeo Tomcat launcher plugin:
(this one actually works)
jzaruba 2655 19.7 4.5 358304 46152 ? Sl 15:43 0:01
/usr/lib/jvm/java-6-sun-1.6.0.15/bin/java
-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:37377
-Dcatalina.home=/usr/share/tomcat6
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
-Dcatalina.base=/var/lib/tomcat6 -Djava.io.tmpdir=/var/lib/tomcat6/temp
-Dfile.encoding=UTF-8 -classpath
/usr/share/tomcat6/bin/bootstrap.jar:/usr/lib/jvm/java-6-sun-1.6.0.15/lib/tools.jar
org.apache.catalina.startup.Bootstrap start
The working one (Eclipse launched) is run using java-6-sun-1.6.0.15, I'm Windows user so I don't know how to tell which JRE is used for /usr/lib/jsvc (looking at it though), but my guess would be it is some OpenJDK... Could this be the difference?
update: jsvc probably uses the same JRE Sysdeo Tomcat launcher does

Categories

Resources