java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException in JBoss AS 7 - http

I am testing JBoss AS 7 prior to deployment with a .war file of an app running in a different server.
I get this error when I try to log onto the database via the app:
SEVERE [] (http--0.0.0.0-8080-4) java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException from [Module "deployment.app.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
In some forums, they suggest adding the commons-codec jar, but I already have it in JBoss, right? (in here: jboss-as-7.1.1.Final/modules/org/apache/commons/codec/main/commons-codec-1.4.jar)
OSGi is not activated, frankly I have no idea to what purpose it serves, but when I try to activate it it messes with my war as it fails to deploy...
I have JDK, but no JRE if that's any help.

JBoss AS 7 does not use OSGi by default for modular class loading. It uses JBoss Modules so this has nothing to do with OSGi.
What you need to do if you want to use the commons-codec provided with JBoss AS 7 is add a dependency to your deployment.

Modules are not visible by your artefact classes automatically. You have three possibilities:
Define a global module in your standalone.xml
http://javahowto.blogspot.de/2012/09/how-to-create-global-modules-in-jboss.html
This module will be used by all artefacts you are deploying on Jboss.
Put it into your war artefact, into the lib folder. You can do that with Maven.
Define an explicit dependency within your Manifest. https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7
Section Dependencies: Manifest Entries

Related

Need to provide addtional jars to for xsbt-web-plugin container

I am trying to run my war file using xsbt-web-plugin. My war itself does not contain tomcat-jdbc-pool jar and javax-servlet-api. I tried using container configuration. But sbt complains configuration does not exist.
If I use provided configuration, webapp-runner fails.
I am sure I am missing something. But unable to figure it out.
WARNING: Failed to register in JMX: [javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]]
What version of xsbt-web-plugin are you using? Can you post the contents of your sbt build configuration?
The Tomcat plugin in xsbt-web-plugin relies on webapp-runner, which does not appear to bundle the tomcat-jdbc library. You can add it via containerLibs in Tomcat:
enablePlugins(TomcatPlugin)
containerLibs in Tomcat += "org.apache.tomcat" % "tomcat-jdbc" % "8.5.15"

Automation_agent and qtp_air resource bundles not found when adding automation libs to AIR project

I'm trying to add the automation libraries to my project in Flash Builder so we can automate our testing.
I've added this to the additional compiler settings:
-include-libraries+="${flexlib}/libs/automation/automation.swc","${flexlib}/libs/automation/automation_agent.swc","${flexlib}/libs/automatio n/automation_dmv.swc","${flexlib}/libs/automation/automation_spark.swc ","${flexlib}/libs/automation/automation_air.swc","${flexlib}/libs/aut omation/automation_airspark.swc","${flexlib}/libs/automation/qtp_air.swc"
and -locale nl_BE fr_BE
After compiling this I get 2 errors:
Unable to resolve resource bundle "automation_agent"
Unable to resolve resource bundle "qtp_air"
However, in my nl_BE and fr_BE folders under flex_sdk\frameworks\locale\ the automation_agent_rb.swc and qtp_air_rb.swc are present.
If I switch to en_US, it works fine.
Can somebody explain to me why Flash Builder can't find these resource bundles?
Try explicitly adding automation_agent_rb.swc and qtp_air_rb.swc to your library-path as well.

Dependence wso2 application in $PATH/repository/components/lib/

I paste one jar in repository/components/lib/ as dependence, but the wso2app does not find it when accessing the service, it throws the exception:
java.lang.ClassNotFoundException: Class Not found : br.org.test.MyClassTest
How can I fix this? Where should I put the jars for dependencies?
Try putting the jar file in $CARBON_HOME/repository/components/extensions directory and do not forget to restart the server after adding the library.
Source: How to Add External Jar Libraries to WSO2 Carbon based Products.
After a long research i finally was able to solve this by putting my dependencies in /lib/runtimes/ext.
Following this documentation. https://docs.wso2.com/display/AS530/Configuring+Runtime+Environment

NoClassDefFoundError: org/jbox2d/collision/shapes/Shape in netbeans

I am trying to add jbox2d as a dependency to my project in netbeans (playn-jbox2d-1.1-SNAPSHOT.jar), but at run time, I get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jbox2d/collision/shapes/Shape
All other classes can be accessed fine, just not Shape.
I simply right clicked dependencies in my core directory and did add dependency and searched for jbox2d.
Anyone know what could be wrong?
What version of jbox2d do you have, as a dependency? You can crosscheck in the dependency jar file, if that class (Shape.class) exists or not?
EDIT: Most of the times, 'NoClassDefFoundError' happens due to incorrect classpath settings or when there's more than one class (or jar file) in the classpath, with the same namespace.

Liferay 6 on Glassfish 3.1 - issue using liferay-ui tags in portlet jsp files

We are seeing this issue on our current Glassfish 3.1 cluster setup. Below are details of issue
- We are running Glassfish version 3.1
We are running liferay 6.0.6
The liferay war is deployed on the Glassfish cluster and working fine on both the nodes.
The same liferay war works fine one Tomcat server as well.
When we deploy our custom portlets on Glassfish cluster it starts working immediately after deployment. (before doing a restart of glassfish cluster)
Once we do a restart of the cluster nodes the same portlet application stops working and Complains and give attached error.
My research till now shows that the java.lang.NoClassDefFoundError: com/liferay/portal/util/PropsValues is part of portal-impl.jar file which is part of liferay portal and should be made available to our portlet. Somehow after the restart the jar files are loaded in a different manner and the same jar file is not available to portlet.
We have also tried the Glassfish 3.1 Bundled liferay 6.1 setup and see the same issue on it as well.
As suggested by liferay forums we have placed the portal-service.jar and portlet.jar in [glassfish home]/lib directory.
when we do a lsof -p pid on the glassfish node instance process it shows the required jar file is open by this process. Not sure why is this not available to our application.
I would appreciate any help or pointers to resolve/investigate this issue.
java.lang.NoClassDefFoundError: com/liferay/portal/util/PropsValues
at org.apache.jsp.html.taglib.ui.search_005fiterator.page_jsp._jspService(page_jsp.java from :500)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:534) at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:323)
at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:418)
at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:92)
This is a related thread on liferay forum by me but I have not really got any response on it from anyone. [Same issue posted on liferay Forum]
i have also tried placing portal-impl.jar in my portlet/WEB-INF/lib dir (which is not recommended way) and I failed since it requires me to bring all other dependent jars in it too.
I am now running out of options and thinking about implementing the pagination feature using some other third party library instead of using liferay tags.
Here is the specific tag which is giving us error
<liferay-ui:search-iterator />
List of jars in my portlet WEB-INF/lib folder
SiebelClientWS-0.0.1-SNAPSHOT.jar
spring-asm-3.0.5.RELEASE.jar
XmlSchema-1.4.7.jar
spring-aspects-3.0.5.RELEASE.jar
aspectjrt-1.6.11.jar
spring-beans-3.0.5.RELEASE.jar
aspectjweaver-1.6.11.jar
spring-context-3.0.5.RELEASE.jar
axiom-api-1.2.11.jar
spring-context-support-3.0.5.RELEASE.jar
axiom-impl-1.2.11.jar
spring-core-3.0.5.RELEASE.jar
axis2-1.5.4.jar
spring-expression-3.0.5.RELEASE.jar
axis2-kernel-1.5.4.jar
spring-jdbc-3.0.5.RELEASE.jar
axis2-transport-http-1.5.4.jar
spring-tx-3.0.5.RELEASE.jar
axis2-transport-local-1.5.4.jar
spring-web-3.0.5.RELEASE.jar
c3p0-0.9.1.2.jar
spring-webmvc-3.0.5.RELEASE.jar
commons-codec-1.4.jar
spring-webmvc-portlet-3.0.5.RELEASE.jar
commons-httpclient-3.1.jar
util-bridges.jar
commons-logging.jar
util-java.jar
flexjson-2.1.jar
util-taglib.jar
httpcore-4.0.jar
woden-api-1.0M9.jar
httpcore-nio-4.0-beta1.jar
woden-impl-commons-1.0M9.jar
log4j.jar
woden-impl-dom-1.0M9.jar
neethi-2.0.2.jar
wsdl4j-1.6.2.jar
spring-aop-3.0.5.RELEASE.jar
wss4j-1.6.2.jar
I changed
/html/taglib/ui/search_paginator/page.jsp
/html/taglib/ui/search_iterator/page.jsp
/html/taglib/ui/page_iterator/start.jsp
and removed the calls to PropsValues and replaced them with calls to the com.liferay.portal.kernel.util.PropsUtil and PropsKeys instead and that go the rid of the error for me.
I made an improvement request
http://issues.liferay.com/browse/LPS-30660
com/liferay/portal/util/PropsValues is part of portal-impl.jar file which is part of liferay portal and should be made available to our portlet.
That is not true, portal-impl.jar is not available to your portlets and it is not meant to. You MUST NOT put it in your WEB-INF/lib. That jar is only available, and should be that way, to Liferay (liferay application).
Can you show contents (list of jars) of your (deployed) portlets WEB-INF/lib?

Resources