I have a problem that I can't figure out.
Context :
was 7.0.0.19 version (with no preCompileJsp)
Caused by: java.lang.NoClassDefFoundError: org/apache/jsp/_xxx (wrong name: com/ibm/_jsp/_xxx) at java.lang.ClassLoader.defineClassImpl(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:275) at java.lang.ClassLoader.defineClass(ClassLoader.java:212) at com.ibm.ws.jsp.webcontainerext.JSPExtensionClassLoader.defClass(JSPExtensionClassLoader.java:181) at com.ibm.ws.jsp.webcontainerext.JSPExtensionClassLoader._loadClass(JSPExtensionClassLoader.java:133)
It's the only JSP that give problem, and only on a specific environment (no problem on the others environments with the same configuration) the xxx.class is well present in my profile/tmp directory with others jsp in the same directory (that all give no problem) and the filesystem is not full.
Tests
I did a copy of xxx.jsp to xxxNew.jsp in the same directory
I can access the xxxNew.jsp without any problem (so there is no coding problem)
So I did a mv from xxx.jsp to xxx1.jsp and had no problem to access the jsp new named
I deleted the xxx.class in the tmp directory
I did the mv back to the first name (xxx.jsp) and still get the error with a newly xxx.class in the tmp directory.
Is there a class cache anywhere in websphere that could explain this ? (no cachespec.xml for dynacache found in the war module).
Why Websphere try to find a class from the org.apache.jsp package and not from com.ibm._jsp ? (how the AS choose the mapping from the URL to the classes ?)
Thxs !
Make sure you are not including in your webapp classpath any JSP engine or other implementation of standard JSP libraries that might be incompatible with WebSphere's runtime. Also, once you delete all potentially incompatible jars, try deleting the generated classes from JSP compilation (which are under {WAS_HOME}/AppServer/profiles/{YOUR_PROFILE}/temp), so recompilation would be triggered and discard any stale .class generated with a previous classpath state.
It would be helpful if you posted the list of JARs in your app's classpath.
Try changing the web application class loading policy on the WAS console: PARENT_FIRST / PARENT_LAST.
this bug is due to websphere incorrect log : the original exception is not displayed.
You should check for instance if there is no missing jsp tag libraries in your page.
See https://www-01.ibm.com/support/docview.wss?uid=swg1PI09596
Regards.
Related
The projet work fine in tomcat localhost but when I upload it in a remote tomcat I get this bug :/ , I have the jar that contain the ImageReaderFactory class in classpath, I didn't understand what can be the problem,
I cleared the /tomcat/work/Catalina/localhost folder but always the same bug : java.lang.NoClassDefFoundError
07-Oct-2019 23:06:25.584 SEVERE [http-apr-8080-exec-267] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [UploadServlet] in context with path [/MyServer] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoClassDefFoundError: org/dcm4che3/imageio/codec/ImageReaderFactory
at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.setMetadata(DicomImageReader.java:794)
at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.readMetadata(DicomImageReader.java:713)
at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.read(DicomImageReader.java:452)
at com.project.dicomserver.UploadServlet.getFrameIcon(UploadServlet.java:86)
....
Does anyone have any ideas?
image
There is a bunch of things that could be go wrong in your specific case. So answering with the best of my knowledge. Make amendments, by adding as much details as possible, to the question and we can help you further.
Every application in tomcat needs to have a specific folder structure. The folder structure is documented here. In short, war files must be deployed into $CATALINA_BASE/webapps/ directory.
So if your application is "myapp", then there must be a $CATALINA_BASE/webapps/myapp directory.
Inside $CATALINA_BASE/webapps/myapp directory, we need to have WEB-INF. Not $CATALINA_BASE/webapps/myapp/WebContent/WEB-INF, but $CATALINA_BASE/webapps/myapp/WEB-INF ! And the case matters.
If this is not how your application is deployed into a vanilla tomcat, it will not work properly. Read the official documentation
Now about your development environment, see whether your eclipse configurations have been modified. The Export As War options can be modified at multiple locations and all of them can have impact on the war file you have generated. When in doubt, I look at this link
Use a build tool like maven or gradle. These tools bring standards for compiling, archiving, testing and deploying applications and makes you worry less on environment related issues.
I get this error in a Java maven project. The weird thing is, it doesn't appear on every machine so I assume it has something to do with a configuration issue.
The class RoleKeyCacheImpl is a #Startup #Singleton:
#Startup
#Singleton
public class RoleKeyCacheImpl implements RoleKeyCache { ... }
That's the error Wildfly triggers when deploying the service.
Caused by: java.lang.IllegalArgumentException: WFLYEE0040: A component
named 'RoleKeyCacheImpl' is already defined in this module at
org.jboss.as.ee.component.EEModuleDescription.addComponent(EEModuleDescription.java:167)
at
org.jboss.as.ejb3.deployment.processors.EJBComponentDescriptionFactory.addComponent(EJBComponentDescriptionFactory.java:58)
I've tried:
installing a new Wildfly (V10, V13) on the same machine -> doesn't help
installing a completely new Eclipse on this machine -> doesn't help
cleaning & rebuilding all related projects
making sure the deployments-folder is empty and doesn't contain old versions of the same WAR
read the related question here which also didn't help (they use Spring): A component named 'XXX' is already defined in this module in JBoss 7.1.1
read and tried this q&a: Wrong dependencies with EJB in JBoss Wildfly (server-clean) -> doesn't help
deleted and rebuilt the local maven rep (".m2") -> no effect
checking out the same source on another computer -> does work on one machine, on another it gives the same error
I have absolutely no clue what the issue is or even could be. On one machine, we check it out and it runs without errors. On others, the exact same error happens.
Does anybody have an idea?
I had this same issue multiple times with EAP 7.1 and now again with WildFly 21.0.0. I know by experience this is an issue caused by Eclipse who tries to deploy automatically to a configured WildFly instance. During the deployment (or undeployment) some concurrent file issue arises and files who should be removed, are still on the filesystem, causing this error that a component is already defined.
In fact it is not already defined, it is just WildFly that is confused because it finds in his temporary directories some old files which shouldn't be there and reference your exact same component.
Solution: remove in the WildFly standalone directory the content in the 'deployments' directory and the 'tmp' directory. Rest assured, all what is there is okay to remove safely. Reboot and the error message will be gone ;-)
You should pay attention to not have two #Stateless EJB annotations on top of two classes with the same name - in the same module.
You may differentiate them by using the name attribute in the annotation and put different values in each class
Looks like the class already exists. Check if it does...you may have to rewrite that part of EEModuleDescription to use its own private methods (which would be what you would write) rather than overriding methods in RoleKeyCacheImpl. If the class actually does not exist then right-click on the project -> Maven 2 Tools -> Generate Eclipse Artifacts (Check for Updates). That will regenerate all of the dependencies that the project uses. Also please be sure that you have not added any new projects to the classpath by mistake as that may also cause this error.
I just ran into this today when a colleague added a maven dependency.
Turns out this dependency was a jar with a nasty classpath entry or "../" in the manifest.
I edited the jar's manifest.mf that was cached in my local maven repository using 7-zip and removed the "../" classpath entry.
Then re-packaged my war file (maven clean install) and bingo, it works!
In my case it was caused by org.libreoffice jurt version 5.4.2 (but other versions I checked also have the classpath nastiness).
Unfortunately I was lucky we pinpointed it to a dependency, YMMV!
Error in Console:-
Initial SessionFactory creation failed.java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException
Hello
I am building a standalone Java Application with Main Method which connects to the database using Hibernate and writes to a file on C drive as well.
I have added all the libraries to the class path using Java Build Path configuration and user libraries. But I keep getting this error ...I have also added the javaee jar from the glassfish server libraries but that has also not solved the problem. I also have the jboss-transaction-api_1.1_spec-1.0.0.Final.Jar added to my class path.
Please advise as I am not using Maven as yet ???
Here are the jars in my build path-
-antlr
-c3p0
-commons-collections
-commons-logging
-commong-logging-api
-dom4j
-hibernate-c3p0
-hibernate-commons-annotation
-hibernate-core
-hibernate-entitymanager
-hibernate-envers
-hibernate-jpa
-javaee-api-6.0jar
-javaassist
-jboss-logging
-jboss-transaction-api
-jms
-log4j
-lucene-core
-MySQL-connector
-slf4j
-javaee.jar
Any help would be truly appreciated .. I am just lost on what is going on ?
I am sure you have 2 different versions for the same class. check your jars.
I'm working on a java project with spring on eclipse using Maven, and running on a Tomcat server v6.0. Everything was working fine since yesterday morning.
Here his my problem : I'm building my project, I got a build success. Then I start my Tomcat server and got this error :
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:applicationContext- core.xml]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext-core.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext-core.xml] cannot be opened because it does not exist
I found out similar problem on some website but none of them give me a solution that worked for me.
It seems that eclipse isn't able to find applicationContext-core.xml when I'm doing this :
<import resource="classpath:applicationContext-core.xml" />
However, I do have the needed jar file nad-core-0.0.1-SNAPSHOT.jar in WEB-INF/lib containing applicationContext-core.xml.
I even tried to add it manually to the classpath but I was still having the same problem.
I keep on looking for a solution, when suddendly it work again once after restarting Eclipse and building while Eclipse was still updating indexes and my project was having this strange status Hg status pending instead of default. Surprised by this result I decide to build again my project after restarting Eclipse and I got the error again and I enable to make it work again. It's quite annoying...
This looks to be a really random problem.
Thanks a lot for your help :)
As you've not specified you web application structure. I assume you've a simple web application at hand with the following structures
webapp
WEB-INF/classes/applicationContext.xml
WEB-INF/lib/nad-core-0.0.1-SNAPSHOT.jar/applicationContext-core.xml
Application context.xml refers to the applicationContext-core.xml file using the import tag. I did encounter a similar situation in my web application, here're the check lists that you should go through and may be one of them can apply to your situation.
Check the generated snapshot jar file for the applicationContext-core.xml file and make sure it is in the root directory of the jar. As silly as it sounds, this was the root cause of the issue I faced in my deployment.
Make sure your Maven Pom.xml file is configured to include this XML file from the resources folder. You can use the resource tags in the build phase of Maven to package them within the jar file itself.
You can try removing the import tag from application context.xml file and instead load both of them from Spring's webapplication context itself.
Add a context loader listener class from spring org.springframework.web.context.ContextLoaderListener
Add context-param contextConfigLocation with value classpath:applicationContext-core.xml,classpath:applicationContext.xml. Spring has the ability to dynamically sort out the dependencies before initiating the bean factory.
Hope this check list helps.
I get pretty much the same config, six years later, I got the same error.
I also restart Eclipse, and it solved the issue.
I am running a Junit (SpringJUnit4ClassRunner) to access some spring beans in my integration test.
I need to load a few xml files via #ContextConfiguration, those files are deployed by a external approach to my Tomcat directly via a jar file. -- In other words, these files are in:
my_tomcat_home_path/webapps//WEB-INF/lib/external.jar
such as
my_tomcat_home_path/webapps//WEB-INF/lib/external.jar/a.suffix.xml
my_tomcat_home_path/webapps//WEB-INF/lib/external.jar/b.suffix.xml
...
I put Tomcat path into my eclipse classpath, then if I also include the that into my eclipse classpath, then the following code in my JUnit works
#ContextConfiguration(locations = {"classpath:*suffix.xml"})
However, if I don't put that into my eclipse classpath (because the jar file name may change from time to time), then my following code does NOT work (but Tomcat home "" is still in eclipse classpath):
#ContextConfiguration(locations = {"classpath:/webapps/<my_app>/WEB-INF/lib/external.jar/*suffix.xml"})
Could somebody please help me out?
Thanks a lot!!
Additional try -------------------------------
I tried to use the package path inside the jar, instead of using the external.jar itself. The the code looks like the following:
#ContextConfiguration(locations = {"classpath:/webapps/<my_app>/WEB-INF/lib/path_inside_the_external_jar/*suffix.xml"})
In this case, I no longer get "XML not found because file does not exist" problem. Instead, I get the following errors:
Caused by: java.io.FileNotFoundException: class path resource [webapps/my_app/WEB-INF/lib/path_inside_the_external_jar/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:163)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:406)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:338)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:276)
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1018)
at org.springframework.context.support.GenericApplicationContext.getResources(GenericApplicationContext.java:192)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177)
... 23 more
Thanks a lot to Didxga's help!!
I tried to remove the "/webapps//WEB-INF/lib", and only leave the package path to the *suffix.xml (which are actually *.hbm.xml), then the #ContextConfiguration(locations looks like the following:
"classpath:/internal_path_within_jar/*hbm.xml"
at first, which is still not working.
Afterward, I tried the modify the classpath pattern and the following code ALMOST works
"classpath*:/internal_path_within_jar/*hbm.xml"
This time, since hbm.xml files are loaded, and I get the following error:
Caused by: java.net.UnknownHostException: hibernate.sourceforge.net
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:208)
at sun.net.www.http.HttpClient.New(HttpClient.java:291)
at sun.net.www.http.HttpClient.New(HttpClient.java:310)
However, I think now it is a different problem because it is hibernate DTD load problem... Maybe I should NOT load hbm.xml in this approach... I was forced to do so, because those hbm.xml files are generated during the deployment progress of my application and will only appear in the Tomcat's websapp/my_app/external.jar and NOwhere else...
Hmm, so I need work on that part... but how to include a jar into my eclipse path with changing name but a certain pattern? Such as *-dao.jar. OMG...
Anyway, I suppose the problem reported in this post should be resolved.
Thanks a lot, didxga!