Axiom throwing error for Axis2 generated WSDL - java

I have auto generated classes from a WSDL file using Axis2 wsdl2java script. After adding the generated Java files to a Maven project the dependencies were only axis2-adb and axis2-kernel. However during runtime it is throwing the following:
Caused by: java.lang.ClassNotFoundException: org.apache.axiom.util.UIDGenerator
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
and
Caused by: java.lang.NoClassDefFoundError: org/apache/axiom/util/UIDGenerator
at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
at com.tobeprecise.sms.webservices.HttpReceiverStub.populateAxisService(HttpReceiverStub.java:42)
at com.tobeprecise.sms.webservices.HttpReceiverStub.<init>(HttpReceiverStub.java:184)
at com.tobeprecise.sms.webservices.HttpReceiverStub.<init>(HttpReceiverStub.java:173)
at com.tobeprecise.sms.webservices.HttpReceiverStub.<init>(HttpReceiverStub.java:222)
at com.tobeprecise.sms.webservices.HttpReceiverStub.<init>(HttpReceiverStub.java:214)
at in.capillary.nsadmin.gateway.tobeprecisebulk.TobepreciseBulkGatewayChannel.sendMessages(TobepreciseBulkGatewayChannel.java:122)
at in.capillary.nsadmin.gateway.BufferedGatewayChannelProcessor.process(BufferedGatewayChannelProcessor.java:150)
at in.capillary.nsadmin.gateway.BaseGateway.process(BaseGateway.java:207)
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
... 18 more
While looking at the dependencies I have found the axiom-api-1.2.11 as a dependency and it very well contains the UIDGenerator class. Is this due to version mismatch?
Found a similar issue ClassNotFoundException axiom-api-1.2.7.jar but I coudn't make much sense out of it(my manifest file: http://pastebin.com/n4jKWPck). Any help?

Related

ClassNotFoundException com.mysql.cj.jdbc.Driver

I build a jar file and this jar file was placed on the linux server.
This jar file catches files in specific folder and execute an insert query.
But I got this error.
I have no idea how to solve this. I already searched and tried setting classpath and etc.
How can I build a jar with jdbc.driver jar?
is there anyone who knows this?
java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at
com.macrogenusa.cjp.ab1.server.DaoManager.updatePlateRun(DaoManager.java:33)
at UntarFromBoston.update(UntarFromBoston.java:211)
at UntarFromBoston.run(UntarFromBoston.java:43)
at UntarFromBoston.main(UntarFromBoston.java:215)

How to fix ClassNotFoundException: org.apache.commons.logging.LogFactory?

When i run the app it getting exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.hibernate.dialect.Dialect.<clinit>(Dialect.java:58)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 1 more
I have put all the jar files in lib folder.
I don't know how to solve this, where is my mistake.
Add this in your pom file:
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
It works for me after adding this jar file
commons-logging-1.2.jar
You can download it from here.
Include hibernate jar files (especially the required jars) in your lib folder
antlr-2.7.7.jar
commons-collections-3.2.1.jar
dom4j-1.6.1.jar
javassist-3.12.1.GA.jar
hibernate-core-4.0.1.Final.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
jboss-logging-3.1.0.CR2.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
I had a similar problem: In my project the solution was to add the following jars of org.apache.commons:
commons-logging-1.2
commons-dbcp2-2.1.1
commons-pool2-2.4.2
For me problem solved post download & adding jar "commons-logging-1.2.jar"

How to use Goose in Java Project

How can i use Goose on a java project? I tested the online version of both boilerpipe and goose, and the last one it's way better but now it's developed in Scala.
I searched for the jar of previous version but can't find it (neither api). The last .jar i tried it's: goose-2.1.22. I imported it in my Ecplise project and tried with this code:
String url = "http://www.cnn.com/2010/POLITICS/08/13/democrats.social.security/index.html";
Goose goose = new Goose(new Configuration());
Article article = goose.extractContent(url);
System.out.println(article.cleanedArticleText());
But i get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at daweb.main(daweb.java:212)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 13 more
Is it possible to use Goose without Scala?
You should add Scala Library to your buildpath
There is a link provided in the issues page where you can find a .jar compiled for java use.
https://github.com/GravityLabs/goose/issues
import com.gravity.goose.*;
String url = "http://www.straitstimes.com/little-india-riot";
Goose goose = new Goose(new Configuration());
Article article = goose.extractContent(url);
System.out.println(article.cleanedArticleText());
This code works as a start.
If you're managing your dependencies with Maven, you can just add Goose to the dependencies section of your pom.xml and all of it's transitive dependencies will end up on the class path.
<dependency>
<groupId>com.gravity</groupId>
<artifactId>goose</artifactId>
<version>2.1.22</version>
</dependency>
You should add scala-library jar to your classpath. If you are using Maven, add this dependency to your project:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.4</version>
</dependency>

Java Errors starting from ClassNotFoundException

I have the following errors when i try to run my Netbeans aplication of a map reduce algorithm:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.apache.hadoop.mapred.JobConf.<clinit>(JobConf.java:349)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1121)
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:72)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:125)
at org.apache.hadoop.security.Groups.<init>(Groups.java:54)
at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:142)
at
org.apache.hadoop.security.UserGroupInformation.initUGI(UserGroupInformation.java:243)
at
org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation
.java:216)
at
org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation
.java:207)
at
org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroup
Information.java:286)
at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroup
Information.java:500)
at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroup
Information.java:483)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:73)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:133)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:138)
at cloudex.CloudEx.main(CloudEx.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 19 more
Could you please give me a hint on how to get rid of it? i do not know what it generates it
You need to add the log4j jar to your classpath.
Either add the log4j class to your classpath as #smcg has stated, or add the following into your project pom.xml if you're using maven.
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
Download Apache log4j *.jar file at log4j. Import external *.jar file to your project.

liferay hook deployment - event class not found exception

I create a hook plugin with liferay-sdk-6.0.6 and define a servlet.service.events.pre event handler :
<service>
<service-type>servlet.service.events.pre</service-type>
<service-impl>com.ggd543.liferay.ServicePreAction</service-impl>
</service>
When i deploy it onto liferay-6.0.6-ce bundled jboss 5.1.0 GA, I got the following error:
Caused by: java.lang.ClassNotFoundException: application.startup.events
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.liferay.portal.deploy.hot.HookHotDeployListener.doInvokeDeploy(HookHotDeployListener.java:569)
at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:218)
... 68 more
Is there any wrong in my liferay-hook.xml ?
Yes. From Liferay 6 you dont define events like that in liferay-hook.xml. You have to create property hook and define your event in the property file. Some thing like below
liferay-hook.xml
<hook>
<portal-properties>portal.properties</portal-properties>
</hook>
portal.properties
servlet.service.events.pre=com.ggd543.liferay.ServicePreAction

Categories

Resources