I'm using some third party jar file, there are plenty of Jar files as well, and I have the code written by someone else.
While executing, I'm geting this error:
java.lang.ClassCastException : org.apache.axis.client.Service cannot be cast to org.apache.axis.client.Service
Can you suggest me what could be the problem?
Thanks for the reply.
But before getting this error, I was getting:
java.lang.LinkageError : loader constraint violation: when resolving method "org.onvif.www.ver10.device.wsdl.DeviceBindingStub.(Ljava/net/URL;Ljavax/xml/rpc/Service;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/abcd/efgh/ijkl/device/onvif/DeviceHandlerClient, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/onvif/www/ver10/device/wsdl/DeviceBindingStub, have different Class objects for the type javax/xml/rpc/Service used in the signature.
The problem has not resolved yet. I'm not getting where the version mismatch of files/jar is happening from. I have included some Jars manually.
You likely have the Service class being sourced from two different class loaders. A classes identity is a combination of its name and the class loader that loaded the class.
As a contrived example, you could have two web apps deployed in something like Tomcat. They each have a copy of the same jar, and each loads their own instance of a class. Since they're in separate WARs, however, they each have different class loaders.
Next, lets say that you have something global, like a caching library or something. This caching module has its jar not within an individual WAR, but on the system class path for the container, that way it's visible to both WARs.
Web app 1 stores an instance of the class in to the cache, and then web app 2 tries to load that instance and cast it to its local version of the class. But since it's from the other web app, it has a different class loader than web app 2's. Thus when it's trying to cast the instance, it fails because it's not web app 2's version of that class.
So, basically, you have some kind of class loader confusion happening here. Make sure you have a clear understanding of what jars you're using, ensuring that there aren't any unnecessary duplications, and what context is loading what classes.
Related
I am beginner to play scala framework. And I have created simple CRUD operation using it.
In my routes file I have declared all the necesary urls for different actions.
I want to know if user input some wrong url path from browser How should I display error page in play scala? Right now I am getting all the routes which are already defined.
I just found a solution for it
https://www.playframework.com/documentation/2.8.x/ScalaErrorHandling
this is the latest play scala documentation which handles such type of condition.
Since I am using runtime dependency injection (e.g. Guice), the error handler can be dynamically loaded at runtime.
The simplest way is to create a class in the root package called ErrorHandler that implements HttpErrorHandler.
If you place your error handler in the root package (i.e. package-less) and name it ErrorHandler, Play will use it by default.
But, in case you want to:
Add it inside a package;
Configure different error handlers for different environments;
Then add in application.conf the configuration property play.http.errorHandler pointing to your custom error handler class:
play.http.errorHandler = "com.example.ErrorHandler"
My app uses a file created with NSKeyArchiver, it has a reference to an object that is contained in an external Framework. The external Framework is no longer is available in the app Xcode project. So when I attempt to load the archive file, the app will crash when attempting to resolve the type of this object. i.e MyMobileKit_Token
I was wondering if it's possible to create a 'local' instance of the object type in the app, then using the typealias fool the unarchive operation to reference the local type i.e Token
Or would I have to create a new 'proxy' Framework project with this one class and add the proxy framework to my app project keeping the naming of the framework and class exactly the same.
Any ideas?
Thanks
Aha, I found the answer. I created a class called Token with the same properties in the framework. Then I added the following line before opening the archive file:
NSKeyedUnarchiver.setClass(Token.self, forClassName: "MyMobileKit.Token")
Seemed to work out.
I want to create new companent in ATG. And if I forward to Browser Companent page, then I have 404 error. How I can fix this?
I assume that you have created a new component by creating a .properties file. The things to look for are
Is the file in an appropriate config layer? i.e. is it in a location on the configpath, such as the config directory of a module, or the localconfig directory of a server, where the application expects to look for .properties files?
Is the file a valid .properties file and properly formatted?
Is the class mentioned in the $class property correct, valid and fully qualified (package name and class name)
Has the named class been compiled successfully?
Is the named class available on the classpath? i.e. is it in the classes.jar of a module or in the classes directory (if that is how the module's class path has been defined?
Is the class a valid JavaBean - particularly, does it have a no-argument constructor?
Have you compiled, built and assembled your ATG application since creating this new component?
Have you restarted your ATG application since creating this new component?
Assuming this is all correct and yet you still cannot see your component, the next step is to troubleshoot why it is not visible.
Is the path to your component you are using in the dyn/admin component browser correct?
If the path is correct, and you still see an error in the browser, then take a look at the server logs (for around the time you first tried to access the component) - you might see an error or a sequence of errors telling you why the server could not instantiate the component
Can you go to the containing folder and see if the component is listed there - though it is OK if you cannot because it may not have been started if nothing is referencing it
Can you see your component in the ACC. Start the ACC, and go to View Components by Path and navigate to were you think your component should be. Can you see it there? If so, it means that your properties file is OK.
In the ACC, When you click on the puzzle-piece icon that represents your component, does it show it as being an instance of your class or as an instance of Object. If Object, it means that it cannot determine the class of the component
In the ACC, double-click the component and try to start it. Keep looking at the server logs as you do so
This should help you get to the bottom of things.
I made a bundle target, and its Info.plist file specifies that a very specific class (let's call it PrincipalClass) should be its principal class. This class was written in Swift and has the #objc attribute. The Info.plist file is correctly copied over to the bundle, and I have cleaned and rebuilt the project multiple times already.
However, when I load the bundle from my Swift framework, its principal class is a different class (let's call it NotPrincipalClass). It was not marked #objc, and in fact, it should be internal to the bundle. I checked bundle.bundleURL in the debugger, and the Info.plist file in the bundle does say that it should be PrincipalClass; but when I check bundle.infoDictionary, the NSPrincipalClass attribute reads NotPrincipalClass as a string! (The info dictionary also contains several keys that were not specified by the Info.plist file, like DTCompiler and such.)
If I entirely remove NotPrincipalClass, I get another internal class instead, which is still totally not my principal class.
I checked the build logs thoroughly and I saw no mention of NotPrincipalClass, except when it got compiled.
What could cause this? What can I do to solve it?
Somehow, using its qualified name instead ("PlugInNamespace.PrincipalClass") solved the problem, but this has me very skeptical because I have another plugin that does not requires this.
I'm using JBoss 4.2.3, EJB2, XDoclet and have deployed one EAR with the EJBs in it, and other EARs with various websites in them.
When trying to access an EJB from one of the websites, I get NoClassDefFoundError.
It seems that the lookup is successful. I can see, for example, that getContext().lookup(SecurityServiceRemoteHome.JNDI_NAME) returns something of class "$Proxy266". I also see in JBoss's JNDI View this binding:
remote (proxy: $Proxy266 implements interface com.icumed.ifactory.service.session.SecurityServiceRemoteHome,interface javax.ejb.Handle)
FYI, SecurityServiceRemoteHome.JNDI_NAME = "ejb/ifactory/SecurityService/remote"
Right after the lookup, I call this, which is where the error is thrown:
home = (SecurityServiceRemoteHome)PortableRemoteObject.narrow(obj,
SecurityServiceRemoteHome.class);
I've heard that this might be unnecessary and I can just do a straight type conversion here, but I don't think that's the problem. From what I've read on the web so far, it seems like maybe the SecurityServiceRemoteHome cannot be fully loaded. Perhaps some ancillary classes are missing? I don't see any errors indicating this, though. What's the best way to go about debugging this?
After even more digging around, I found the answer. It has to do with the jboss-app.xml file and the loader-repository element. The background is that I previously had one complete EAR file with all the WARs and EJBs in it. I have decided to break them apart, and when I did so, I modified the jboss-app.xml files so that the archive name was different for each one. That was wrong. They must be the same between the EAR for the EJBs and the EARs for the WARs (Yes, I don't really need an EAR file if it's just a WAR...except on OC4J). Furthermore, I must have the loader-repository element present with an archive name. Leaving that out causes other problems.