java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest - java

I am handling file uploads by a multipart filter as described here. I created a WAR file and deployed on Weblogic 10.3.3 server and got error:
<Dec 8, 2011 5:37:07 PM IST> <Error> <HTTP> <BEA-101020> <[ServletContext#26087289[app:playground module:playground.war path:/playground spec-version:null]] Servlet failed with Exception
java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContext;)Ljava/util/List;
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at net.balusc.webapp.MultipartFilter.parseRequest(MultipartFilter.java:169)
at net.balusc.webapp.MultipartFilter.doFilter(MultipartFilter.java:123)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
Truncated. see log file for complete stacktrace
Then I deployed same WAR file on Tomcat 7.0.11 server and it is successfully running. How is this caused and how can I deploy successfully on Weblogic?

Deployment on Weblogic 10.3.3 results in an error:
java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContext;)Ljava/util/List;
Deployment on Tomcat 7.0.11 is successful.
Weblogic already ships with Apache Commons FileUpload libraries. This error indicates that they are of an older version than which you have in /WEB-INF/lib.
You have at least 3 options:
Remove the JARs from /WEB-INF/lib.
Replace them by exactly the same version as Weblogic is using.
Change the Weblogic classloading policy to load classes from application first.

You can use following API to upload files to JBoss Server
http://commons.apache.org/fileupload/index.html

Check If your Jar Library has duplicate Jar files with Different versions.
Delete the old version file.

Related

Weblogic migration from 11g to 12c, missing libraries and failing deployment

We are migrating out project from java 6 to java 8, and as part of the migration we are upgrading weblogic server from 11g R1 to 12c R2.
There are some weblogic libraries missing in the new release, that our project seems to depend on. In particular, these libraries are
modules\com.oracle.ws.orawsdl_1.4.0.0.jar
modules\com.oracle.ws.http_client_1.4.0.0.jar
They are defined in the PRE_CLASSPATH variable on setDomainEnv.sh of the previous weblogic installation. I don't know what their purpose is and where they are used (is there some trick to track their usage in the project source?), and they can't be found with the new installation.
I tried to search them as such starting from the Oracle_home directory
find . -type f -iname "*orawsdl*"
./oracle_common/modules/com.oracle.webservices.orawsdl-api.jar
./oracle_common/plugins/maven/com/oracle/fmwshare/com.oracle.webservices.orawsdl-api/12.2.1/com.oracle.webservices.orawsdl-api-12.2.1.location
./oracle_common/plugins/maven/com/oracle/fmwshare/com.oracle.webservices.orawsdl-api/12.2.1/com.oracle.webservices.orawsdl-api-12.2.1.pom
./oracle_common/plugins/maven/com/oracle/fmwshare/oracle.webservices.orawsdl/12.2.1/oracle.webservices.orawsdl-12.2.1.pom
./oracle_common/plugins/maven/com/oracle/fmwshare/orawsdl/12.2.1/orawsdl-12.2.1.pom
./inventory/featuresets/resources/modules/orawsdl_12.2.1.2.0.jar
./inventory/featuresets/orawsdl_12.2.1.2.0.xml
./inventory/refcounts/featuresets/orawsdl_12.2.1.2.0.ref
./inventory/refcounts/components/oracle.webservices.orawsdl_12.2.1.2.0.ref
find . -type f -iname "*http_client*"
./oracle_common/http_client_12.jar
./oracle_common/modules/com.oracle.http_client.http_client.jar
./oracle_common/ccr/lib/http_client_12.jar
./oracle_common/ccr/lib/http_client_11116.jar
./oracle_common/plugins/maven/com/oracle/fmwshare/oracle.http_client/12.2.1/oracle.http_client-12.2.1.pom
./oracle_common/plugins/maven/com/oracle/fmwshare/com.oracle.http_client.http_client/12.2.1/com.oracle.http_client.http_client-12.2.1.pom
./oracle_common/plugins/maven/com/oracle/fmwshare/com.oracle.http_client.http_client/12.2.1/com.oracle.http_client.http_client-12.2.1.location
./oracle_common/http_client_11116.jar
./inventory/refcounts/components/oracle.http_client_12.2.1.2.0.ref
./oui/modules/http_client.jar
Nothing refers to the same package, but is some of these proper alternative?
Also, when I try to deploy to the new server installation, I get the following error.
java.lang.ClassNotFoundException: org.apache.commons.pool2.BasePooledObjectFactory
After dropping the apache commons-pool lib in weblogic classpath (Which was never needed in the previous installation), I get a different error
Unable to find policy: "usernamedigest.xml", please make sure to use dynamic wsdl when initializing the service stub
Important note
Deploy succeeds if I define metadata-complete=true to all web.xml files, but I'm sure this is not clever, as it may bypass some important configuration I'm not aware of. So how do I troubleshoot the cause of this problem?
I think it has something to do with how weblogic tries to take control of the web services it should not. In the project axis is used as the web service implementation. In the succeeded deployment (old weblogic, and new weblogic with metadata-complete=true set), only one web service is shown in under Web Services section of the deployment overview.
However, with the failed deployment (the userdigest.xml error) all web services are shown under this tab, as if weblogic tries to take control of them due to some annotation scanning, I guess.
Here is the error message from log file
<24.7.2017, 11:16:55,876 ap. EEST> <Error> <HTTP> <BEA-101216> <Servlet: "fi.sysopen.hekopassi.vrk.tv.TV_DATA2HekopassiImpl" failed to preload on startup in Web application: "/hekopassi".
javax.xml.ws.WebServiceException: Unable to find policy: "usernamedigest.xml", please make sure to use dynamic wsdl when initializing the service stub
at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$WLSTubelineAssemblerImpl.createServer(WLSTubelineAssemblerFactory.java:374)
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:193)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory$WLSEndpointImpl.<init>(WLSContainer.java:774)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory.create(WLSContainer.java:725)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:332)
Truncated. see log file for complete stacktrace
Caused By: Unable to find policy: "usernamedigest.xml", please make sure to use dynamic wsdl when initializing the service stub
at weblogic.wsee.policy.runtime.PolicyServer.loadPolicy(PolicyServer.java:183)
at weblogic.wsee.policy.runtime.PolicyServer.getPolicy(PolicyServer.java:118)
at weblogic.wsee.policy.deployment.PolicyRef.getPolicy(PolicyRef.java:216)
at weblogic.wsee.policy.deployment.PolicyReferenceWsdlExtension.getEffectivePolicy(PolicyReferenceWsdlExtension.java:129)
at weblogic.wsee.policy.deployment.WsdlPolicySubject.getEffectivePolicyFromWsdlExtensible(WsdlPolicySubject.java:489)
Truncated. see log file for complete stacktrace
>
INFO [OpenFrame] FrontEnd logging service shutdown completed
INFO [OpenFrame] FrontEnd logging service shutdown completed
INFO [OpenFrame] BackEnd Log4 Logging service is going down!
INFO [OpenFrame] BackEnd Logging service shutdown completed
<24.7.2017, 11:17:01,540 ap. EEST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application "hekopassi".
weblogic.application.ModuleException: Unable to find policy: "usernamedigest.xml", please make sure to use dynamic wsdl when initializing the service stub
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: Unable to find policy: "usernamedigest.xml", please make sure to use dynamic wsdl when initializing the service stub
at weblogic.wsee.policy.runtime.PolicyServer.loadPolicy(PolicyServer.java:183)
at weblogic.wsee.policy.runtime.PolicyServer.getPolicy(PolicyServer.java:118)
at weblogic.wsee.policy.deployment.PolicyRef.getPolicy(PolicyRef.java:216)
at weblogic.wsee.policy.deployment.PolicyReferenceWsdlExtension.getEffectivePolicy(PolicyReferenceWsdlExtension.java:129)
at weblogic.wsee.policy.deployment.WsdlPolicySubject.getEffectivePolicyFromWsdlExtensible(WsdlPolicySubject.java:489)
Truncated. see log file for complete stacktrace

Failure deploying RESTful web service application using IntelliJ IDEA

I am trying to create a simple RESTful web service on IntelliJ IDEA and I am now encountering the following error:
The content of element 'application' is not complete. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":initialize-in-order, "http://java.sun.com/xml/ns/javaee":module}
I believe these elements were not needed inside my application.xml before, then suddenly I encountered this problem when deploying.
I have the javaEEApplication and Web facets enabled in my project, the deployment descriptors seem to be set up correctly as well. I am referencing Jersey-2.2 as a library to use the RESTful services. My project also has GlassFish 4.1.1 - RESTful Web Service as a dependency.
I am using a Exploded artifact autogenerated from modules, and the run configuration is set to build then build artifacts. The credentials for the glassfish admin are correct.
I'm wondering why I am suddenly encountering this problem, I though that IntelliJ would auto generate any necessary content inside the deployment descriptor (application.xml) that it needed. Does anyone have any idea what I am missing? Perhaps I have to reference Java EE 6 or 7 as a library itself? I'm lost here.
Full error log below just in case:
"C:\Program Files (x86)\glassfish4\glassfish\bin\asadmin.bat" start-domain domain1
"C:\Program Files\Java\jdk1.8.0_77\bin\java" -Dfile.encoding=windows-1252 -classpath "C:\Program Files (x86)\glassfish4\glassfish\modules\javax.ejb-api.jar;C:\Program Files.....
[2017-02-05 03:16:49,423] Artifact CapstoneIntelliJProject:war exploded: Server is not connected. Deploy is not available.
Detected server admin port: 4848
Detected server http port: 8080
Attempting to start domain1.... Please look at the server log for more details.....
Connected to server
[2017-02-05 03:16:52,358] Artifact CapstoneIntelliJProject:war exploded: Artifact is being deployed, please wait...
[2017-02-05 03:16:53,536] Artifact CapstoneIntelliJProject:war exploded: Error during artifact deployment. See server log for details.
[2017-02-05 03:16:53,537] Artifact CapstoneIntelliJProject:war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while deploying the app [CapstoneIntelliJProject_war_exploded] : org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 15; Deployment descriptor file META-INF/application.xml in archive [CapstoneIntelliJProject_war_exploded]. cvc-complex-type.2.4.b: The content of element 'application' is not complete. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":initialize-in-order, "http://java.sun.com/xml/ns/javaee":module}' is expected.. Please see server.log for more details.
"C:\Program Files (x86)\glassfish4\glassfish\bin\asadmin.bat" stop-domain domain1
Process finished with exit code 0
Waiting for the domain to stop .
Command stop-domain executed successfully.
Disconnected from server
Edit: I have solved this particular issue, having the javaEEapplication facet enabled for the project was a mistake, as it is only a restful web service. Now I face a new problem where the output is telling me Application [CapstoneIntelliJProject_war_exploded] contains no valid components. . The server log doesn't contain any useful information. I'm not sure what is wrong with my war, it seems to be configured fine.
I have solved the war exploded issue by recreating the war

Solr Deployment on Websphere 8.5.5 as WAR application

I am installing solr on WAS 8.5.5 with IBM jdk 7.
I deployed the solr as a war and added solr.data.dir and solr.solr.home to custom properties.
Upon accessing the url: http://localhost:9080/solr,
I see the below error on the browser:
Error 500: javax.servlet.ServletException: Filter [SolrRequestFilter]: org.apache.solr.servlet.SolrDispatchFilter was found, but is missing another required class
And the following error in the logs:
SRVE0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: java.lang.NoClassDefFoundError: org.apache.solr.servlet.SolrDispatchFilter (initialization failure) at java.lang.J9VMInternals.initialize(J9VMInternals.java:176) at java.lang.J9VMInternals.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1600) at java.beans.Beans.instantiate(Beans.java:241) at java.beans.Beans.instantiate(Beans.java:89) at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:533) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:475) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:308) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:380) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:892) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025).....
The lib folder of WEB-INF do contain the solr dependencies
Any Help from anybody ?
After scratching my head for 48 hours, finally able to make SOLR up and running on WebSphere.
Looks like the whole fundamental is to understand the class loading strategy on WAS8, and hence choosing the right strategy.
Have enumerated the different steps for solr deployment on WAS 8
Solr Deployment on WebSphere 8.5.5

error embedding a war into a jetty

I tried this example of an embedding war into a jetty.
When I debug on eclipse everything its ok and the webservices is deployed fine in port 8080, but when I make a jar with this program and put into a server (I tried into a tomcat 5.5 and into a jetty 7.4.1) when I start the program, when I started the jetty server appears this exception:
7641 [qtp21021313-35] ERROR configuration.EngineConfigurationFactoryServlet - Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsdd
7641 [qtp21021313-35] WARN configuration.EngineConfigurationFactoryServlet - Unable to load/create servlet engine config file, attempting internal default (from jar).
Only the default webservices methos are deployed (AdminService and Version)
The wsdd its fine. If I deploy this war into a server it works perfectly
You should run the java code without the servlet container (Tomcat/Jetty), you have the jetty server embedded, that's why in eclipse the code works fine.
Jetty's slogan:
"Don't deploy your application in Jetty, deploy Jetty in your application."
You should check this tutorial:
http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
For more info:
http://wiki.eclipse.org/Jetty/Howto/Deploy_Web_Applications

tomcat5 fails to start on CentOS 5 with NoClassDefFoundError exception

Tomcat fails to start even if i remove all my applications from the WEBAPPS directory leaving everything just like after the OS installation.
The log (catalina.out) says:
Using CATALINA_BASE: /usr/share/tomcat5
Using CATALINA_HOME: /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
Created MBeanServer with ID: -dpv07y:fl4s82vl.0:hydrogenium.timberlinecolorado.com:1
java.lang.NoClassDefFoundError: org.apache.catalina.core.StandardService
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.newInstance(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.init(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.modeler.Registry not found in org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/server/classes/,file:/usr/share/java/tomcat5/catalina-cluster-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-storeconfig-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-optional-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-coyote-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-jkstatus-ant-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-ajp-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-default-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-invoker-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-ant-jmx-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-http-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-util-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-apr-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/servlets-webdav-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-5.5.23.jar], parent=org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/common/classes/,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-ja.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-fr.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-en.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-es.jar,file:/usr/share/java/tomcat5/naming-resources-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/naming-factory-5.5.23.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib/jvm/java/lib/tools.jar,file:/usr/share/tomcat5/bin/bootstrap.jar,file:/usr/share/tomcat5/bin/commons-logging-api.jar,file:/usr/share/java/mx4j/mx4j-impl.jar,file:/usr/share/java/mx4j/mx4j-jmx.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
...5 more
Seems like you've implemented a JMX service and tried to install it on your server.xml file but forgot to add the apache commons modeler jar to the server/lib directory (therefore the ClassNotFoundException for org.apache.commons.modeler.Registry). Check your server.xml file for anything you might have added, and try to add the proper jar file to your server classpath.
This screams class path issue, to me. Where exactly is your tomcat installed? (Give us command line printouts of where the home directory is.) Also, how are you starting it?
Seems like you need to have the jar for commons-modeler into $CATALINA_HOME/common/lib. You get the same kind of error when trying to setup JDBC datasources if you didn't put the driver's jar file into tomcat's server classpath.
Check your JAVA_HOME/JRE_HOME setting. You might want to use a different JVM rather than the one that is installed with the OS

Categories