org.xml.sax.SAXException: Invalid element in [...] - jboss

I'm dealing with this issue:
I generated the service stubs using Axis 1.4, with 1.4-redhat-1 as lib to the project.
I read a lot about this error and people said the issue was from the axis stubs generation itself, and the only solution was to regenerate stubs and recompile the projects that consumes them. The thing is: I made a test class in the and called the operation on eclipse using the "old" class without the new element and it works!
After that I copy/paste the test class to the main project that consumes the stubs, and it also worked.
But when I deploy the artifact to jBoss AS 5.1, I got the same "Invalid element" exception, so I'm guessing there's something "wrong" with the jBoss configs.
Does anyone have a tip where to start searching for the fix ? Thanks in advance.

Related

Prevent Eclipse (RAD) from generating code automaticly

I am working on a project, I have imported a jar file with the class files needed to connect to a web service, then added the wsdl to my project. The problem now is eclipse(rad) is generating java files, that I don't need and causing issues as the object already exist in the jar file. How to I prevent Eclipse(RAD) from auto generating java files from the wsdl, as I have wasted 2 days trying to force Eclipse(RAD) from generating these files, as they are unneeded and causing compile problems.
This is the solution I came up with. The issue is that it is not Maven causing this, this is Eclipse(RAD) my objects were in a package such as com.thispackage.servicename.v2 (upgrading from v1 to v2) but the name space in the wsdl was http://servicename.thispackage.com/v2 . as Mavin is not running the wsdl2java, there is no problem, I changed the name space to http://v2.servicename.thispackage.com When Eclipse compiles the wsdl2java fails as the objects already exist in a jar file (so it can not overwrite them) But Eclipse(RAD) will continue on with the compilation and deployment to local server. I just have to click OK to acknowledge the error but everything works as intended.
Not a great solution, and I will have to document it in the README.md (or find a real solution later) but this lets me do the real work I need to do, before I deal with this detail.

Running jersey 2 server using jetty 9

I have been struggling for many hours on trying to deploy a simple HelloWorld webservice written in java on a windows 7 (later ill need on linux) pc.
Most of the examples I found (from general places, and others questetions on stackoverflow) didn't work or used deprecated versions of jersey and other librarys.
My goal, is to write a webservice in java, where coding it should be easy and so does deploying it. It doesn't need to suuport anything special regarding the amount of request running and performance (my requirements are minimum)
Frommy research, I have come to believe the use of jersey with embeded netty web service should anser what I was looking for (if someone knows better, I would also like to hear about it, tough it isn't my main problem in this questetion but might just be an alternative solution)
I have came across this eaxmple:
jersey2-jetty-example
It gives you a working project with the dependencies needed from maven to run jersey and jetty embedded server (which can be run as a standalone jar which is exactly the kind of easy deploy im looking for)
I cloned the example and got everything running. I had problems importing it to eclipse, so I used the following command on the example folder:
mvn -DoutputDirectory=./lib dependency:copy-dependencies
which will give you a copy of the lib folder of the deps from maven needed,
then I created a java project with this lib folder in the build path and same source code as the sample, and all worked good.
The problem occurs when I try to take this java project and export it as an runnable jar (with the source files included option !).
I can then use java -jar to run the service, but when I try to access it from the browser (same as used in when I run it from eclipse), it never works, im always getting error 404 for the same routes that worked a second ago when running from eclipse. I couldn't figure out whats the source of the problem or what eclipse does differently that makes it behave in a different fashion.
I have found the reason the jar didn't work while in eclipse it did work, it was because of a duplicate jar that I was importing the caused the problem. The jars I got from maven in the git sample had 2 duplicate jars called hamcrest-all and hamcrest-core. removing one of them from the project build path fixed the problem.
If someone can answer the other open ended questetion that I asked, which is if using jersey and jetty like this is the best solution for my requirments I will be happy to hear about it

iReport "org/primefaces/model/UploadedFile" error in hibernate connection testing

I'm trying to make a hibernate connection to create some reports, but every time I press Test it appears an error window that says org/primefaces/model/UploadedFile, only that.
My classpath already has a jar of my project and the only place where I have the library from the error is inside an entity on the project.
If switch to another's project jar the connection is successful.
I'm using iReport 5.0.4 and Spring 2.9.1.
I'll appreciate any idea of what could be wrong, thanks in advance.
I couldn't figure out what was the problem, so I commented all references to the library and generated the jar that way.
I did it only because there's no related data to the things I commented.

Use a java class from a referenced project on the server-side?

I have a GWT project, and I want to use some classes server-side from another project:
MyServerProject
com.me.myserverproject.server.Horse
SomeSupportProject
com.me.somesupportproject.server.Animal
and MyServerProject Horse.java looks like:
class Horse extends Animal {
}
In eclipse, I have MyServerProject referencing the SomeSupportProject project. All compiles fine, and GWT Compile runs fine too, no errors.
When I deploy MyServerProject to a local instance, it immediately throws a NoClassDefFoundError error on "Animal.java":
java.lang.NoClassDefFoundError: com/me/somesupportproject/server/Animal
at java.lang.ClassLoader.defineClass1(Native Method)
I marked SomeSupportProject as exported in the eclipse project properties. But it seems like the class file for Animal.java is not getting exported upon deploy. Do we need to do something special here to get that to work?
I must be missing something really obvious since this is pretty basic stuff. I have clientside java files being referenced just fine, which I think is the trickier case. But these are all server-side classes, thought it would be simpler,
Thanks
------- Update: Project Setup ---------------
Some notes on my environment:
Using eclipse, and the two projects are side by side. I'm not using Ant or Maven. I have eclipse set to build automatically, so not getting any compiler errors there. To actually compile for a deploy, I tried right clicking "MyServerProject", choose Google -> GWT Compile. I set output to "all". I don't get any compile errors. The output does not mention any warnings.
After GWT Compile is complete, I right-click the project again, choose Run As -> Web Application. This is what throws the java.lang.NoClassDefFoundError for the class found in the SomeSupportProject project.
If there any specifics that would help just let me know.
--------- Final Update: Solved -----------------
After working on this some more, it seems we just can't add a project reference and get server-side classes to come across in the deployed top-level project. Instead, I linked to the "src" folder in SomeSupportProject. This allows things to still compile as normal, but when you deploy your project, all the classes are found without issue.
So this was really an app-engine issue, should have tagged it under there instead.
Thanks!
After working on this some more, it seems we just can't add a project reference and get server-side classes to come across in the deployed top-level project. Instead, I linked to the "src" folder in SomeSupportProject. This allows things to still compile as normal, but when you deploy your project, all the classes are found without issue.
So this was really an app-engine issue, should have tagged it under there instead.
Thanks!

Eclipse Axis2 WSDL2Java Exception: null

I'm trying to generate a Java Bean Skelleton from a WSDL (actually this will happen with Client generation as well).
So here are the Steps I did:
Rightclick on .wsdl -> WebServices -> Generate Java Bean Skelleton
Select Tomcat 7 and Axis 2
Click next (In this field the Parameters fields are Empty)
Click next, you will receive the following Error - Exception occurred during code generation for the WSDL : null
This Error seems to be thrown if you check out Projects with subversive (actually in the case of our project we see this correlation).
What could be done to fix this issue?
This issue is also an open bug since 2008, Axis2 BugTracker
The only Workarround I found for this, goes as follows:
Create a new DynamicWebProject
Create a new WSDL (You can copy you old one or what ever you like)
Create a new Java Bean Skelleton (or Client)
Now the WSDL2Java will work again for some time till it will be damaged again. You will be able to fix this by regenerate the Java Bean Skelleton. You won't need to create a new Project every time.
Edit:
The actual solution to this Problem was found now. I changed my SVN-Plugin from Subversive to Subclips. Now everything works out fine.