CXF 3.0.2 throwing " java.lang.AssertionError: UNIMPLEMENTED " exception in weblogic10.3 - weblogic

We are trying to make a webservice call using CXF framework involving CXF - ws security and the application being deployed in weblogic 10.3 , but receiving the below exception and seems like the weblogic specific jars are picked up , though the xercesimpl jar is present in the application in /WEB-INF/lib .
Options tried , but did not help:
Setting the weblogic container descriptor with
web-inf preferences
true .
Setting the JVM arguments or system property as -
-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
-Djavax.xml.soap.SOAPFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
-Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl
Adding xercesimpl jar to maven pom.
Exception
]] Root cause of ServletException.
java.lang.AssertionError: UNIMPLEMENTED
at weblogic.xml.domimpl.NodeImpl.setTextContent(NodeImpl.java:216)
at org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeAttribute(XmlWriterToTree.java:137)
at org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeNamespace(XmlWriterToTree.java:114)
at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.marshal(DOMXMLSignature.java:211)
at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(DOMXMLSignature.java:329)
at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:578)
at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:151)
at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:226)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.access$100(WSS4JOutInterceptor.java:54)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessageInternal(WSS4JOutInterceptor.java:282)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:154)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:141)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)enter code here
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:98)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
Thanks,
Soumya

I finally found the answer without modifying any weblogic startup script (tested on CXF 2.7.0 and weblogic 10.3.6
The reason for this issue is that CXF is not compatible with weblogic implementation of SAAJ. http://cxf.apache.org/docs/application-server-specific-configuration-guide.html
1.
Q: I have this error: javax.xml.ws.WebServiceException: Cannot create SAAJ factory instance.
A: Please make sure you have the saaj-impl-1.3.jar in the classpath and make sure your app picks up this one instead of weblogic one.
The same issue is also causing the UNIMPLEMENTED error in the question
So my solution is
1) put saaj-impl in classpath. If you are using maven, put the dependency on pom.xml
2) in weblogic.xml (in your resources folder) put
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>com.sun.xml.messaging.saaj.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
3) Restart your server through Node Manager and by right the CXF WS-Security should be working
Hope it helps!

Related

Email from the application is not working from glassfish 6.0.0 due to conflict of javax mail library

Email from the application is not working from glassfish 6.0.0 due to conflict of javax mail library with the glassfish 6 mail libraries from a modules folder.
We have REST application implemented using jersey 3.0.0 deployed on glassfish 6. We are using log4j for logging.
When there is an error, it failed to send the email. I tried the same application from localhost using tomcat it is sending an email.
This is what I added to my pom.xml
-- Jakarata.mail (1.6.5) jar file and log4j(1.2.17)
I also tried replacing log4J 1.2.17 to log4j2.17.1
I keep getting ClassCastException or ClassNotFoundException or NoSuchMethodError.
With Jakarta.mail.jar I am receiving below error
java.lang.ClassCastException: com.sun.mail.handlers.text_plain cannot be cast to javax.activation.DataContentHandler
I tried replacing Jakarta.mail.jar with (com.sun.mail) javax.mail.jar 1.6.2
I received below error
**ERROR An exception occurred processing Appender LogToMail org.apache.logging.log4j.core.appender.AppenderLoggingException: java.lang.NoSuchMethodError: com.sun.mail.util.MimeUtil.cleanContentType**
Tried with mail.jar 1.4.7 instead of javax.mail.jar and activation.jar(1.1.1)
Getting below Error
**java.lang.NoSuchMethodError: com.sun.mail.util.PropUtil.getBooleanSessionProperty**
As there is already some other mail library there in classloader I removed the mail library from the application then I am getting
**Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
I tried copying jakarata.mail and jakarata.activation.jar under glassfish/domains/domain1/lib/ext folder but got NOSTMP provider**.
If I copy javax.mail.jar and activation.jar under glassfish/domains/domain1/lib/ext folder then same error **“ERROR An exception occurred processing Appender LogToMail org.apache.logging.log4j.core.appender.AppenderLoggingException: java.lang.NoSuchMethodError: com.sun.mail.util.MimeUtil.cleanContentType”**
I also tried adding mail.jar and activation.jar under glassfish/domains/domain1/lib/ext folder
**ERROR Caught exception while sending e-mail notification.: javax.mail.NoSuchProviderException: smtp javax.mail.NoSuchProviderException: smtp**
I refer to the below link. Not completely understood what xbootclasspath does but tried adding the below lines to domain.xml.
DCH class error with JavaMail
-Xbootclasspath/p:${com.sun.aas.installRoot}/modules/jakarta.mail.jar
-Xbootclasspath/p:${com.sun.aas.installRoot}/modules/jakarta.activation.jar
if anyone is able to successfully send an email from glassfish 6.0.0
Appreciate any help on this.
GlassFish already included Jakarta Mail. There's no need to include it in your pom. When you do, it will conflict, as you per the errors you got.
Jakarata.mail 1.6.5 which you use in your application is old, it uses the javax.mail package prefix. GlassFish 6 uses the jakarta package prefix. You should upgrade to jakarta.mail-api 2.1.0 and use it only for compilation, don't add it to your application WAR (provided scope):
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>

EclipseLink Moxy with Java11

I asked this questions already here:
https://www.eclipse.org/forums/index.php/t/1098133/
Now, after 3 weeks, i hope to have luck to reach a response here in stackoverflow.
I have a RCP applcation using MOXy to parse complex XML, the annotated classes are generated by XJC, and the package contains a ObjectFactory and a jaxb.properties pointing to MOXy.
The problem: The application works with Java8, but starting the application with Java11, i get this exception:
java.lang.RuntimeException: javax.xml.bind.JAXBException
- with linked exception:
[Exception [EclipseLink-50000] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The context path mypackage contains no ObjectFactory or jaxb.index, no external metadata was found in properties Map, and sessions.xml was found or was invalid.
Internal Exception: Exception [EclipseLink-7095] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The sessions.xml resource [sessions.xml] was not found on the resource path. Check that the resource name/path and classloader passed to the SessionManager.getSession are correct. The sessions.xml should be included in the root of the application's deployed jar, if the sessions.xml is deployed in a sub-directory in the application's jar ensure that the correct resource path using "/" not "\" is used.]
My target platform contains:
org.eclipse.persistence.moxy_2.7.4....jar
jaxb-osgi-2.3.2.jar
jakarta.activation.jar
jakarta.xml.bind-api.jar
I use Multi-Release: true to be able to handle Java8 vs. Java9+.
In the main MANIFEST.FM i require org.eclipse.persistence.moxy.
In the versions/9/OSGI-INF/MANIFEST.FM I add the import packages: com.sun.xml.bind.v2, javax.xml.bind
To start the application in the Eclipse run configuration dialog, i switch the JRE Java8 vs Java11, and in the plugins tab, i remove (J8) or add (J11) com.sun.xml.bind.jaxb-osgi (jaxb-osgi.jar) to make it startable.
Can someone help?
regards
Frank

Error in transporting an application from development worklight to Worklight Server Consumer Edition

I am using IBM Worklight environment. I have created a small application "SampleHybridProject" using Worklight Developer studio and tested it successfully.
Now when I am trying to deploy it on the Worklight Server Consumer Edition, and hitting the following URL: http://mymachine.com:9080/SampleHybridProject/console
I am getting this error in my browser:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /SampleHybridProject/console
I am using Worklight Edition 5.0.6. The Worklight Server is default "WAS with Liberty profile".
Here are the properties that I changed in worklight.properties file.
publicWorkLightHostname=localhost
publicWorkLightProtocol=http
publicWorkLightPort=9080
publicWorkLightContext=/SampleHybridProject
wl.db.type=MYSQL
wl.db.url=jdbc:mysql://mysqlinstalledonmypc:3306/WRKLGHT
wl.db.username=root
wl.db.password=admin
Here are the changes that I made in application-descriptor.xml:
<worklightServerRootURL>http://${local.IPAddress}:9080/SampleHybridProject</worklightServerRootURL>
Can you tell me what I am doing wrong or what I need to do?
I have found the problem and solved it. The problem is I was having this error in console.log file:
Error creating bean with name 'txManager' defined in URL [jar:file:/C:/ProgramData/IBM/Worklight/WAS85liberty-server/wlp/usr/shared/resou‌​rces/lib/worklight-jee-library.jar!/conf/core.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of com/ibm/ws/classloading/internal/UnifiedClassLoader) previously initiated loading for a different type with name "javax/sql/DataSource"
This was because I had a jar in the server/lib folder of my project which was causing this problem. I removed the jar from server/lib folder and redeployed the .war file. Now the console is getting loaded.
Are you getting any deployment errors in your liberty logs? A 404 on the context root generally means either the WAR was not found, or the context root defaults to something other than 'SampleHybridProject'. If the WAR appears to be loading correctly, it will output where it is listening on similar to:
[AUDIT ] CWWKT0016I: Web application available (default_host): http://[hostname]:port/SampleHybridProject/*
If it says the context root is anything other than SampleHybridProject, you can set it in the tag in liberty's server.xml:
<application id="SampleHybridProject" name="SampleHybridProject"
location="SampleHybridProject.war" type="war"
context-root="SampleHybridProject">
...
</application>

SEVERE: EJB5070: Exception creating stateless session bean - solution with beans.xml

I was struggling to overcome this problem! Went trough most of the similar posts over here however had no luck.
Deployment was fine but problem occurred during runtime.
I am working with GlassFish 3.1.2.2 and use maven, application is deployed as a WAR with multiple JARs and using EJB3, JPA, CDI.
FINALY I have found the cause: In one of my jar file with session beans I had a missing beans.xml file in src/main/resources/META-INF directory.According to cdi spec this file is needed by the jar to be recognised as a bean archive.Hope this will solve problems for others as well! cheers bb

Drools Guvnor on Glassfish error

I'm trying to deploy Guvnor (guvnor-5.5.0.Final-tomcat-6.0) to a fresh
glassfish server ( 3.1.2.2 build 5) and am getting the error below.
I did try the other WARs without any luck and I get the same error on
OSX and windows.
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
java.lang.NoClassDefFoundError: org/apache/AnnotationProcessor. Please
see server.log for more details
Are there any work-around for this ?
Add the jasper-xxx.jar to your lib. It should work. If you deploy in tomcat, it should be in catalina.jar.
Unfortunately JBOSS 7 doesn't use tomcat instead it uses JBossWeb. That's why you have this problem.
Take the guvnor-5.5.0.Final-jboss-as-7.0.war binary war file
add dom4j-1.6.1.jar
remove javassit*.jars
add resteasy-jaxb-provider-2.2.3.GA.jar
add resteasy-jaxrs-2.2.3.GA.jar
Add the a glassfish-web.xml file to WEB-INF https://github.com/snowch/glassfish-guvnor/blob/master/src/main/webapp/WEB-INF/glassfish-web.xml
Replace WEB-INF/web.xml with this https://github.com/snowch/glassfish-guvnor/blob/master/src/main/webapp/WEB-INF/web.xml
Repackage the binary war file and deploy to glassfish