Can’t find net.sf.exmorph.Morpher Should be org.kordamp.exmorph.Morpher?

Hi. My code dies. It can’t find the class it needs.

I don’t know Java all that well. Either the caller shouldn’t be looking for it at net.sf.ezmorph.Morpher, or I should supply Morpher at that location.

I have edited my library list, and re-inserted the ezmorph library. But it didn’t make any difference.

I thought MyEclipse was supposed to work out these details for me.

What am I doing wrong?

Oct 11, 2019 9:49:22 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [GetModels] in context with path [/EFM] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: net.sf.ezmorph.Morpher
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
at com.aaa.rap.fleet.GetModels.doPost(GetModels.java:36)

 

——

 

It’s likely that the dependencies haven’t been added in the right way. However, before we can provide further assistance, we need to know more about what you are actually doing:

1) What sort of project is this – a Java EE Web project? Is it a Maven based project (are you managing dependencies through Maven)?
2) What sever are you deploying to? From the stack trace, I’m assuming Apache Tomcat – if so, which version?
3) When & where do you see this error? When the server is starting up, in the Console?
4) What version of MyEclipse are you using? Please see Help > About for the build Id.
5) Can you share details on how and where you’ve edited the library list – a screenshot would help as well.

Thanks!

 

——

 

Answering in order.

1) What sort of project is this – a Java EE Web project? Is it a Maven based project (are you managing dependencies through Maven)?

I would say that’s exactly what it is. A Java EE Web project. A server runs at a port, and if you go to a certain localhost url, it shows you a Web page. The browser (Javascript) communicates with the server using Ajax. (My background is C++ servers and Javascript single-page applications.)

2) What sever are you deploying to? From the stack trace, I’m assuming Apache Tomcat – if so, which version?

It says “MyEclipse Tomcat v8.5”

3) When & where do you see this error? When the server is starting up, in the Console?

No. It runs fine, until I try to open a certain drop-down. Then, in the doPost method in the server, it tries to do this:

JSONObject responcedata = new JSONObject();

and that’s where it fails. I guess ezmorph must be involved in the JSONObject constructor.

4) What version of MyEclipse are you using? Please see Help > About for the build Id.

MyEclipse Enterprise Workbench

Version: CI 2018.9.0
Build id: 16.0.0-20180903

5) Can you share details on how and where you’ve edited the library list – a screenshot would help as well.

Ah. I am embarrassed by this part. There were some red x’s. We are constrained to use Java 5. I took two steps:

[1] I tried to activate the Maven dependencies piece, thinking Maven could sort it out for me. Still red x’s.

[2] I copied the .classpath from a project that didn’t have red x’s. That eliminated the red x’s.

But it failed at runtime.

I am including a screenshot of the project facets, as well as the java build path, because I have a feeling it might matter. Note that I have unchecked Maven Support – Dependencies Only.

——

 

Thank you for the details. Maven can help, but you do need to know at least a bit of Maven and configure the project correctly.

Here’s a quick suggestion:
1) Shut down the server and undeploy the project.
2) Remove all the JAR files from the Libraries tab and apply this change.
3) In your project, there will be a WEB-INF/lib folder. Physically copy all those library files into this folder. MyEclipse will automatically add them to the build path, so your project should compile fine. If you still see Red X’s … that would mean that you’re still missing some libraries and you shouldn’t bother with deployment until you resolve this.
The benefit of copying the JARs to the lib folder is that this will also ensure that the libraries are deployed to the server correctly.
4) Deploy the project and start the server.

Hopefully this will resolve the issues you are now facing, please let me know if this works!

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注