I'm currently updating a legacy code, and below is the error occured.
SEVERE: Servlet.service() for servlet [RequestController] in context with path [/ngsf] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: com.hierynomus.mssmb2.SMBApiException
Now, MyProject.jar is the one im upgrading to use SMBJ due to limitation to SMB1 from jcifs. Built the jar via eclipse [ right-click project -> export -> JAR File]. After i exported the jar, i delete the old MyProject.jar in WebProject and pasted the new MyProject.jar (basically i've ovewritten the old for the new jar) and ran tomcat via eclipse run server. However, the exception occurred. com.hierynomus.mssmb2.SMBApiException can be found inside smbj-0.9.1.jar.
I did a comparison, using the old jar (using jcifs). everything was good. but when i used the new jar, above exception occured. Basically, i just updated the MyProject.jar. there is no modification on WebProject.
Anyone knows how to fix this?
Related
I'm trying to apply external library in java project.
According to the API documentation, it shouldn't be located under reloadable classpath like WEB-INF/classes or WEB-INF/lib and the easiest way to apply API is put the .jar file into [tomcat home]/lib and restart tomcat.
So I put the jar file into [tomcat home]/lib folder and import the API on java class.
But error occurred when I run the server. It seems the API not imported.
2022-08-09 11:08:36,499 WARN [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '[api class name]': Invocation of init method failed; nested exception is java.lang.Error: Unresolved compilation problem:
[api name] cannot be resolved
Do I need more settings?
#SOLVED
I just placed jar file only into tomcat server not local because the API is available
only in operation server.
So I add jar file on my eclipse (Project Right Click - Build Path - Configure Build Path - Add External JARs) and then deploy project as WAR.
I am migrating Lucene from version 2 to 7.7.1 and facing below issue while upgrading lucene search.
Getting NoClassDefFoundError for CommonTermsQuery even though the jar which it is part of is included(lucene-queries-7.7.1.jar). Can you please suggest what is missing here.
Error Log:
_Apr 12, 2019 5:07:29 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path threw
exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError:
org/apache/lucene/queries/CommonTermsQuery] with root cause
java.lang.NoClassDefFoundError: org/apache/lucene/queries/CommonTermsQuery
at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:149)
at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:112)
at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:513)
at org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:218)
at org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:186)
at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:201)
at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:161)
at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:465)_
Code Snippet:
...
TokenStream tokenStream = analyzer.tokenStream(searchField.toLowerCase(), new
StringReader(content));
preview = highlighter.getBestFragments(tokenStream, content, 3, "...");
...
You need to add lucene-queries-7.7.1.jar to your classpath. (BTW - newer version already exists - 8.0.0)
Eclipse was referring to an older jar. I did below things to resolve my issue.
If you have added the jar in the build path and if it is visible in the referenced library then.
Check whether jar is present in eclipse cache: Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/project/WEB-INF/lib
Then go to
Right click the project > Properties > Deployment Assembly: Check for your jar, if it is missing then add it.
Clean build the project. It works fine.
Eclipse: Luna 4.4.2
Tomcate 8.0
Attaching my POM.xml
I want to call taleo webservice and trying to create a dynamic web application.
I tried following scenarios:
Scenario 1: wsdl is working fine in SOAP UI.
Scenario 2:
Created a maven project and generate the source for wsdl and write the code for client.Able to call the webservice without any error And create java UI (Frame) and show the result on UI.
Scenario 3:
Created a maven project, add the wsdl into it and generate source for wsdl. Then trying to convert it into web application Getting below error:
cannot nest '31JanTest/target/generated-sources/cxf/schemaorg_apache_xmlbeans' inside '31JanTest/target/generated-sources/cxf'. To enable the nesting exclude 'schemaorg_apache_xmlbeans/' from '31JanTest/target/generated-sources/cxf'.
Scenarion 4:
Step 1:
(First created dynamic web application then convert it to a maven project). As soon as i added wsdl to this project getting below error in wsdl:
src-resolve.4.2: Error resolving component 'ns2:Entity'. It was detected that 'ns2:Entity' is in namespace 'http://www.taleo.com/
ws/tee800/2009/01', but components from this namespace are not referenceable from schema document 'file:///C:/Users/
deepak_gupta22/WorkSpace1/test123/src/taleoWebservice.wsdl'. If this is the incorrect namespace, perhaps the prefix of
'ns2:Entity' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///C:/
Users/deepak_gupta22/WorkSpace1/test123/src/taleoWebservice.wsdl'.
Step 2:
Ignore this error in wsdl and build the application and wrote the client code and run the application. I got below error:
SEVERE: Servlet.service() for servlet [main.MyTestServlet] in context with path [/test123] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2496)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:860)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:462)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:305)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:85)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)
at com.taleo.ws.tee800._2009._01.find.FindService.getFindServiceHttpPort(FindService.java:72)
at main.ClientService.getEntities(ClientService.java:202)
at main.MyTestServlet.doGet(MyTestServlet.java:42)
What am I missing in web application or what i have to add in web application to work it properly?
I can see in java project below two folders are created automatically:
1. target/generated-sources/cxf
2. target/generated-sources/cxf/schemaorg_apache_xmlbeans
But in web project only one folder is created:
1. target/generated-sources/cxf
target/generated-sources/cxf/schemaorg_apache_xmlbeans forlder is not created in web project. Please help me what is wrong in my project?
Experts please help me to resolve the issue.
Pleaase let me know if more information needed from my side.
Thanks and Regards,
Deepak
In the marker tab. i was getting "Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result" warning.
I Resolved it by doing following steps:
1. Right click on this warning and click on quick fix option
2. Select Mark the associated raw classpath entry as a publish/export dependency. And click on finish
I have maven dependency to import an external project jar. The jar is imported in my project by Maven and is present in my Libraries->Maven Dependencies.
I access a static method of a class present inside this Jar from one of my classes. When I do Maven build and run the project in Tomcat that is configured inside my Eclipse, it runs fine and the class and its method is accessible.
But when I deploy the war file build by Maven to external Tomcat server, I get
14-May-2017 14:40:31.631 SEVERE [http-nio-8080-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [apple] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.apple.fruit.security.client.TokenManager] with root cause
java.lang.NoClassDefFoundError: Could not initialize class com.apple.fruit.security.client.TokenManager
I accessed that war file and found that the war file contains that jar.
What am I doing wrong?
I am trying to build a facebook connector using facebook4j jar.
Whatever I have coded is working fine if I run the classes from eclipse directly, but if when I am trying to create a jar file of my connector which has facebook4j jar as well, and use it in some other Project, I am getting below error:
Exception in thread "main" java.lang.NoClassDefFoundError: facebook4j/FacebookException
at FacebookMain.main(FacebookMain.java:18)
Caused by: java.lang.ClassNotFoundException: facebook4j.FacebookException
I am creating jar file from eclipse only and have checked below option
Export generated class file and resource
Any guidance will be helpful.