Weblogic CGIServlet NoClassDefFoundError - cgi

I'm trying to configure CGI Servlet in weblogic. I have a simple war to test it. I have nothing special in web.xml, just a simple config:
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/tmp/scripts</param-value>
</init-param>
<init-param>
<param-name>*.py</param-name>
<param-value>/usr/bin/python</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/config/*</url-pattern>
</servlet-mapping>
and in server.xml
<prefer-web-inf-classes>false</prefer-web-inf-classes>
When I try to access localhost/cgitest/config/test.py
I'm getting an exception in logs of the server:
java.lang.NoClassDefFoundError: Could not initialize class weblogic.servlet.Env
at weblogic.servlet.CGIServlet.init(CGIServlet.java:72)
As I see, weblogic.servlet.Env is a part of weblogic.jar and it is present in the lib folder of the server. Maybe the server is somehow misconfigured. (WebLogic Server Version: 12.1.1.0)
I would appreciate any hints on finding the issue behind this. Thanks.

Just for the sake of the completeness. When you request the CGIServlet for the first time (e.g. GET /cgi-bin/hello-world.sh), you will see an exception like this one:
java.lang.UnsatisfiedLinkError: /home/lurodrig/development/servers/wls1221/wls12210/wlserver/server/native/linux/x86_64/libwlenv.so: libstdc++.so.5: cannot open shared object file: No such file or directory
Installing that library solves the issue. E.g. in ubuntu $sudo apt-get install libstdc++5
<CGIServletSH: Exec script with args :[/bin/sh, /tmp/cgi-bin/hello-world.sh]>
Hope it helps,
Luis
BTW: thanks #damian for the hint about the C library

Related

Richfaces Resource Optimization settings in RF 4.0.0-Final

I'm attempting to turn on resource optimization (packing) for my applicaiton using RF 4.0.0 running under JBoss 6.1.0
I know that the means to turn this on changed from RF 3.x to RF 4.x (https://community.jboss.org/wiki/RichFacesMigrationGuide33x-4xMigration-Upgrading)
The problem is neither the 3.x means or the 4.x means seem to work with the 4.0.0-Final version.
I'm also using skinning (blueSky) and have seen posts that indicate that packing doesn't work with a skinned application.
In my web.xml I've inserted both sets of configuration parameters, but the app refuses to pack and compress all of the RF .js and .css files
<context-param>
<param-name>org.richfaces.resourceOptimization.enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
I think I may have found the answer ... for RF 4.0.0.Final version there is no support for either set of optimization settings.
Here's a relevant post:
https://community.jboss.org/message/605001
To solve the problem I've upgraded to the latest (as of this date) 4.X version which is 4.3.4.
If someone can answer this to the contrary let me know.
As an aside, the only compatability issues I've found so far going from 4.0.0.Final to 4.3.4.Final are:
- I needed to add switchType="client" to some rich:accordian components that did not specify a switch type.
I still need to do more testing

intellij11 error when redeploying static files to jetty

all.
I got exactly same scenario like this one - Jetty Maven Plugin is ignoring custom webdefault.xml
the only difference is that I try to deploy my app to local jetty8 inside intellij11 on windows 7
the error is
Error copying 'myproj\src\main\webapp\less\defaults.less' to 'myproj\target\myproj.war
\less\defaults.less'.: myproj\target\myproj.war\less\defaults.less
(The requested operation cannot be performed on a file with a user-mapped section open)
I updated the webdefault.xml and set useFileMappedBuffer to false and later again I added in my filter config in web.xml which should also override the default but nothing helps.
I start jetty with default etc/jetty-jmx.xml.
what am I missing?
finally I managed to solve the issue.
following this page http://wiki.eclipse.org/Jetty/Howto/Deal_with_Locked_Windows_Files, unfortunately this page is outdated and the only way to keep resources unlocked, that worked for me, is
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
note that package have changed to org.eclipse.jetty since 7th version. the other solutions seems to be broken as jetty doesnt recognize context ref or throws other exceptions.
hope that this will help someone.

Where do I find the environment entry mapping screen in Weblogic?

I am trying to migrate an application from OC4J to Weblogic, but I can not find the environment entry mapping screen in Weblogic 12c.
Is there one? If so, where is it? If not, how do I do it?
Our app has the following values in the web.xml:
<env-entry>
<env-entry-name>SERVLET_PATH</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
<env-entry>
<env-entry-name>USER</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
<env-entry>
<env-entry-name>PASSWORD</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
In OC4J these can been seen in the Environment Entry Mappings screen. (Also I can see them in Websphere under the Environment entries for Web modules screen)
Thanks
[Edit]
Thanks to JoseK I was able to find the answer.
Once I had created the plan.xml, I found out that I need to add a and a to the plan.xml:
<variable-definition>
<variable>
<name>SERVLET_PATH</name>
<value>http://203.15.228.111:7001/RailExchangeServlet/servlet/RailExchangeServlet</value>
</variable>
</variable-definition>
...
<module-descriptor external="false">
<root-element>web-app</root-element>
<uri>WEB-INF/web.xml</uri>
<variable-assignment>
<name>SERVLET_PATH</name> <!-- this links to the variable-definition name -->
<xpath>/web-app/env-entry[env-entry-name="SERVLET_PATH"]/env-entry-value</xpath>
</variable-assignment>
</module-descriptor>
</module-override>
In earlier versions of Weblogic you could view and edit the web.xml values from the console.
In WL10 onwards you don't get to view this from the console, and instead there is a concept of a Deployment Plan (saved on filesystem as Plan.xml)
In that file you can specify over-riding values on the web.xml which will change from env to env.
An example is here
http://biemond.blogspot.in/2009/04/using-weblogic-deployment-plan-to.html
https://forums.oracle.com/forums/thread.jspa?threadID=1107834&tstart=0
and some reading
http://docs.oracle.com/cd/E11035_01/wls100/deployment/config.html#wp1057141

Cannot find message resources under key org.apache.struts.action.MESSAGE in struts

I am getting the following error in the browser window :
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
I have included the resource file in the struts-config.xml using
And my resource file is stored as WEB-INF/classes/Application.properties file.
Well this is an old post, but my answer can help, I guess...
I personally wasted some time to make work a poject that had been developped under Tomcat 5.5 under Tomcat 7.
Note : You should name your ressource file : "ApplicationResources"...
There is several reasons why it wouldn't work, but the most common answer I found on the net was : put the line
<message-resources parameter="ApplicationResources" null="false" />
in your "struts-config.xml".
In my case, this line was already present, and this was the contrary : I had to remove it and replace at the "web.xml" file level by :
<context-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</context-param>
in the "servlet" tag.
I'm sorry that I don't have a valuable explanation for this, but my application behaves just fine now.
Does anyone has (an explanation) ?
This happened to me because I was converting my project to maven and my resources directory was not correct.
I had struts-config.xml like this:
<message-resources parameter="messages.appResources" null="false"/>
My pom.xml was like this:
<resource>
<directory>src/main/resources</directory>
</resource>
But my messages folder was in my project root. So I moved it to:
${project.basedir}/src/main/resources/messages
Make sur that you are using the same version of the DTD in the header of struts-config.xml:
I had this error when using two differents versions:
//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
and the Pb was solved once the correction made:
An XML might be missing...
In which context is your application running ? Tomcat ? JBoss ?
Try including xalan and xerces dependencies.
The following solved my problem:
In Struts Config, include:
(At the top)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<message-resources
parameter="common.properties.Common" /> (or the path to your resources file)
This error seems to be caused by a lack of a path to message-resource in struts-config.xml
and the DOCTYPE definition at the top of the same.
you should put this line in your struts-config.xml
< message-resources parameter="ApplicationResources" null="false" key="ApplicationResources" />
In my case problem was fixed after delete all unnecessary attributes from message-resources element in struts-config.xml file. Just like following:
<message-resources parameter="ApplicationResources"/>

Axis2 embedded in my web app is not working

OKay I lost alsmost the whole day on this.
I have a webapp where I would like to add AXIS2 and start working.
I added AxisServlets in the web.xml file like -
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
I also added Services.xml file like
<service name="ReportViewerService">
<description>
This is a sample Web Service for illustrating Attachments API of Axis2
</description>
<parameter name="ServiceClass">myclass</parameter>
<operation name="getReport">
<actionMapping>urn:getReport</actionMapping>
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
</service>
The directory structure is as mentioned here
WEB-ING
| - conf
| |- axis2.xml
|-lib
| |- all libs
|-services
|-ReportViewerService
| - META-INF
|-services.xml
|- web.xml
The problem is - after all of these, the service endpoint will not come, I can not see the WSDL file http://localhost:8080/BOReportingServer/services/ReportViewerService?wsdl -- this gives an exception like -
Throwable occurred: javax.servlet.ServletException: File "/axis2-web/listSingleService.jsp" not found
Finally I am able to embed AXIS2 in my webapp.
It is as simple as mentioned in the tutorial , only thing is:
I never got the jars properly placed under WEB-INF/lib directory.
Once I started from the very beginning and removed all the unwanted jars and duplicate jars from the WEB-INF/lib directory, so started working.
I had this same symptom when trying to deploy an axis2 service with a packed (unexploded) .war file on a tomcat server.
"Throwable occurred: javax.servlet.ServletException: File "/axis2-web/listSingleService.jsp" not found"
The solution was to add the 'services.list' file to the /WEB-INF/services/ folder.
(There is also a modules.list file for the /WEB-INF/modules/ folder.)
These are just a text files listing out the service archive files in the folder.
/WEB-INF
|-modules
|-addressing-1.6.1.mar
|-...
|-modules.list
|-...
|-soapmonitor-1.6.1.mar
|-services
|-ReportViewerService.aar
|-services.list
In the .list files, contain just the names of the archive files, one entry per line.
Reference: http://axis.apache.org/axis2/java/core/docs/app_server.html
You also deployed axis2.war in your servlet container, right?
In order for Axis2 to work properly, you need to deploy it to a servlet container. A tutorial can be found here. You'll know you've done it properly when the Axis2 "Happy" page can be shown.
Once you've done that, you should be able to bundle up your service (in the structure you've described above in your question) into an .aar file and deploy it using the axis2 servlet.