Package org.apache.axis2 does not exist

老子叫甜甜 提交于 2019-12-06 06:59:56

问题


I'm trying to import packages:

import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.ServiceLifeCycle;

But I'm getting errors:

package org.apache.axis2.context does not exist
package org.apache.axis2.description does not exist
package org.apache.axis2.engine does not exist

I've added %AXIS2_HOME%\bin in my PATH environment variable and have also set C:\apache-tomcat-6.0.30\webapps\axis2\WEB-INF\lib in my CLASSPATH, but I still can't compile my Java file due to the same errors.

Does anyone know what are the possible reasons?


回答1:


If you are using axis2 version 1.6.2 , you can use below jars to solve this.

AXIS_HOME/lib/axis2-kernel-1.6.2.jar

OR

If you need maven dependency

 <dependency>
  <groupId>org.apache.axis2</groupId>
  <artifactId>axis2-kernel</artifactId>
  <version>1.6.2</version>
</dependency>



回答2:


As setting the CLASSPATH is not helping, there is an alternative to specify the lib jar files with javac and java command i.e. using -extdirs

Compile your code as

javac -extdirs D:\Software\axis2-1.6.2\lib webservices/*.java

and then run your code as

java -extdirs D:\Software\axis2-1.6.2\lib webservices/ClientMainClass

Here the path D:\Software\axis2-1.6.2\lib is of axis2 binary distribution and not of axis2 war

ClientMainClass has your main method that will call your remote method using generated stub.

Hope this works for you.

All the best :)




回答3:


You need to link/reference all the jars in %AXIS2_HOME%\lib



来源:https://stackoverflow.com/questions/6641636/package-org-apache-axis2-does-not-exist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!