java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not a subtype - weblogic12c

I am using Weblogic 12c. I m trying to deploy myApplication.war in Weblogic.
While deploying i get bellow error.
An error occurred during activation of changes, please see the log for details.
Message icon - Error java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not a subtype
Message icon - Error javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not a subtype
The same myApplication.war I am able to deploy in weblogic-10,Jboss and Tomcat. But not in weblgic-12c.
I googled and found that i need to include dependency for xercesImpl.jar. I included that but, That dint help. still I am facing the same issue.
I tried including some other dependency, those are.
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>3.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-lgpl</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
the above dependency dint help. Any suggestion for trouble shooting the application,any link.
It seems to be very common problem with weblogic-12c. what is root
cause of the exception?

I add only one dependency in ear pom.xml. It's work for me in WLS 12.2.1.3.
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>5.0.2</version>
</dependency>
and another libs was exclude, such as org.codehaus.woodstox, stax-api

In WebLogic.xml add:
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
</container-descriptor>

Related

Cannot resolve symbol 'owasp', import error in intellij

I want to use ESAPI in my project and have added following dependency in the pom.xml
pom.xml with dependency:
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.owasp.esapi</groupId>
<artifactId>esapi</artifactId>
<version>2.5.0.0</version>
</dependency>
But when I import org.owasp.esapi.* intellij give me warning as shown in image.
I want to use ESAPI logger to prevent CRLF injection possibilities in log statements.
My current project uses slf4j.Logger
I am very new to this ESAPI and OWASP and have never used it and have tried from here
https://github.com/ESAPI/esapi-java-legacy/wiki/Using-ESAPI-with-SLF4J#configuring-esapi-to-use-slf4j
Please tell me if im doing something wrong and how to correctly use ESAPI in project.
Hmm. What JDK are you using with IntelliJ? Java 8 or later is required as of 2.4.0.0. That's the only thing that I can think of that would cause this behavior. Looks okay otherwise. Did you check if the esapi-2.5.0.0.jar got pulled down? Because it's either not finding that or it's not compatible with the Java version that your IntelliJ IDE is using.
Well i found that I was adding this dependency in <dependencyManagement> tag instead of <dependencies> tag, that's why it wasn't downloading from the repository.
Previous:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.owasp.esapi</groupId>
<artifactId>esapi</artifactId>
<version>2.5.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
after fix:
<dependencies>
<dependency>
<groupId>org.owasp.esapi</groupId>
<artifactId>esapi</artifactId>
<version>2.5.0.0</version>
</dependency>
</dependencies>
Whats the difference in <dependencies> and <dependencyManagement> please refer this Differences between dependencyManagement and dependencies in Maven

Drools / Java 8 compatibility

I am trying to use Drools for rules validation, and I get an error with Java 8. As per the existing suggestions, I did upgrade to eclipse compiler to 4.4 and see the corresponding ecj-4.4.jar generated in my maven dependencies. However, I am still getting the wrong class format exception:
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException.
I tried using different versions of drools including 6.4.0.Final, 5.0.1 as well - but the issue persists.
I get this error when I try using the Stateless kie session but not with the stateful kie session.
Any thoughts?
Best Regards,
Sadhana
If you are using drools compiler dependency then change it below in pom.xml
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
</exclusion>
</exclusions>
</dependency>
If you are using drools-spring dependency:
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-spring</artifactId>
<version>${drools-spring-version}</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
</exclusion>
</exclusions>
</dependency>
The error you are facing could be because there are multiple version of ecj jar and Java is picking the wrong one.

java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V Exception while migrating from 12.1.3 to 12.2

I am doing migration from JDev 12.1.3 to 12.2.0. Now there was some problem durnng compilation but it has been resolved by modifiying class path.
Now when I go for deployment then it showing me one exception. That is ...
"java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V"
I am using following dependencies..
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.0.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>5.0.1.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Apart from these dependencies I also looked into "C:\oracle_home12c\wlserver\modules" folder and found there was one "org.jboss.logging.jboss-logging.jar" file.
I replaced the maven repo file from "jboss-logging-3.3.0.Final".
I also looked into "jboss-logging-3.3.0.Final" jar file. There is one Logger class file but it does not contain the debugf(String) method.
Exception type;
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:149)
at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:764)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:495)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerFactory(BasePersistenceUnitInfo.java:611)
Can someone help to get rid off this problem?
Thanks in advance
If you are using the glassfish server the the problem might be with the lib provided by glassfish. This error is caused by the use of incompatible version.
Just create a glassfish-web.xml file in the WEB-INF directory. The contents of the file are shown below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
 <class-loader delegate="false"/>
</glassfish-web-app>
This ensures that glassfish does not load it's internal libraries, but libraries from your project.
I don't know how JDev classloading works, but maybe it takes the a wrong version of jboss-logging which doesn't have the method? Try removing that from the modules dir. And make sure that your app bundles jboss-logging in the .war. It should be brought in by Hibernate's dependencies. If not, add it to the pom.xml.

"Provider not a subtype" on org.eclipse.jetty.apache.jsp.JuliLog for Embedded Jetty

When using embedded jetty and started via
mvn jetty:run
The following exception is thrown:
Exception in thread "main" java.util.ServiceConfigurationError:
org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
Here is the pom.xml snippets:
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<version>3.0.0.v201112011016</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>8.1.19.v20160209</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>8.1.19.v20160209</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.6</version>
</dependency>
Any pointers to a correctly configured embedded jetty (preferably also using websockets) appreciated.
Don't try to enable everything all at once.
Jetty is a highly modular system, you can pick and choose what you want to run. Nothing is mandatory by default, even the Server!
If you want examples of embedded jetty with websockets, consider reviewing the example projects that the Jetty project has put together at ...
https://github.com/jetty-project/embedded-websocket-echo-examples
Some advice:
Build up your requirements layer by layer
Start with basic websocket endpoint functionality (get this working first!)
then add slf4j + logback. (be sure you use an appropriate version, see the <scope>optional</scope> dependencies present in your previous layer before you choose a version of slf4j or logback). Test this like there is no tommorrow.
then add jsp support (as your error seems to indicate your desire for jsp support)

Class 'org.springframework.web.servlet.view.InternalResourceViewResolver' not found error

I'm getting this error with my Spring MVC sample application using Spring STS Eclipse plugin:
Class
'org.springframework.web.servlet.view.InternalResourceViewResolver'
not found [config set: webninar-hello/web-context]servlet-context.xml
Anyone have an idea how to fix this?
I had this problem with a mistake in my maven configuration. As Ivan mentioned in his answer org.springframework.web.servlet-3.1.2.RELEASE.jar was not at my lib directory. So I searched for it's maven dependency from http://blog.springsource.org/2009/12/02/obtaining-spring-3-artifacts-with-maven/ URL.
Then I realized I included wrong dependency in my pom.xml
correct dependency as follows
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
Previously I had spring-web as the artifactId. Hope this helps :)
I had the same problem and it wasn't a refreshing problem for me. I had to add the following jar to my build path:
org.springframework.web.servlet-3.1.2.RELEASE.jar
You can download the Spring bundle from the Spring website: http://www.springsource.org/spring-community-download
Sounds like a refreshing problem.
F5, Cleanup Project, F5, Server Clean, maybe Server Clean Working directory.
If this all does not help. Remove the application from the server (close the window) and then add it again.
Just clean the project and check this dependency in your POM.xml file
Definitely it will work fine.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
I deleted everything under /Users//.m2/repository with rm -R * and then rebuilt everything with Maven>>Update Project, closed and reopened project, cleaned project and then it worked.
I had to add following dependencies to pom filefor resolve this issue.
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>compile</scope>
</dependency>