ClassCastException with Weblogic 10.3.3/Pitchfork - java

We're trying to deploy a spring application to Weblogic 10.3.3. We created a war file, which works nicely with tomcat, but, when trying to package it up as an ear to use with weblogic, we're getting an issue with Pitchfork:
java.lang.ClassCastException: org.springframework.jee.spi.PitchforkUtilsImpl cannot be cast to com.oracle.pitchfork.interfaces.PitchforkUtils
Why is Weblogic trying to cast this, and what are we doing wrong?
Thanks.

Notice that the error message mentions two different flavours of PitchforkUtils, which appear to be incompatible.
Without being familiar with Pitchfork, could it be an import which has been automatically "fixed" in the porting process - Eclipse can automatically resolve imports - to resolve against the Oracle PitchforkUtils instead of the one you actually want to use?

This says that WebLogic has its own version of the Pitchfork JAR, which the classloader is finding before it gets to the Spring version in your WEB-INF/lib.
Remove the Pitchfork JAR from your web context and see if that fixes the issue.
If your code imports the Spring version, you'll have to alter the code to use Oracle's.
You can also tell the class loader to prefer your app JARs to server level JARs. It's an entry in your weblogic.xml: <prefer-application-packages/>
http://relation.to/Bloggers/Weblogic10SeamAndEJB3

Related

How to resolve exception "weblogic.application.ModuleException: Context path '' is already in use by the module: / application"?

I have gone through the Question:
[weblogic.application.ModuleException: Context path '' is already in use by the module: / application:
and followed as answer of the question says; but still getting the same exception:
**> Deployment failed. The message was:
weblogic.application.ModuleException: Context path
'/socketss-war' is already in use by the module:
/Socketss-war application: Socketss
D:\NetBeansProjects\Socketss\Socketss-war\nbproject\build-impl.xml:1056:
The module has not been deployed. See the server log for details.**
Any guidance or suggestion would be highly appreciable.
Thank you!
ModualException come due to inproper Bulid.
Go through step by step.
Update project
Restart your eclipse
Remove project from server
clean server and redeploy your project
Now publish it i hope now it will work
Yup. Try to deploy from Netbeans.
The Weblogic eclipse plugin is, in my experience, the worst deployment plugin I've ever seen. If you are using a patched weblogic - such as 12.1.2 with Patch Set Update 6 - your deployment from eclipse might miraculously not work with such an error.
If you are able to deploy the WAR file without IDE by going to the deploy view, I recommend that you try using Netbeans to deploy and see how it goes.
Notice as well that the outcome of trying to deploy from eclipse as exploded war or as virtual application is not the same. Typically both do not work with different exceptions, depending on the patches you are using.
In my case, I have two local installations of weblogic 12.1.2. One with the patch set update and another one without. From eclipse, It is only possible to deploy to the one without. From Netbeans, deployment works regardless of the instance.

ClassCastExceptions due to upgrade to hibernate 4.2.8 in WebSphere 8.5.5 application container

We recently upgraded hibernate from 4.0.1 to 4.2.8.Final.
Hibernate.4.2.8.Final is depending on javassist-3.18.1-GA. Unfortunately websphere is 8.5.5 is not shipped with latest javassist but it is not my issue. I tried to force websphere to take my javassist jar but I FAILED ( for some reason it is always loading from ${WAS_INSTALL_ROOT}/plugins).
What I tried?
Classes loaded with local class loader first (parent last) in websphere console and WEB-INF/lib contains latest javassist jar. But application is not working
Put latest javassit jar in ${WAS_INSTALL_ROOT}/lib/ext but no use
Added shared library and referenced in application but no luck.
If I replace javassist.jar in ${WAS_INSTALL_ROOT}/plugins then application started working but this is not good solution because other web applications might depend on old javassist
My question
How can I use (or inject or refer) latest javassist jar in Websphere 8.5.5?
This #blog helped me to figure our the problem little quickly.
Where did you put parent last, in which window of the console?
Because there are two places in the console where to put parent last, one at the application level, and the other at the WAR level and that is the one that you want to choose.
Put 'Class loader for each WAR file in application' and I believe from inside the screen where you chose that option, click the WAR and set the classloader policy at the WAR level to parent last:
I think the path is this (don't have a console now):
Application -- > Enterprise Application --> application_instance --> Web Module --> Web Module_instance
Have a look at this to see that are two places to set classloader policies, and let me know if you found the setting and if it worked, or a new error is thrown.
Sometimes when we switch the setting we find new errors because other jars where being read from the server and not the WAR, such as bean validation errors etc. If you get a different error non javassist related, it might be caused by that and you can always post it in a new question.
This can be solved by adding the new version of javaassist as a shared library . The details are described here
[http://www-01.ibm.com/support/docview.wss?uid=swg27006159#usingserver][1].
The shared library should be assigned against the a new class loader defined at the server configuration. The class loading policy should be PARENT_LAST for this class loader
Change the WAR class loader policy to module.
Solution to the problem is PARENT_LAST but I have changed in application settings page (Applications -> Application Types -> WebSphere enterprise applications -> *application_name* -> Class loading and update detection).
Unfortunately this is not correct place to put PARENT_LAST option. Because my application is web module (to be precise war file ;)) I would have put PARENT_LAST option in (Applications -> Application Types -> WebSphere enterprise applications -> *Application_Name*-> Manage Modules -> Module Name -> Class loader order). I don't know this option until I have seen jhadesdev comment and especially the link.
#jhadesdev Thanks once again. I have summarized everything HERE
when your app structure is fairly simple I think the experiment with the war (isolated / parent last classloader) might do the trick.In my case we package in full ear form snd we use skinny wars -meaning that the actually module that contains the jpa/ hibernate entities is a full blown ejb-jar and is packaged at the ear top level. I am not sure I can easily play around with the classloader if this module (not an websphere expert though)
My second problem is tha ideally I want all these exotic classloader policy setting to be performed during packaging with no after deploy admin action (meaning an admin to do some clickd in Websphere's panel). This file based way exist but its too complex and ugly iMho, i blame Websphere for that.
Here a little guide on how to update javassist in WAS. This was tested with WAS 8.0.0.1.
The javassist.jar in WAS_HOME/plugins has to be replaced by the jar from: http://search.maven.org/remotecontent?filepath=org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
Keep the old one as backup.
Invoke WAS_HOME/profiles/PROFILE_NAME/bin/osgiCfgInit.sh and then WAS_HOME/profiles/PROFILE_NAME/bin/clearClassCache.sh or the *.bat files on windows machines.
Thanks to this post I found out how to do it: http://ramirezag.wordpress.com/2014/02/27/hibernate-4-2-8-and-websphere-8-5-5-1-issues/
We are using WAS 8.5.5 and Hibernate 4.3.5, and have faced the same issue.
Adding Java Assist as shared library did work for us.
Note that the shared library has to be created with an isolated class loader

hbase + gwt multi module app, issues with slf4j and resources

I've found a lot of articles/questions dealing with this problem, but there was no answer that worked for me yet.
I'm using GWT 2.5 with the eclipse plugin. eclipse version is Juno with Java7.
Everytime I start the app it first tells me that log4j was not configured properly (no appenders...) and also my HBaseAdmin can't connect to HBase (which is running).
All of the answers tell me that I have to put the resources into WEB-INF/classes directory. In order to do that automatically I added the files into the root src directory. But still nothing.
Maybe it's worth mentioning that I don't use maven (b/c all the other projects are no maven projects either, and there is no time to introduce maven at the moment)
Thank you for any hints what might be missing.
EDIT:
somehow I don't get any warning anymore, but I didn't do anything except restarting over and over. Thus this should be working now. But, Zookeeper now throws
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
I divided the gwt app up to the UI part, the executing implementation of the service is a seperate project, also the model is seperate. I first just added the required libraries to the projects that really need them. Know I also added them to the main GWT app, but that didn't help either. Any ideas?
LoggerFactory classes you are using is from slfj-api-1.6.1.jar . Try adding that jar into your WEB-INF/lib and classpath. Also we usually use it conjunction with slf4j-log4j12-1.6.1.jar .
Note: We are using version 1.6.1 as indicated by GWT sample examples available with gwt downloads.

How can i solve a NoClassDefFoundError?

I have installed Oracle Weblogic 11g on Oracle Linux and I tried to complete one of Oracle's ADF tutorials using jdeveloper 11g. When I run my project it compiles successfully with no errors. It starts deploying the application to the weblogic server and my default internet browser opens. But then an Error "500 Internal server error" appears.
I'm getting the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.apache.myfaces.trinidadinternal.convert.ColorConverter at....
I researched the internet for this problem and I also asked around and the common answer was that there is a problem with the classpath. Probably the libraries that are used in jdeveloper are not the same in weblogic then the project gets deployed.
Can anyone tell if definitely the problem is the classpath??
And how can I setup jdeveloper to deploy the same classpath it used to the weblogic server?
java.lang.NoClassDefFoundError means the runtime version of the class in the classpath is not the same as that at compile time.
Your problem could be multiple versions of the class being found when the server is deploying. I notice the class org.apache.myfaces.trinidadinternal.convert.ColorConverter is found in trinidad-impl.jar
Can you search for how many such jars are found in the run time server environment plus your own webapp libraries?
On windows, the Jdev inbuilt server runs in this folder
C:\Users\<...>\AppData\Roaming\JDeveloper\system11.1.1.4.37.59.23 or something similar
you need this in your webapp/WEB-INF/lib and not in the other areas.
On my local I find the Jar under C:\Users\<...>\AppData\Roaming\JDeveloper\system11.1.1.4.37.59.23\o.j2ee.wlLibs\jsp\Trinidad-Components1.2.war
I think you could use the weblogic.xml setting to force the WEB-INF/lib class to get loaded in preference to that in server/lib with
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
This happens when you try to load a class that is trying to load another class which is not on the classpath. Find out which classes are needed by ColorConverter and make sure you have them in your classpath.
First of all: What are you deploying to the server? An ADF jar or a WAR file. In your case - given that you don't have any dependent jars installed on the application server. You should deploy a WAR file.
On your view project - right click and select Project Properties. Then go to Deployment and edit the deployment profile (if none are there create one). Make sure that the checkbox "Include Libraries from other projects" is checked. (IT's in the Library Dependencies tab).
Also: you might find some useful information in here.
Hope this helps.
Michael
Using StackTrace you can find out classes those are missing .I think you are missing some jar and that should be in your classpath.

request.setCharacterEncoding("UTF-8") wrong when going to myEclipse from JBuilder2008

When working with JBuilder2008 my project would build successfully. I changed to MyEclipse and found the following issue:
request.setCharacterEncoding("UTF-8"); has got a red line below setCharacterEncoding and it has below problem message:
The method setCharacterEncoding(String) is undefined for the type HttpServletRequest
Could you tell me what shall I do?
I think that the problem is that your Eclipse is configured to use an older version of the servlet APIs; see this forum post. (Right at the end.) The method is certainly present in the Java Servlet 2.4 APIs.
(FWIW, I pick up my Java Servlet APIs via an explicit Maven dependency, so I'm not hostage to the default version implied by my IDE settings.)
Inside MyEclipse IDE, please add 'javaee.jar' in your Project's build-path. This will solve your mentioned error about "request.setCharacterEncoding("UTF-8") "
Usually, during run-time (within web-server container) this jar will be already in classpath. But during development inside IDE, you may face this compile time error.
You will find this JAR at path depending upon your installation path:For example,
C:\MyEclipse6.0\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820\data\libraryset\EE_5

Categories

Resources