Getting java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/utils/NamespacePrefixList on creating the web service in eclipse - eclipse

I am trying to create a web service using axis2.
I have created it.
I am following the below steps for getting the wsdl info.
Right click Project -> Run on server -> Next.
No class found error is coming. Is any jar file is required.
Please guide me how to resolve this.
Error: java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/utils/NamespaceMap at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:437) at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396) at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109) at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:232) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:154) at

You can download and include the XmlSchema jar in the lib folder of your dynamic web project /WebContent/WEB_INF folder.
But, this will only solve the problem temporarily. On creating WS client the XMLSchema jar will not get included. So check the compatibility of the version of your server with axis2 version (like Tomcat 6 created problem with axis2 1.7 but works fine with axis2 1.5.2).
On successful compatibility the XMLSchema jar will get included in the respective folder automatically.

You can correct your issue by referencing the XmlSchema jar in the lib folder. You can find the latest version of the jar file in the link below.
http://www.java2s.com/Code/Jar/x/DownloadXmlSchema142jar.htm

Related

Adding external jars in netbeans for rest service in glassfish

I'm trying to create a simple REST Service using the Web App project type in Netbeans 8.1, with JDK 1.8 and to be deployed in Glassfish Server 4.1.1.
I need to use external libraries to provide the service functionality, i.e. tika and lucene.
My problem is that If I add any jar (Right-click -> Add jar/folder: tika-app-1.12.jar) in the Libraries of my Nb project I get:
An error when deploying:
Grave: Class [ javax/cache/configuration/Configuration ] not found.
Error while loading [ class
org.apache.cxf.jaxrs.client.cache.CacheControlFeature ]
An error when invoking:
Advertencia: StandardWrapperValve[BusquedaApplication]:
Servlet.service() for servlet BusquedaApplication threw exception
java.lang.NullPointerException at
org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor.filter(JAXRSBeanValidationInInterceptor.java:64)
at
org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:132)
...
I have tried adding the jar file in glassfish/lib, glassfish/domains/<mydomain>/lib and glassfish/domains/<mydomain>/lib/ext but the error persists.
Note that these errors show up as soon as I add the jar in the Nb libraries folder, whether I reference them in my code or not.
If I remove the jars the service gets deployed without error and I can also invoke it correctly and get the appropiate response.
Any insight in the correct way to deal with these external libraries is greatly appreciated.
Ok, I think I have figured it out.
To be able to use the external libraries:
Don't package them in the war file. In Nb: go to Project Properties -> Libraries -> Compile-time libraries. Then uncheck the Package box for all the listed libraries.
Copy all the .jar libraries to the <domains-folder>/<your-domain-name>/lib. Be aware that your domain folder may not be in the installation directory of Glassfish. You can check the Server properties in Nb (Go to Services tab -> right-click Glassfish server -> Properties -> Common -> Domains Folder)
Use delegation inversion model in the Servlet. To do this, set delegate="false" in the class-loader element of the glassfish-web.xml file.
This worked for me. I hope I can help anyone else in a similar situation.

Hibernate configuration with tomcat and eclipse

I'm creating a webApp in eclipse using tomcat & hibernate (for mysql). Ive unit tested by code and I am able to connect to the db and pull data, but I'm running into issues when trying it from the web app.
From the exception it looks like it isnt able to get to the hibernate.cfg.xml, but I've tried placing the file in the src folder, WEB-INF/lib & WEB-INF/classes but I still get the same error.
The line of code that it's failing on is:
Configuration configuration = new Configuration();
I would really really appreciate any help!
ClassPath References:
Project References:
Stacktrace:
java.lang.ExceptionInInitializerError
org.hibernate.cfg.Configuration.reset(Configuration.java:324)
org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
root cause
java.lang.NullPointerException
org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
org.hibernate.cfg.Configuration.reset(Configuration.java:324)
org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
SOLUTION
Thanks to #Engineer, I was able to solve this by removing the jars from WEF-INF/lib & from the class path of the run configuration. Then I added them back using the "Deployment Assembly" menu in eclipse. I also have my project references here.
From Ranga Reddy:
Problem: Because of adding the jars in user library class path.
Solution: Instead of adding the jar files using User Library add the jars using classpath.

Including jar in EJB module with Eclipse

I'm using Eclipse.
In my J2EE application I included jt400.jar as an external jar to my build path, but when I try to connect from code I get the exception:
class not found exception com.ibm.as400.access.AS400JDBCDriver
Any Ideas?
I added a lib folder under EarContent folder and put the jar into it. It works fine.

Hello World Struts 2 Eclipse project 404 error

I've created a struts2 project with eclipse, when executing it shows the message error:
HTTP Status 404 - /StrutsHelloWorld/Login.jsp
type Status report
message /StrutsHelloWorld/Login.jsp
description The requested resource (/StrutsHelloWorld/Login.jsp) is not available.
Apache Tomcat/7.0.26
I've followed step by step guide http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/
and i got that message error.
Please anybody help me!
This is the directory structure. URL: localhost:8080/StrutsHelloWorld/Login.jsp
try to add the following jars into aweb-inf/lib folder and BuildPath
commons-fileupload-x.y.z.jar
commons-io-x.y.z.jar
commons-lang-x.y.jar
commons-logging-x.y.z.jar
commons-logging-api-x.y.jar
freemarker-x.y.z.jar
javassist-.xy.z.GA
ognl-x.y.z.jar
struts2-core-x.y.z.jar
xwork-core.x.y.z.jar
From the given url, there is full project available for download. And never forget to include struts2 libraries in WEB-INF/lib. It works for me.
I also followed the tutorial, what was missing (for me) is that I have to add the struts libraries to the deployment assembly (project->properties->'Deployment Assembly')
I have configured a user library as Struts2 that contains all struts2 jars, I have included this entry to be deployed to web-inf/lib. Take a look to the console error.

java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

I am tring to configure a dynamic web project using eclipse helos. I use tomcat 6. When I add the libraries to the WebContent/lib it works fine. But I want to a folder called lib in the project's root level(root/lib). When I put my library files to that folder it builds fine. Run fine to the login page. When I try to log in it gives
"java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool"
Please help me with this.
You're creating a web app and deploying it as a WAR file in a Java EE container. That means that your deployment must follow the WAR standards. Put your JARs in WEB-INF/lib. The container will find them there.
Tomcat 6 and 7 have changed things up so JDBC driver JARs need to go in the server /lib directory. The app server expects to find them with its class loader. Try putting the MySQL JDBC connector JAR in /lib and see if that helps.