Exception: org.exolab.castor.xml.ValidationException was not added to the list of sorted types - websphere

I am trying to deploy EAR file on Websphere Application Server but while deploying it's showing an error.
ERROR CODE:
SEVERER: Exception org.exolab.castor.xml.ValidationException was not added to the list of sorted types.
The project was not built since its build path is incomplete. Cannot find the class file for org.exolab.castor.xml.ValidationException. Fix the build path then try building this project.
I am using Castor in my project but it's there in classpath which i am setting through Shellscript.
Thanks for help in advance.

Your dependencies need to be expressed to the application server runtime, not added to some shell variable or standalone java invocation. Either package them in your application or create an isolated shared library and associate it with your dependent application.

Related

Register Jar from the lib-Folder as an Application in Spring Data Flow

I'm trying to create a self-contained application with Spring Data Flow (Mesos). To do that i want to register sinks/processors/sources that are maven-dependencies of my project.
I know that spring-data-flow accepts classpath:// as a scheme for references but it appears to be unable to find any jar located in the resource folder or (optimaly) the lib folder.
java.io.FileNotFoundException: class path resource [lib/spring-cloud-starter-stream-source-ftp-1.0.0.M1.jar] cannot be opened because it does not exist
How can i reference files from within my self-contained jar properly?
I'm trying to create a self-contained application with Spring Data Flow (Mesos)
What are the reasons behind "self-contained" solution? Why not register the apps from our repository directly?
There's already a way to register the OOTB applications using the "bitly" links that we provide. Please review the stream registration section from the reference guide.
More importantly, the latest release of SCDF's Mesos-server does not support maven artifacts. You'd have to use docker images instead. The docs linked above includes the "bitly" link for docker apps, too.

Spring boot createJarFileFromFileEntry

I have a spring boot app and I start it with -Dloader.path=. One of the jar files is hive-exec.jar. This has a jar file bundled called minlog-1.2.jar. If I specify this file in -Dloader.path, I get an error,
java.lang.IllegalStateException: Unable to open nested entry 'minlog-1.2.jar'. It has been compressed and nested jar files must be stored without compression. Please check the mechanism used to create your executable jar file
at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:378)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:355)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:341)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:108)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:92)
at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:445)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:60)
at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:564)
However, if I copy this file into a folder and add that folder in -Dloader.path, I don't get any error.
What am I missing?
Thank You,
I am trying to manage the database driver as external jar instead of a project's maven's dependency. The application use the JPA framework, and we wanted to be able to switch from one SQL-database implementation from one environment to another (for example, H2 in DEV, Oracle in production). I had to manage the h2-database-driver jar as an external dependency. While loading it with the "-Dloader.path" command line option, I came accross he same problem as you described.
Viewing the org.springframework.boot.loader.jar.JarFile source code, the class manage an folder-entry and a jar-entry differently.
The method getNestedArchives seems to invoke the createJarFileFromFileEntry method which throw this exception.
There must be a good reason for it, if someone know about it, any comment is welcomed!
When loading jar dependencies from a directory, the java.util.jar.JarFile constructor is used instead and does not seem to throw any exception...
In the createJarFileFromFileEntry method, instad of throwing an exception, wouldn't it be possible to only have a log.warn and not throw an exception?

WAS cannot load the EJB interface

When I deploy my EAR on WAS 6.1 (EAR was built by Jenkins-Ant), and tryy to start the EAR, I get on SystemOut.log:
[7/28/13 16:33:18:847 EDT] 00000027 ComponentData E CWMDF0015E: The class loader cannot load the com.service.ejb.IntegrationServiceRemote interface on the com.service.ejb.IntegrationServiceImpl Enterprise JavaBeans (EJB) file
The remote interface and the bean implementation have their own jar file and the EAR contains both. I understand the interface should be loaded first, but how to guarantee that? ALso is the error because of the loading order?
Just uninstall the Application EAR from the server. Export new EAR from the RAD and install it manually, it should work.
The MANIFEST.MF file with the entry IntegrationServiceRemote had a typo. Phew !!
It is necessary to click in the paramètrage of publication for WebSphere Application Server of Eclipse IDE "to execute the server and the resources on the server"
and run a server
You might not have mapped the shared library which you have created under the ear file which is deployed. So, go and click on the file you have deployed and under shared library references map the shared library which you have created. Then it will not show this issue.

java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

I am using aspectJ in my project and added dependencies in my POM file. When i am running my application on Websphere Application Server Liberty Profile, in the library folder aspectj.jar is not getting added/created. I am very new to using spring and never used server's to run a application. When i am trying to run the application on the server i am getting the following exception:
Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
Can anyone please team whats going on wrong with the application ?
Thanks!
You'll need to make sure that aspectj is available to your application at runtime. The two basic approaches for this are to package it up with your application zip, or to make it available as a shared library in the server. The first approach has the advantage that you don't need to do any extra config, and no matter where you run your application, the dependency will be there. However, it has the disadvantage of bloating your application. If you end up running multiple applications on the server, it could also cause the apps to use more memory than they would if they were just using a shared copy.
For the first approach, if your dependency has the default scope in the pom, maven should automatically copy it to WEB-INF/lib (assuming your application is a war).
For the second approach, you can configure it in Liberty as a global library (available to all applications) by copying it to a wlp/usr/shared/config/lib/global folder in your Liberty install.

Eclipse Java EE project and Spring : classnotfoundexception

I am trying to build an project in Eclipse (actually I'm using RAD, so basically eclipse, and when I say 'Java EE Project' I mean an 'Enterprise Application Project').
My Enterprise Application Project (the 'EAR' project) has two module projects :
- service
- web
The service project has some stuff in it, all wired up using Spring.
The web project has its own stuff in it, all wired up using Spring. The UI stuff in the web project needs to use the stuff in the service project.
Both projects are included in the EAR project as modules.
The web project lists the 'service' project as a dependent project in the build path, it's checked off for export, and also has it listed as a EE Module Dependency.
I'm having a really hard time to get this working though:
The spring context in the web project is of course what gets loaded when the application is deployed, and it imports the spring config I need from the service project. This seems to be working fine.
When spring tries to instantiate a bean it throws a ClassNotFoundException. On the very first bean.
I tried simply copying the spring config from my service context and pasting it into my web context, but I got the same ClassNotFoundException.
I have tried instantiating an object of that type (the class that spring says cannot be found) in the java controller class in the web project, and it is successful, both at compile time (no compile errors) and at runtime (no exceptions).
So the classes from my service project are not available on the classpath when spring tries to use them.
Any ideas what's going on here and/or what I might be able to do about it?
There is a class loader policy that you should use ParentClass First . That will be managed either through Application.xml or through web.xml . You need to check your xml's then try.
It's a class loader issue.
Since you're using Spring, I'll assume that you don't have EJBs. If that's the case, why do you need an EAR? Deploy the whole thing as a web project, in a single WAR.
Put all your .class and Spring configuration .xml files in WEB-INF/classes. Load the configuration using org.springframework.web.context.ContextLoaderListener.
I seem to have fixed this - I'm not sure exactly what the problem was but there must have been a small typo in my spring config. I decided to just start fresh with a new spring config and when I started building the new one back up things were working fine. There must have been a problem with the old one.
Thanks for the suggestions though.
Unfortunately we're not always able to change project structure. We're working on structures other people have put in place.
I looked into the ParentClassFirst vs ParentClassLast setting - it seems on websphere the ParentClassFirst setting is the default if you don't specify anything, so I'm leaving it without specification to get that functionality.
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/crun_classload.html

Resources