Glassfish 4 deployment error - java

I added some libraries to my JavaEE project and then deploy the application works. I modified something and I got this error message in Eclipse:
Cannot Deploy ProjectName
deploy is failing=Error occurred during deployment: Keys cannot be duplicate.
Old value of this key property, nullwill be retained.
Please see server.log for more details.
java.lang.LinkageError: loader (instance of
org/glassfish/web/loader/WebappClassLoader):
attempted duplicate class definition for name:
"org/glassfish/web/loader/JdbcLeakPrevention"
loader (instance of org/glassfish/web/loader/WebappClassLoader): attempted duplicate
class definition for name: "org/glassfish/web/loader/JdbcLeakPrevention"
I made some research and I found out that it is not an Eclipse bug. I'm working with Kepler but I tested with Juno too. Got the same error message.
I downloaded Glassfish 3.1.2.2 and the message gone.
Why am I getting this message?

I Had the same error. I stopped the GLassfish server and then I cleaned the project (Project -> Clean... ). Started the server and worked

I also had this issue, and I was also using the SVNKit library plus its dependencies so it looks like there is some kind of conflict there. I can get around it by cleaning out the osgi-cache folder & restarting glassfish, but I have to do this every time I want to deploy, so not a great solution.

Try to remove all the files under osgi-cache and generated directories. It worked for me.

In my Glassfish log file it says:
Application with name ws is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name
Following my logs instructions I deployed the app with --force option:
asadmin deploy --force=true ws.war
and it worked. More info on deploy --force=true

Try to clean autodeploy directory, restart the server.
Also clean the project deployment directory.

following steps worked for me.
stop the glassfish server(if running)
kill all the java process (using terminal or activity monitor)
now try redeploy.

Was somehow related to a single #Singleton bean. Converted it to #Stateless and everything worked fine. Not quite sure why this happened...

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.

Cannot see sources will debugging on local JBoss server

I have a project producing a .war file, I created a local JBoss 7.1 server in eclipse referencing my local JBoss installation. Then I start the local server in debug mode, copy my war file to {JBOSS_HOME}\standalone\deployments, and it deploys it correctly.
But when I add a breakpoint in eclipse, the code stops like it should, but showing me a "Source not found" white page.
How can I link or synchronize the source code to my local server?
Thank you.
Okay so I solved my problem and it seems pretty obvious now that I found it :
My project is generating a projectname.war, and a projectname-sources.jar, I just had to deploy also the projectname-sources.jar...

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.

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.

Netbeans deployment fails after class rename

I am writing a test client for a webservice. It's a Netbeans 6.9.1 WebApplication using JSF framework. I have one managed bean that calls the webservice.
Everything worked fine until I noticed a typo in my bean class name. It was serviceBean and I renamed it to ServiceBean with first letter upper case. I used safe rename function of Netbeans and both the filename and class signature changed as expected.
But from then I had a lot of trouble running my application on Glassfish 3.0.1.
I can build my application from Netbeans without error (even "Clean & Build"). But if I deploy there is the following message in server log:
WARNUNG: Error in annotation processing: java.lang.NoClassDefFoundError: jsf/serviceBean (wrong name: jsf/ServiceBean)
WARNUNG: WEB9052: Unable to load class jsf.ServiceBean, reason: java.lang.ClassNotFoundException: jsf.ServiceBean
INFO: Mojarra 2.0.2 (FCS b10) für Kontext '/PidClient' wird initialisiert.
SCHWERWIEGEND: Unable to load annotated class: jsf.serviceBean, reason: java.lang.NoClassDefFoundError: jsf/serviceBean (wrong name: jsf/ServiceBean)
INFO: Loading application PidClient at /PidClient
I have a form on a facelet page that will be submitted to my managed bean. The form will be loaded despite of the above error but if I try to submit it I get the following error:
WARNUNG: /index.xhtml #19,94 value="#{serviceBean.fldLname}": Target Unreachable, identifier 'serviceBean' resolved to null
javax.el.PropertyNotFoundException: /index.xhtml #19,94 value="#{serviceBean.fldLname}": Target Unreachable, identifier 'serviceBean' resolved to null
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:93)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1008)
So this will only be a follow-up error caused by the NoClassDefFoundError above.
And now to the strange part:
If I build my project it creates the file ServiceBean.class but if I deploy the project from Netbeans and then look into my deployment directory the class is renamed to serviceBean.class.
It seems that deployment process renames the file.
What is the problem? (Netbeans 6.9.1, Glassfish 3.0.1, Windows 7)
UPDATE: It gets even better: Renamed ServiceBean.java to ServiceBean2.java. Result: If I "Clean & Build" the war file contains ServiceBean2.class only. If I deploy from NB the build dir contains ServiceBean2.class and serviceBean.class. How do I get rid of this ghost?
I was able to replicate a variation of this problem. I had to clear the NetBeans compilation cache (which appears to have issues on OSes that are case-forgiving...)
To move past the issue that I encountered, I had to:
Stop the server
Clean the project
Stop NetBeans
Delete %HOME%.netbeans\6.9\var\cache
Start NetBeans
When I ran the project which was having problems, NetBeans recompiled the project, started the server and opened the index.xhtml. I was able to navigate through the app successfully after that.
I have opened http://netbeans.org/bugzilla/show_bug.cgi?id=198565 to track the issue. Please monitor that issue and add any info that you think would assist somebody that attempts to resolve the issue.
I had a very similar problem with NetBeans 7.3, which means it's still not fixed. It happened after I did a rename and delete of an entity class, and JPA refused to believe that the class was deleted, so I couldn't deploy to Glassfish.
Took me many hours, going from restarting NetBeans and Glassfish to actually reinstalling them. Turns out reinstalling NetBeans doesn't clear its cache though, and that's where the problem lies.
As I run OS X, I did the following in ~/Library/Caches/NetBeans:
$ grep -r MyDeletedEntity *
And boom, there were few references to my deleted class!
I then proceeded to delete the contents in that folder, restarted NetBeans and then deployed to Glassfish again. Now it works!
If this does not work, also look into
/Applications/NetBeans/NetBeans {whateverversion}.app/Contents/Resources/NetBeans/nb/var/cache and delete everything in that folder too.
Too late, but might help others. I just realized JRebel was keeping references to the old names. I disabled JRebel for my project, clean&build+run and problem got away.

Categories

Resources