How can i solve a NoClassDefFoundError? - java

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.

Related

Vaadin applicagtion in Maven gets widget error (using tomcat)

I'm trying to create a Vaadin application to deploy on a tomcat server following the beginner's guide in the book of Vaadin.
https://vaadin.com/book/-/page/getting-started.maven.html
I used the Maven command line provided at this address. I can successfully create a Maven project, build it with mvn package and import it in eclipse.
Once done, I can add it to my tomcat server and run it. When trying to connect to localhost http://localhost:8080/viznet/ (viznet being the project name) I get a this error :
Requested resource [/VAADIN/widgetsets/viznet.MyAppWidgetset/viznet.MyAppWidgetset.nocache.js] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
I would like to know a) why is this happening b) How can I solve it.
I did a lot of researches yet, found some alike problems but couldn't fix mine. It seems to me I can't get my project to use the default widget (or fix this particular one but the default widget would suit me just fine).
There might be some error in my configuration or missing information here, I'm brand new to this so I don't know what you need to know in order to help me.
Environment:
Ubuntu 14.04
Eclipse 4.1
Maven Latest
Tomcat 8.0
Thanks in advance
I fixed this problem by creating new Maven configuration and adding "package jetty:run" in command line, then just run your project, it should work fine, after this you can use Tomcat again!
You need to compile your widgetset using mvn vaadin:compile. Look at this question.

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.

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.

Trouble configuring existing Tomcat6 and Eclipse

I just got the Eclipse Java EE version and tried to configure Tomcat by going to the Window-->preferences-->Server
But when I went to "runtime environment" and gave it the location of the current tomcat directory, it didn't seem to recognize it and didn't let me go to next screen.
Did I do something wrong? The problem is that there are still the red squigly lines in the import statements of servlet libraries. Is there some correct way to refresh the page so I can ensure that Eclipse indeed does not recognize those libraries still?
I have been experiencing similar problems recently, sometimes even Eclipse not listing Apache Tomcat 6.0 among available servers. The solution was go to eclipse's metadata directory:
your_workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/
And delete following files:
org.eclipse.wst.server.core.prefs
org.eclipse.jst.server.tomcat.core.prefs
Then restart Eclipse and try again, everything should work.
Hope this helps!
Ensure that you're pointing to the real Tomcat root directory which contains the /bin, /conf, /lib, etc folders, not to a directory which contains just apache-tomcat-7.0.11 or something.
Also pay attention to the error/warning message in top of the wizard, if any, right below the title.

ClassCastException with Weblogic 10.3.3/Pitchfork

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

Categories

Resources