Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 73f0e70c authored by Pawel GUTOWSKI's avatar Pawel GUTOWSKI
Browse files

EDELIVERY-1978 Fixed WebLogic issue with spring-web.jar

parent 41a92531
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ import javax.sql.DataSource;
@ComponentScan(basePackages = {
"eu.europa.ec.edelivery.smp.services",
"eu.europa.ec.edelivery.smp.data.dao",
"eu.europa.ec.cipa.smp.server.hook",
"eu.europa.ec.edelivery.smp.sml",
"eu.europa.ec.edelivery.smp.conversion",
"eu.europa.ec.cipa.smp.server.util"})
@PropertySource(value = "classpath:config.properties")
......
......@@ -11,9 +11,18 @@
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the Licence for the specific language governing permissions and limitations under the Licence.
-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="SMP_WebApp" version="3.0">
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" metadata-complete="true">
<!--
WebLogic scans all application's JAR files to search for some annotated classes.
This scanning has an issue with spring-web-5.0.2.RELEASE.jar -
that results in deployment failure with strange error "array index out of bounds".
metadata-complete="true" is set to inform WebLogic to NOT scan JARs
-->
<display-name>SMP - OASIS REST services</display-name>
......
......@@ -24,6 +24,9 @@
<package-name>org.slf4j.*</package-name>
<package-name>org.apache.commons.*</package-name>
<!-- used to switch off bean validation which resulted in failing Spring context to load -->
<package-name>javax.validation.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
......
/*
* Copyright 2018 European Commission | CEF eDelivery
*
* Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
*
* You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
*
* Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and limitations under the Licence.
*/
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
public class ClassLoaderTest {
static int loadableClassesCnt = 0;
static int notLoadableClassesCnt = 0;
public static void main(String [] args) {
try {
List classList = null;
String jarPath = "E:\\src\\smp\\smp-webapp\\target\\cipa-smp-full-webapp-4.0.0-SNAPSHOT\\WEB-INF\\lib\\spring-webmvc-5.0.2.RELEASE.jar";
classList = getClassesFromJARFile (jarPath);
}
catch(Exception e) {
System.out.println("Exception = " + e);
}
System.out.println("Loadable / not loadable classes: "+loadableClassesCnt + " / "+notLoadableClassesCnt);
}
private static List getClassesFromJARFile(String jar)
{
final List classes = new ArrayList();
JarInputStream jarFile = null;
try
{
jarFile = new JarInputStream(new FileInputStream(jar));
JarEntry jarEntry = null;
do
{
try
{
jarEntry = jarFile.getNextJarEntry();
}
catch(Exception ioe)
{
System.out.println("Unable to get next jar entry from jar file '"+jar+"'");
ioe.printStackTrace();
}
if (jarEntry != null)
{
extractClassFromJar(jar, classes, jarEntry);
}
} while (jarEntry != null);
closeJarFile(jarFile);
}
catch(Exception ioe)
{
System.out.println("Unable to get Jar input stream from '"+jar+"'");
ioe.printStackTrace();
}
finally
{
closeJarFile(jarFile);
}
return classes;
}
private static void extractClassFromJar(final String jar, final List classes, JarEntry jarEntry) throws IOException
{
String className = jarEntry.getName();
if (className.endsWith(".class"))
{
className = className.substring(0, className.length() - ".class".length());
try
{
classes.add(Class.forName(className.replace('/', '.')));
loadableClassesCnt++;
System.out.println("Successfully loaded class " + className);
} catch (ClassNotFoundException | NoClassDefFoundError ncdfe)
{
notLoadableClassesCnt++;
System.err.println("Failed to load class " + className + " reason: "+ncdfe.getMessage());
//cnfe.printStackTrace();
//throw new IOException("unable to find class named " + className.replace('/', '.') + "' within jar '" + jar + "'", cnfe);
}
}
}
private static void closeJarFile(final JarInputStream jarFile)
{
if(jarFile != null)
{
try
{
jarFile.close();
}
catch(Exception ioe)
{
System.out.println("Unable to Close Jar File '"+jarFile+"'");
ioe.printStackTrace();
}
}
}
}
\ No newline at end of file
/*
* Copyright 2017 European Commission | CEF eDelivery
*
* Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
*
* You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
*
* Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and limitations under the Licence.
*/
package eu.europa.ec.cipa.smp.server.util;
import javax.ws.rs.core.Cookie;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import java.util.*;
/**
* Created by rodrfla on 13/01/2017.
*/
public class DefaultHttpHeader implements HttpHeaders {
private Map<String, List<String>> headerMap;
private List<String> requestHeaders;
{
headerMap = new HashMap<>();
requestHeaders = new ArrayList<>();
}
public void addRequestHeader(String headerParameter, List<String> values) {
headerMap.put(headerParameter, values);
}
@Override
public List<String> getRequestHeader(String headerParameter) {
return headerMap.get(headerParameter);
}
@Override
public String getHeaderString(String name) {
return null;
}
@Override
public MultivaluedMap<String, String> getRequestHeaders() {
return null;
}
@Override
public List<MediaType> getAcceptableMediaTypes() {
return null;
}
@Override
public List<Locale> getAcceptableLanguages() {
return null;
}
@Override
public MediaType getMediaType() {
return null;
}
@Override
public Locale getLanguage() {
return null;
}
@Override
public Map<String, Cookie> getCookies() {
return null;
}
@Override
public Date getDate() {
return null;
}
@Override
public int getLength() {
return 0;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment