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.
Related
I recently tried to add the google tink library to eclipse and it always has a "com.google.protobuf.GeneratedMessageV3$ cannot be resolved" error, I normally never have any problems with adding libraries to my project, and from what I can tell it has something to do with the all key template files since the error only occours when I try to generate a new KeysetHandle with any key template, and the error only starts when i enter in the key template file# https://github.com/Gameidite/testProject
The Protobuf library can generate Java classes for you. You need to find where these .class files have been output to (eg there should be a GeneratedMessageV3$.class somewhere) and make sure that they are included on your classpath. There's presumably somewhere in Eclipse where you can configure where it looks for class files - you'll need to add the generated files there.
If the generated class files don't exist yet you need to figure out what to do to generate them. It might be easier to use Maven or Gradle as suggested in the Tink documentation rather than directly adding things to Eclipse.
I think it's probably because Eclipse cannot find the protobuf Java runtime. Have you tried adding Tink to your project with Maven or Gradle?
I am trying to access a JAX-WS 2.2 service from Tomcat6 with Java6. For what I have researched there is a problem with this, as Java tries to use first some of its default javax.xml.ws libraries which doesn't have the WebFault.messageName method. So it fails with this error:
GRAVE: javax.xml.ws.WebFault.messageName()Ljava/lang/String;
java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName()Ljava/lang/String;
at com.sun.xml.ws.model.RuntimeModeler.processExceptions(RuntimeModeler.java:1162)
...
The solution seems to be creating an "endorsed" directory in JAVA_HOME/jre/lib/ (or in TOMCAT_HOME) and putting there the required libraries.
However, some people say the library needed is webservices-api.jar, for example, here (#Issue 3):
https://www.fromdev.com/2010/01/trying-to-run-jax-ws-sample-application.html
And other people talk about jaxb-api-2.2.jar and jaxws-api.jar, for example here:
Grizzly - java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName
I have downloaded all three of them and placed them in both directories (inside JAVA_HOME and TOMCAT_HOME).
My problems:
· I have no issues accessing this service from a standalone java6 application, both from Netbeans or running the .jar from command-line, it fails only from Tomcat. So I am not sure if the stated above is the cause of my problems. Because, shouldn't it also fail from command line?
· I am not being able to test the above solutions, because Tomcat does not seem to know the "endorsed" directory. When I run this in the standalone application:
System.out.println(System.getProperty("java.endorsed.dirs"));
It prints:
/usr/lib/jvm/jdk1.6.0_45/jre/lib/endorsed
However, Tomcat prints a blank line.
I have tried to modify tomcat6.conf, with this (and restarting, of course):
JAVA_OPTS="-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory -Djava.awt.headless=true -Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m"
But it still doesn't seem to know that property.
So, how can I tell Tomcat where the endorsed directory is located? Do you think that my problem can be another than the stated, as it works from a standalone application?
So, the solution:
Do you think that my problem can be another than the stated, as it works from a standalone application?
No, that was exactly the problem.
how can I tell Tomcat where the endorsed directory is located?
It seems that setting this option in tomcat6.conf:
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
is not enough. It is required to create a variable called JAVA_ENDORSED_DIRS. So these two lines are needed in tomcat6.conf:
JAVA_ENDORSED_DIRS="/usr/share/tomcat6/endorsed"
JAVA_OPTS="-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS [-Djava....]"
Not really well documented issue, I think.
I am trying to build custom aggregate functions for presto. I have created a FAT Jar and deployed the jar into the plugin directory. When I restart presto, it is always giving me this error :
java.lang.AbstractMethodError
at com.facebook.presto.server.PluginManager.installPlugin(PluginManager.java:183)
at com.facebook.presto.server.PluginManager.loadPlugin(PluginManager.java:175)
at com.facebook.presto.server.PluginManager.loadPlugin(PluginManager.java:158)
Unfortunately, I do not see any verbose error message which will give me a clue on what is actually missing here. I used presto-ml plugin as an example and implemented getFunctions() in plugin implementation. Is there a way to figure out what is missing?
I did check the source code of PLuginManager.java. I am just looking for a way to debug this in a better way.
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.
I used old Eclipse (Helios) and old Tomcat (5.5) for a large web project. After updating to Tomcat 6, this code stopped working:
short foo = 3;
Integer bar = foo;
Apparently, this is invalid code according to the Java language specification[1], and there was a bug in the old Eclipse compiler so it didn't report it. New Eclipse (Kepler) reports it as an error.
I'm not quite sure why it stopped working with new Tomcat since it is using the same Java compiler as the old Tomcat, but the code is invalid and I want to fix it throughout the project.
First I tried validating the entire project in new Eclipse so it would list all .jsp files with this error. However, this validation in Eclipse doesn't seem to work very well since sometimes it detects several (existing) errors in a file and sometimes reports no errors in the same file (without changes, 10 seconds later).
Next thing I tried was to import project to NetBeans (7.4) and try to list those errors here. When I open a file with error, it detects it: "incompatible types: short cannot be converted to Integer". However, when I list all errors in the "Action Items" list, I can't find those errors (although I set the filter to include compiler errors).
I thought that listing all Java errors in all JSP files in a project would be easy, but turned out that it wasn't. How can I do it?
[1] Widening and boxing with java
The solution to this problem is to compile all JSP files in the project (i.e. generate Java files for them) and then inspect errors for generated files.
NetBeans has option to pre-compile all JSP files, but this didn't work for me because it stops after it hits first Java file with errors (maybe there is a way to circumvent this?).
Another solution might be to configure Apache Maven to build entire project, but I didn't try this, because a co-worker came up with a nice quick-n-dirty solution:
Generate a wget request for every JSP file in project and run all these requests. It doesn't matter that wget can't really access the pages since it isn't logged in, it just 'touches' them and forces the Tomcat to generate Java files.
Something like this (linux/cygwin):
find jsp -name '*.jsp' -printf 'http://localhost:8080/App/%p\n' > tmp/urls
wget -q --proxy=off --spider -i tmp/urls