Delete SUN_MICR.RSA, SUN_MICR.SF solves manifest signature file entry problem - securityexception

When I tried repacking all the jars into one jar, and run that one big jar, I got following exception
java.lang.SecurityException: no manifiest section for signature file entry javax/activation/MimeType.class
After googling I found a working solution at
http://www.coderanch.com/t/133070/Security/Jar-File-java-lang-SecurityException
The solution is delete SUN_MICR.RSA and SUN_MICR.SF files from the META-INF folder in the jar. It worked.
I tried to find out
how does this solution work?
. But did not find any answer.
So experts, please help me understand what goes on behind the scene.

Another workaround, which will allow the use of jar building applications without needing some other script, is the following:
•unzip activation.jar (it should be in your classpath since mail.jar needs it)
•open META_INF/MANIFEST.MF
•Copy paste all the lines that look like
Name: javax/activation/MimeTypeParseException.class
SHA1-Digest: uxV3qLHRu5JTOFrHnJXm13AO+0M=
into your program/jar's manifeqt.
Tada ! it works as expected.

Check, there must be another jar file having activation.jar, causing conflict.

Related

Can't build debug version Azure Function in Visual Studio

I'm trying Azure Functions for the first time and have been able to build and publish "Release" versions without any issue.
I want to step through the code and so need to create and publish a "Debug" version but when I try and build I get the following errors with the same code:
CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute
From researching this error the main suggestion has been to remove them from the AssemblyInfo.cs file but rebuilds just put them back in again and the "Release" version is happy with these settings being there.
What am I missing so I can create a "Debug" version of the code?
Thanks
According to your description about CS0579 Duplicate error ,I suppose some temporary *.cs files generated during compilation got accidentally added to the project. The files were from the obj\Debug directory, you could try to delete these files to solve problem. For more details, you could refer to this SO thread.
In my case, some temporary *.cs files generated during compilation got accidentally added to the project.
The files were from the obj\Debug directory, so they definitely shouldn't have been added to the solution. A *.cs wildcard went a little crazy and added them incorrectly.
If it doesn't work, there are also other solutions you could have a try. Such as right click project name>choose Edit FunctionName.csproj. Edit the csproj and turn the generation of the attributes causing the issues off. More solutions you could refer to this article.
Resolution
I found this issue on GitHub where there were a couple of options to resolve this issue which I am going to cover here plus a third option I tried not mention in the issue.
I have managed to now get the Debug to build by following one of Janley's link and adding 4 extra lines into the .csproj file:
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

Trying to compile libgdx to html, but it cant clear the assets

Having trouble compiling my libgdx project to html.
Looking at the log I think the problem is;
Copying resources from ../android/assets to war/
C:\TomsProjects\MeshExplorerV2\html\..\android\assets
C:\TomsProjects\MeshExplorerV2\html\assets
[ERROR] Generator 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundleGenerator' threw an exception while rebinding 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundle'
java.lang.RuntimeException: Couldn't clean target path 'war\assets'
Now it strikes me as slightly odd the second line; As there was no html\assets folder.
The assets folder was in html\war\assets, like the last line complains about.
However, after creating a empty assets folder in html, and manually deleting the contents of html\war\assets I still get the same error.
Theres also a "html\webapp" directory without any assets folder. Not sure if there should be one.
I have tried cleaning/rebuilding from eclipse, as well as randomly also trying Gradle>>Refresh All.
Additionally, the Java version runs just fine.
Any pointers, thanks :)
While not exactly reveling the route of the problem, I noticed it let me compile again as long as I restarted eclipse inbetween.
This infers some file-lock going on, possibly a server still running, allthough nothing but the gwt compile as triggered by me.
Still, restarting is a fine workaround for me as it only takes a minute or two.
ah
Pinned it down: Close your FTP program when compiling - at least CoreFTP was locking the directory. Closing it works every time now.
I had a similar issue where I was getting the following error
[ERROR] Generator 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundleGenerator' threw an exception while rebinding 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundle'
java.lang.RuntimeException: Couldn't clean target path 'war/assets'
All my files under the html/war/assets directory were read only, re-starting the IDE didn't help. To fix it I needed to change permissions chmod -R 777 html/war/assets (you probably dont need 777).

Msbuild running in Jenkins target calling HgPull fails with HgProcessException: The command <hg.exe> is not available

I am porting over an MSBuild script from CCnet to run in Jenkins. The MSBuild project is used to create a deployment package. I would rather have Jenkins drive this process itself but that's a longer term aim.
The problem i am having is (as in the title) when we try and use the HgPull target, from the MSBuild mecurial task (http://msbuildhg.codeplex.com/) we get the error message
HgProcessException: The command hg.exe is not available [Path to project]
I have seen on the project web site that someone solved it by adding the LibraryLocation proeprty to the target but that seems to have made no difference. My target currently looks like this:
Target Name="UpdateSources">
<HgPull
LibraryLocation="C:\Program Files\TortoiseHg\hg.exe"
Force="true"
Update="true"
LocalPath="$(SourcePath)"
/>
<HgUpdate
LibraryLocation="C:\Program Files\TortoiseHg\hg.exe"
Clean="true"
LocalPath="$(SourcePath)"
/>
I'm rather at a loss. Please let me know if you need any more information added to this post to solve this issue. I'm really quite new to MSBuild so really not sure where to start investigating this.
EDIT:
One thing i forgot to mention was that i have tried running the MSbuild command in a console window on the build server and still get the same result. This is really odd given it works fine in CCNet, what magic is CCNet doing to make this command work?
This is now resolved, unfortunately i'm not sure what changes i made to correct these. I believe it may have been down to path separators and whether they where trailing or not in another part of the config file. It does so annoy me with the lack of resilience/consistency between applications where you need to specify paths with/without trailing slashes.
Just a thought, but try adding 'C:\Program Files\TortoiseHg' to your system path. Maybe CCNet has it specified somewhere that Jenkins doesn't have access to.
Also, just for sanity's sake, verify that hg.exe actually exists at that location.

Intellij IDEA 11 Run Configuration Classpath Problems

I am using IDEA 11 and need to run a class with a main method but with additional classpath entries - both xml files and jars. I have tried adding them as Global Libraries, as additional source content roots, and as regular additional libraries, however none of these seem to pick up the xml files and so when I execute the run config I get FileNotFoundExceptions.
Please can anyone suggest something else as the printed classpath in the console never contains any of my custom definitions.
If I can't solve this I may have to resort to learning Eclipse just to get stuff done. This is making me a little crazy. I have tried all the suggestions I could find on SO but no luck so far.
Did you check the answers to the similar questions?
How load xml files, in IntelliJ IDEA
Intellij - how do I add a text file to the resources
Add a properties file to IntelliJ's classpath
Java - setting classpath
If it still doesn't work, please share a sample project via Dropbox.

FlashBuilder workspace update issues

When working on several AS3 projects that share a common code base, FlashBuilder seems to be losing workspace data when switching from one project to the next. I will often get a message that such class could not be found , when the class is actually in the path but was probably modified in the previous project.
To fix this error, I find myself having to remove the external library folder , restart FB, then re-add the library folder and all is well.
Please tell me there's another way to "refresh" FB's workspace ! Have you experienced anything similar? If yes, how do you avoid this problem?
Did you try a clean on the project?
project -> clean
You could also try to clean your workspace. In windows for example, just add -clean after the link to the exe.
Update:
on a mac, try this: http://www.brooksandrus.com/blog/2007/06/30/run-eclipse-from-the-command-line-on-os-x/