Sunday

javax.servlet.ServletException: File "/WEB-INF/include/httpbase.jsp" not found

BUG:
javax.servlet.ServletException: File "/WEB-INF/include/httpbase.jsp" not found

FIX:
Download the missing file from the following urls. And copy the file WEB-INF/include
  • footer.inc            http://en.osdn.jp/projects/sfnet_akldj/downloads/1/footer.inc.php/ 
  • header.inc           http://en.osdn.jp/projects/sfnet_xenet/downloads/inc/header.inc.php/
  • httpbase.jsp        http://osdn.jp/projects/sfnet_soapdbconnect/downloads/server/java/newServerTest/WebContent/axis2-web/include/httpbase.jsp/
  • link-footer.jsp     http://zh.osdn.jp/projects/sfnet_soapdbconnect/downloads/server/java/newServerTest/WebContent/axis2-web/include/link-footer.jsp/




footer.inc
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

</td>
</tr>
<tr height="20px">
 <td>
 <table width="100%">
  <tr><td>
   <table width="950px">
    <tr><td><hr size="1" noshade="" /></td></tr>
    <tr>
     <td align="center">Copyright &#169; 1999-2006, The Apache Software Foundation<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</td>
    </tr>
   </table>
  </td>
  <td>&nbsp;</td>
  </tr>
 </table>
 </td>
</tr>
</table>

header.inc
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<table class="FULL_BLANK"><tr height="100%"><td valign="top">
<table width="100%">

<tr><td>
<table width="950px">
  <tr>
    <td align="left"><img src="axis2-web/images/asf-logo.gif"/></td>
    <td align="right"><img src="axis2-web/images/axis_l.jpg"/></td>
    </tr>
</table>
</td>
<td>&nbsp;</td></tr></table>

httpbase.jsp
<%--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  --%>

<%@ page import="org.apache.axis2.AxisFault" %>
<%@ page import="org.apache.axis2.Constants" %>
<%@ page import="org.apache.axis2.addressing.EndpointReference" %>
<%@ page import="org.apache.axis2.client.Options" %>
<%@ page import="org.apache.axis2.client.ServiceClient" %>
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.apache.axis2.context.ConfigurationContextFactory" %>
<%@ page import="org.apache.axis2.context.ServiceContext" %
<%@ page import="org.apache.axis2.context.ServiceGroupContext" %>
<%@ page import="org.apache.axis2.deployment.util.PhasesInfo" %>
<%@ page import="org.apache.axis2.description.AxisModule" %>
<%@ page import="org.apache.axis2.description.AxisOperation" %>
<%@ page import="org.apache.axis2.description.AxisService" %>
<%@ page import="org.apache.axis2.description.AxisServiceGroup" %>
<%@ page import="org.apache.axis2.description.Parameter" %>
<%@ page import="org.apache.axis2.engine.AxisConfiguration" %>
<%@ page import="org.apache.axis2.engine.Handler" %>
<%@ page import="org.apache.axis2.engine.Phase" %>
<%@ page import="org.apache.axis2.transport.http.AxisServlet" %>
<%@ page import="org.apache.axis2.util.JavaUtils" %>
<%@ page import="javax.xml.parsers.SAXParser" %>
<%@ page import="javax.xml.parsers.SAXParserFactory" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.StringWriter" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Iterator" %>
<%!

  private String frontendHostUrl;

  public void jspInit() {
    ServletContext context = this.getServletConfig().getServletContext();
    ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
    if (configctx != null){
        Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
        if (parameter != null) {
          frontendHostUrl = (String) parameter.getValue();
        }
    }
  }

  public String calculateHttpBase(HttpServletRequest aRequest) {

    StringBuffer stringBuffer = new StringBuffer();
    if (frontendHostUrl != null) {
      stringBuffer.append(frontendHostUrl);

    } else {
      String scheme = aRequest.getScheme();
      stringBuffer.append(scheme);
      stringBuffer.append("://");
      stringBuffer.append(aRequest.getServerName());

      if (("http".equalsIgnoreCase(scheme) && aRequest.getServerPort() != 80) || "https".equalsIgnoreCase(scheme) && aRequest.getServerPort() != 443)
      {
        stringBuffer.append(":");
        stringBuffer.append(aRequest.getServerPort());
      }
      // I think i saw web containers return null for root web context
      if (aRequest.getContextPath() != null) {
        stringBuffer.append(aRequest.getContextPath());
      }
    }

    // append / char if needed
    if (stringBuffer.charAt(stringBuffer.length() - 1) != '/') {
      stringBuffer.append("/");
    }
    String curentUrl = stringBuffer.toString();
    aRequest.setAttribute("frontendHostUrl", curentUrl);
    return curentUrl;
  }

%><base href="<%= calculateHttpBase(request)%>"/>

link-footer.jsp
<%--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  --%>

<%@ page import="org.apache.axis2.AxisFault" %>
<%@ page import="org.apache.axis2.Constants" %>
<%@ page import="org.apache.axis2.addressing.EndpointReference" %>
<%@ page import="org.apache.axis2.client.Options" %>
<%@ page import="org.apache.axis2.client.ServiceClient" %>
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.apache.axis2.context.ConfigurationContextFactory" %>
<%@ page import="org.apache.axis2.description.AxisOperation" %>
<%@ page import="org.apache.axis2.description.AxisService" %>
<%@ page import="org.apache.axis2.description.Parameter" %>
<%@ page import="org.apache.axis2.engine.AxisConfiguration" %>
<%@ page import="org.apache.axis2.util.JavaUtils" %>
<%@ page import="javax.xml.parsers.SAXParser" %>
<%@ page import="javax.xml.parsers.SAXParserFactory" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.StringWriter" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Iterator" %>
<%--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
--%>

<table width="100%">
   <tr><td>
      <table width="950px">
         <tr>
            <td align="right"><a href="axis2-web/index.jsp">Back Home</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a href="#" onclick="javascript:window.location.reload(true);return false;">Refresh</a></td>
         </tr>
      </table>
   </td>
   <td>&nbsp;</td></tr>
</table>

java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver


BUG:

java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128)
FIX:
Download xmlschema-core-2.2.1.jar. And copy the jar WEB-INF/lib.

The ServiceClass object does not implement the required method in the following form: OMElement add(OMElement e)

BUG:  The ServiceClass object does not implement the required method in the following form: OMElement add(OMElement e)

FIX:  Update the following changes in services.xml and axis2.xml :

(change '2004/08' to 'ns')
<!-- Earlier: -->
<messageReceivers>
     <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
     <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>

<!--  New: -->
<messageReceivers>
     <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
     <messageReceiver  mep="http://www.w3.org/ns/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>            
</messageReceivers>

Friday

Install Apache Tomcat Server in Eclipse IDE

Enviroment used: JDK 6, Eclipse Mars (4.5.0), Apache Tomcat 8.0.36, Windows 10
1. If you need to install Tomcat, you can download it from this location. I use “Apache Tomcat 8.0.36″ version.
2. After downloading installer (.exe) file, double click on the file. Follow the steps below to install:


The default port number to process HTTP requests is 8080. You can change the port number in this step or change it later after the installation in server.xml which iss located in /conf/server.xml.   





Open browser and type  http://localhost:8080.Home page as shown below.


Configure Tomcat:

Open Control Panel\Administrative Tools and double-click on Services.


3. Open Eclipse, Servers area. Right click -> New -> Server.

Then --> Next --> Finish. Right-click on the server and start and stop it to ensure its proper working.

After starting the Tomcat, open browser and type http://localhost:8080. You should see the Apache Tomcat home page.

 PLUS: Tomcat started in Eclipse but enabled to connect to http://localhost:8080. Double click to the server. In server location choose "Use Tomcat installation.."