Business Objects 'bcm.jar' error when exporting Java app - java

I have been working on creating a simple Java desktop app using the RESTful API for Business Objects and have run into an issue. Whenever I run my app in Eclipse in works fine; whenever I export it as a 'Runnable Jar' and select the Library handling option 'Package required libraries into generated JAR' it works fine. However, whenever I try to export it using the Library handling option 'Extract required libraries into generated JAR' I get the following error after running the app:
java.lang.NoClassDefFoundError: Could not initialize class com.businessobjects.bcm.BCM
I have the 'bcm.jar' file added under a 'res' Source Folder and have it added to the Build Path. At one point I added all the JARs under the 'SAP BusinessObjects' java folder, and external folder, but it still throws the error. The problem stems from this line of code:
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, password, CMS, auth);
Would anyone know why I am getting said error? I really want to use the Extract option as it will improve performance as my app becomes larger. Any help resolving this issue would be greatly appreciated :)
EDIT: I would be happy to provide clarification or further detail upon request!

Seems this was introduced in SP04 and SAP has no intent of fixing it as the RESTful API wasn't designed to be used with Desktop apps.

Have you included the cryptojFIPS.jar? Leaving it out can cause the error.

Related

Recompiling and running a decompiled MCP minecraft client throws a noSuchMethod error

So in the past days i've decompiled minecraft 1.12.2 using mcp to make an "own" client. I ran it from eclipse and all was working just fine. But once i exported it, added the needed JSON file and started it from the minecraft launcher, it resulted the following error:
Exception in thread "Client thread" java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V
at net.minecraft.client.Minecraft.<init>(Minecraft.java:420)
at net.minecraft.client.main.Main.main(Main.java:115)
In my opinion that'a a bit strange, because when I ran it from eclipse that error did NOT occur.
I was thinking about adding the logger in the specific JSON file for the version but I do not know how to do it. I took the JSON file from a video where I expected my problem to be solved, made some changes, but it didn't. I also put the folder containing the logger-jar (org.apache....) in the client jar, but still no success.
Also i just decompiled 1.12.2 and recompiled it right away to see if i had messed up my code some how.
I hope someone can help.
This means at runtime you have a class that is different than what you had at compile time. You should try unzipping the jar and searching for the class file. It sounds like you need to potentially remove it and replace it with your own version.
Thanks to all who viewed an wanted to help!
Now I found an other way to use it. I wanted to export it to test
it on my server. But instead I used my account credentials to log in directly from eclipse.
:)

Using JRuby in Android Studio

I'm trying to use JRuby in projects created in Android studio. I have built the latest (as of 9/10/2014) JRuby, and have completely updated Android Studio. I have a working app that I can use to test. I have a copy of jruby.jar in the MyApp/app/libs directory. Once there I right-clicked on jruby.jar and selected "Add as Library", which presumably did something (though what I am not certain), and have added the line "compile files('libs/jruby.jar')" to the build.gradle that is in MyApp/app/.
In one of the class files I have "import org.jruby.embed.ScriptingContainer;", which Android Studio says is fine (if I hadn't added jruby.jar as a library I couldn't include this without an error). Then in one of the working methods I say "ScriptingContainer container = new ScriptingContainer();". When I run this method the app will crash. I won't try to include the whole error message, but the important part seems to be:
Caused by: java.lang.ExceptionInInitializerError
at org.jruby.embed.internal.AbstractLocalContextProvider.<init>(AbstractLocalContextProvider.java:42)
at org.jruby.embed.internal.SingletonLocalContextProvider.<init>(SingletonLocalContextProvider.java:88)
at org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:248)
at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:228)
at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:185)
and
Caused by: java.lang.RuntimeException: unsupported Java version: 0.9
at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1858)
at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1608)
At least, those are the parts that make sense to me. I hav no idea why I would get the error "java.lang.RuntimeException: unsupported Java version: 0.9", since I am using 1.8.0_20. The rest of the errors I cannot follow. When I click on any of the files giving me an error (say AbstractLocalContextProvider.java:42) Android Studio will show the file but also say "Sources not found". That could be the problem, but I don't know why it can't find the sources.
Thanks for any help,
Brian
Uwe Kubosch (‏#donv70) was able to tell me the solution to this via Twitter, so credit to him, but I wanted to post the solution here in case anyone else needs it.
It was Java version that was causing the problem. In Ruboto the problem is solved here: https://github.com/ruboto/ruboto/blob/master/assets/src/org/ruboto/JRubyAdapter.java#L137
and for use in Android Studio it is necessary only to include the line: System.setProperty("jruby.bytecode.version", "1.6");
The number of course can be 1.6, 1.7, or 1.8, depending on your version of Java.
Looks like an interoperability problem between JRuby and the Dalvik VM (don't forget that you're running against Dalvik, not the Java VM).
There's a bug report at http://jira.codehaus.org/browse/JRUBY-5774 that may lead you in the right direction.
It's kind of old, and is marked 'fixed', but maybe it'll provide some clues?

How to compile MVC3 (razor ) Views including Some java files in Web Project

I want to compile views in my ASP.Net MVC3(razor) Project.
I have used this technique
Compile Views in ASP.NET MVC
Its working fine but problem is that when i do this, an error starts showing:
"The CodeDom provider type "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located."
When i dig more i found that this error occur when some java files included into project.
I have a printers plugin which is made on java(some .jar and other java related file). When i remove these files, everything starts working fine.
But problem is that, I cant remove these java files from my project because these have an important role in my application.
Is there any way that i can compile my Views with including java file into my project?
Any suggestion would be highly appreciated.

org.apache.axiom.om.util.AXIOMUtil cannot be resolved

I'm trying to generate some stubs for a WSDL (using xmlbeans) and keep running into some issues. I'm using the following page:
http://axis.apache.org/axis2/java/core/docs/userguide-creatingclients-xmlbeans.html
The only part of these steps that I'm skipping is the "client.java" part because I already have another project ready I want to plug the resulting jars into. A quick run down of my steps are as follows:
My WSDL is a crmonline instance, so I run something like this:
C:\Work\aaa2>WSDL2Java -uri
https://mycrmorgname.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl
-p crmsdk -d xmlbeans -s -o c:\mystubfolder
I build the project using "ant"
In my "client" project I reference the 2 jars created in .\build\lib
My project builds fine once I add all my axis2 / apache references etc, but when I launch it through playframework I get errors when I hit the first page. The first error seems to be:
17:48:45,289 ERROR ~ Error in ControllersEnhancer.
controllers.ProfileController.editProfile has not been properly enhanced
(fieldAccess javassist.expr.FieldAccess#212ca458).
or something similar to that. Scrolling down through the error I can see that I'm getting this:
The file /app/models/MyDynamicsClient.java could not be compiled.
Error raised is : org.apache.axiom.om.util.AXIOMUtil cannot be resolved
Now, I haven't even hit any of my web services yet, or even instantiated any of my classes ... I'm at a loss as to why this is happening. Or to be more accurate, what exactly am I messing up! Am I missing a reference to something? Doing a search on AXIOMUtil tells me this should be in Axiom-api (version I have is Axiom-api-1.2.10.jar). I have this referenced and doesn't seem to help. Or maybe I'm doing something else wrong someplace?
Some details on versions:
Axis2 1.5.4
Apache-ant 1.8.3
Any help would be very much appreciated!!
Ok, after trying a lot of different things and rereading the sites/instructions I realised what I was doing wrong. Or at least I figured out a couple of things that I started to do differently that fixed the problem.
Firstly, I was using jar files from another sample project for the apache http components. I don't know if this had an impact, but I downloaded a fresh version of this anyway and referenced those JARS instead.
Also, instead of creating jars in my "stub" project and referencing those I copied all the generated stubs/classes directly into the existing client project. I have a feeling this might have been what fixed my problem. Or maybe a mix of this and the previous step I did!
So my new steps are as follows:
Ensure you have all the correct versions downloaded for required components. In my case I have the following:
Apache Axis 2 v 1.5.4
Apache HTTP components client 4.1.3
Apache-ant 1.8.3
Copy all the JARS from the Axis2 and HTTP Components libs into your client project and reference them.
Use WSDL2Java to create your stubs and classes within it's own project.
Ensure the project builds using Ant
Copy all the generated class files within the src folder into the source folder of your client.
Fix any other reference isssues and Build
Thankfully this got me going.

Netbeans Error: "Could not add one or more tag libraries"

I am using Netbeans 6.1 and Tomcat 6.0.1.6.
I made some very minor changes to a project that had been working and now I am getting the following error:
com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: Could not add one or more tag libraries.
The only change I made was to a backing bean method, no new UI components, jsp, etc.
Any direction would be greatly appreciated.
Thanks!
I get the idea that Netbeans regenerated/updated the web.xml or sun-web.xml files in your project. Perhaps someone made some changes to one of those files that were overridden when Netbeans updates those files.
To prove it, revert your changes and see if the error still occurs. If so, backup those files, make your code changes, rebuild or whatever and then copy those backed up files over the Netbeans modified files and build.

Categories