I am deploying a WAR into a Tomcat 6 or Tomcat 7 server on a Windows 2003 Server box. The error looks something like
java.lang.Exception: Error initializing iSec web service proxy: Unable to create JAXBContext for generated packages: "com.integrity_apps" doesnt contain ObjectFactory.class or jaxb.index.
which I was getting previously when tools.jar was not in the classpath of my application. I was running the grails app from STS with the default web container, and I was able to fix this by re-installing JUST the JDK with tools.jar in the lib dir, and making sure JAVA_HOME was set correctly.
I have tried the same steps on the server - only installing the JDK, making sure JAVA_HOME is pointing to it, and dropping my WAR in the Tomcat container. I am still getting the error. Can anyone suggest why this may be happening?
As a further datapoint, I have noticed that if, on the server, I run the Tomcat7.exe from the command prompt directly (JAVA_HOME is set as a system variable), the error goes away. If I run it from the service manager, the error comes back.
Thanks
Looks like "com.integrity_apps" is your package containing your JAXB bean classes? I think it's missing ObjectFactory class within the package.
Check if there is a package called "com.integrity_apps" and if there is a class named ObjectFactory in that package. If not you may want to add it or use other ways to let JAXBContext know how to create your JAXB beans. This question on SO may be helpful:
Do you always need an ObjectFactory class when using JAXB?
Related
I am unable to find another article that solves my problem but am happy to hear about one if you know the answer.
I have a RESTful service built in Java with Eclipse. It uses Spring and all of its bells and whistles.
After much work with configuration files, I am able to build the service into a war file, deploy it to my Tomcat webapps folder, and run it from standalone Tomcat. However, it still throws several errors on start when I try to start it from a service defined within Eclipse. The errors are the same errors that I was seeing before I got the config files correct for standalone Tomcat. The errors are about the inability to create the required beans because of references to properties that can't be found.
How did I get it running in Tomcat? I added a couple of .properties files to define properties needed by the beans that get launched at startup and then added a 'set CLASSPATH=...' line to the setenv.bat file in the Tomcat bin folder. This new line adds the properties files into the CLASSPATH. That seems to have fixed everything from standalone Tomcat.
So, my question is, "How do I make these same changes inside my Eclipse server?" I have added the properties folder with the property files under the config folder in Eclipse, just like it is in my native Tomcat folders, but I do not know how to modify the CLASSPATH string to specifically point to my .properties files (as I have done in the setenv.bat file for standalone Tomcat).
I think I understand the problem, but have no idea about the solution.
Thanks for listening.
Dave
Eclipse does not use any *.sh/*.bat files to startup Tomcat. In order to modify the way the server is started you have to open the configuration UI of the server by double-clicking on the server in the Servers view.
From there you will be able to modify the classpath of the system classloader through "Open launch configuration".
Another important setting is "Server path" which tells Eclipse, the value of $CATALINA_BASE. You can modify it only after removing all modules and cleaning the server. It is useful to set it to an easily accessible directory: this way you can verify directly that Eclipse didn't mess up your application deployment (sometimes it "forgets" to copy some libraries).
The "Configuration path" setting tells Eclipse where to find the files (but not subdirectories) that will be copied into $CATALINA_BASE/conf.
Remark: if your application requires you to add libraries to the top classloader, there is probably a problem in your project. The "missing" libraries should be added to WEB-INF/lib of your application instead: look into the "Deployment assembly" of your Eclipse project configuration.
Problem - I have an issue with two jars in my web application which I am developing using Eclipse IDE of Mars version and hosting it on apache tomcat 7.0 web server -
hibernate-jpa-2.1-api-1.0.0.final
com.ibm.ws.webservices.thinclient_7.0.0
Both of them have same package structure and and same class -
javax.persistence.CascadeType
This package and class is a ENUM type declaration which was being used from first jar. And I have recently added the second jar which is also mandatory as a dependency for a third party jar for authentication and authorization for my application. Once the second jar is added, I have got this issue where the package intended to be used from first jar is being picked up from the second jar.
The Enumeration value CascadeType.DETACH was being used from first jar file in the application and this ENUM value is not defined in its counterpart in the second jar. Hence this issue is being faced.
Things I have already tried and no result -
Tried to remove the above conflicting package from the second jar and added to the library. Then this jar was not being picked up at run time and I was getting noclassdeffound error for the class - com.ibm.ws.webservices.multiprotocol.GeneratedService even after this class is visible inside the second jar itself in classpath.
Instead of CascadeType.DETACH, I tried to use some other ENUM value of the second jar itself and let the compiler ignore first jar. Then was getting the noclassdeffound error for the class - com.ibm.ws.webservices.multiprotocol.GeneratedService which is still inside the second jar.
Out of suggestions I got from stack overflow itself, traversed to Right click on project -> build path -> configure build path -> Order and export to set priority for jars. But at this option, only priority can be set within library sets like WEBAPP libraries, JDK libraries or externally configured libraries but not within individual jars inside a set of libraries. But my both libraries were inside WEBAPP libraries set itself and hence could not set the priority of those jars using this option. As another trial, I removed the second jar from the WEBAPP libraries and configured as an external library instead and set its priority lower than WEBAPP libraries which contained my first jar. Still was getting the same issue- noclassdeffound error for the class - com.ibm.ws.webservices.multiprotocol.GeneratedService which is still inside the second jar.
Some suggestions from stack overflow were setting dependencies in maven pom xml. This will not be applicable to my application as I am not running it through maven but just running it on tomcat web server.
Please suggest a way forward to resolve this issue. Please note that this application is targeted for Websphere server at environment level. Tomcat server is being used at the local setup itself. Please suggest keeping this in mind. I also tried installing websphere server for local setup as well but could not do it as commercial servers are not allowed to be installed inside our organization.
I was recently trying to solve class cast exception in our web application. After few tests have found out that the classloader information for our web application right after application server restart are different from classloader information after webapp restart/update (without app server restart).
Classloader information were retrieved using the Manage modules - View Module class loader - Export in the Websphere administration console.
The items (paths to webapp .jar files) in exported XML are the same. But some of the items (as I understand it - these are the classes in webapps' classloader) are different.
Could anybody explain why?
Thanks.
Update:
Here is the difference which is maybe the main problem (I keep getting ClassCastException on XMLSignatureFactory in my log file). This class is contained in xmlsec library and this library is deployed with our webapp war file. The classloader order is set to PARENT LAST, but it seems like sometimes the XMLSignatureFactory from IBM JDK is loaded instead of the xmlsec implementation (after redeploy).
I have described the exception further in this post. After I have changed the settings in MANIFEST.MF file and set up the servlet listener, I could get the application working after every restart, but the redeploy problem still occurs (which is quite annoying).
I got the same problem here. To fix that issue, push xmlsec jar to AppServer\classes then we can override IBM JDK by our lib
I am trying to deploy a WAR file on weblogic server.
This is a simple java application.
I am new to this and experimenting.
JRE: 1.5.0_41, OS: redhat 5.8, Weblogic: WebLogic Server 10.0 MP2
The contents just include a jsp file and a java file (jsp inside jsp folder and java class inside WEB-INF\classes folder and correct package structure). I am using this java util file inside the jsp for some common utility methods.
However, when I deploy the WAR, it gives me NoClassDefinitionFoundError for this java utility class.
I have searched the threads and found that this exception points to some other inherent issue in the deployment. It also mentioned class path conflicts etc. I can understand this issue when it comes to using a class from an external JAR file, but could not understand how it fails to locate a file in the same context as that of the jsp.
How come the import statements in the jsp worked and the jsp got compiled and rendered and failed only when the part of accessing this object came into picture? (runtime problem maybe?)
Please educate me on this. My debugging efforts are still on. Thanks a lot, folks!!
[P.S.: Could it be because i compiled and built my source using eclipse setting 1.7 compliance and used it on a lesser JRE?]
For a war file classes is normally packaged inside WEB-INF/classes, not classes.
I'm trying to deploy cxf client on websphere 8.5. I resolved conflicting cxf class issues. Now I'm having issue with XmlSchemaForm.class lacking QUALIFIED field. Obviously wrong class is being loaded.
I already set xmlschema-core-2.0.3.jar on shared libraries to be loaded on startup.
But when I checked resource path it shows
bundleresource://222.fwk-496297919/org/apache/ws/commons/schema/XmlSchemaForm.class
instead of jar file path.
I googled and add DisableIBMJAXWSEngine:true under manifest.mf to avoid jax-ws annotations but no luck.
Any help would be great. Thanks.
Set parent last as classloader policy