External component library not found - wso2-esb

I'm trying to run the "Sample 271: File Processing" from wso2 documentation and run into the following ClassNotFoundException :
ERROR - SmooksMediator Failed to filter source.
org.milyn.SmooksException: Failed to filter source.
at ...
...
Caused by: java.lang.ClassNotFoundException: org/milyn/csv/CSVParser
at ...
...
ERROR - SequenceMediator Failed to filter source. Caused by Failed to filter source.
I did the following verifications :
milyn-smooks-csv-1.2.4.jar is in wso2esb-5.0.0\repository\components\lib
milyn_smooks_csv_1.2.4_1.0.0.jar is generated at startup in wso2esb-5.0.0\repository\components\dropins
bundle details from console is :
milyn_smooks_csv_1.2.4_1.0.0 [96]
Id=96, Status=ACTIVE Data Root=D:\tools\wso2esb-5.0.0\repository\components\default\configuration\org.eclipse.osgi\bundles\96\data
"No registered services."
No services in use.
Exported packages
org.milyn.csv; version="0.0.0"[exported]
org.milyn.csv.prog; version="0.0.0"[exported]
*; version="0.0.0"<unwired><dynamic>
No fragment bundles
Named class space
milyn_smooks_csv_1.2.4; bundle-version="1.0.0"[provided]
No required bundles
Local entry is :
<?xml version="1.0" encoding="UTF-8"?>
<localEntry key="smooks" src="file:/D:/tools/wso2esb-5.0.0/resources/smooks-config.xml" xmlns="http://ws.apache.org/ns/synapse"/>
smooks-config.xml is :
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
<!--Configure the CSVParser to parse the message into a stream of SAX events. -->
<resource-config selector="org.xml.sax.driver">
<resource>org.milyn.csv.CSVParser</resource>
<param name="fields" type="string-list">name,surname,phone</param>
</resource-config>
</smooks-resource-list>
Any suggetsions ?
Thanks.

According to this topic,it looks like there is an issue when you specify the smooks config-key attribute.
I believe the path in your local file should be relative to our folder, i.e it should be something like this:
<localEntry key="smooks" src="file:resources/smooks-config.xml"/>

Related

its possible change library-ref descriptor using a plan deployment in weblogic?

I trying to overwrite the library-ref descriptor from weblogic.xml file using a plan.xml but im getting "DeploymentException: weblogic.management.DeploymentException: Error: Unresolved Webapp Library references..."
the objective is use a different library using plan.xml without modify the weblogic.xml file
In my weblogic.xml (fragment)
<wls:library-ref>
<wls:library-name>lib_framework</wls:library-name>
<wls:specification-version>1.0.0</wls:specification-version>
<wls:implementation-version>1.0.0</wls:implementation-version>
<wls:exact-match>false</wls:exact-match>
</wls:library-ref>
i define in the plan.xml (fragment)
....
<variable>
<name>var_lib_framework</name>
<value>lib_framework_replace</value>
</variable>
<module-descriptor external="false">
<root-element>weblogic-web-app</root-element>
<uri>WEB-INF/weblogic.xml</uri>
<variable-assignment>
<name>var_lib_framework</name>
<xpath>/weblogic-web-app/library-ref/[library-name="lib_framework"]</xpath>
<operation>replace</operation>
</variable-assignment>
</module-descriptor>
....
....
but when i try start the app the error appear during deployment. So the question is: Can i change a library descriptor defined in a weblogic.xml file using a deployment plan?

Struts2 file upload - No mapping found for dependency

I'm using Struts 2.3.20.1 with Commons File Upload 1.3.1 and Commons IO 2.4 to upload a (CSV) file. When i try to do uploading, there is this error in server log:
ERROR [io.undertow.request] (default task-24) UT005023: Exception
handling request to /private/createDatasetFromCSV:
java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException:
com.opensymphony.xwork2.inject.DependencyException:
com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException:
No mapping found for dependency [type=java.lang.String,
name='struts.multipart.bufferSize'] in public void
org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.setBufferSize(java.lang.String).
I've followed the official guidelines here, creating an Action class, using the JSP form tags and so on.
In struts.xml, for file upload section, I have:
<constant name="struts.multipart.maxSize" value="209715200" />
<constant name="struts.multipart.parser" value="jakarta-stream" />
The version of Struts should be updated due to WW-4466.
With WW-3025 there was a new config constant introduced: struts.multipart.bufferSize
Currently it is set as required and hence applications must specify it. The default value is always overridden.
-> should be required = false
Fix Version/s: 2.3.24

Ignite configuration with absolute path

I downloaded Ignite 2.5.0 (I use maven dependences in Eclipse on a Mac for my Java class), and I tried to start Ignite with a configuration file given with an absolute path:
public static void main(String [] args) throws Exception {
try (Ignite ignite = Ignition.start("/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml")) {}
}
but I got exception:
Exception in thread "main" class org.apache.ignite.IgniteException: Failed to find configuration in: file:/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:990)
at org.apache.ignite.Ignition.start(Ignition.java:355)
at hu.sztaki.lpds.ml.ignite.WekaIgnite.main(WekaIgnite.java:82)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to find configuration in: file:/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:116)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:744)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:945)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:854)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:724)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:693)
at org.apache.ignite.Ignition.start(Ignition.java:352)
... 1 more
The config file is there:
$ cat /Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
<?xml version="1.0" encoding="UTF-8"?>...
and:
new File("/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml").exists() is true
According to docs this path can be absolute.
What am I doing wrong?
Thank you.
I think, the problem is that default-config.xml file has only abstract IgniteConfiguration. This is the case in the default configuration file in examples.
Check, if the configuration bean's definition has abstract=true parameter, and remove it if it does.
P.S.
Creating Ignite as a resource of a try block is a pretty bad idea, since the node will stop right after execution of the try block is finished.

Failed Glassfish deploy - "Referencing error: this bundle has no bean of name [ClientBean]"

I'm trying to run the example from this page : GlassFish-to-GlassFish Remote EJB Invocation
But I get this error when I try to deploy the client on glassfish ("asadmin> deploy client-ejb.jar"):
"Exception while deploying the app [client-ejb] : Referencing error: This bundle has no bean of name [ClientBean]"
I need help, thanks.
I encountered a a similar problem when trying to deploy my application (Exception while deploying the app [my-app] : Referencing error : This bundle has no bean of name [myBeanFacade] ) .Rather weird but all that was needed to solve this was to go to the properties of [my-app] under the build category tree, choose compile and tick the compile on save option. Redeployed my application and viola !!
NB [my-app] contains 2 ejb jars and a web application, one of the ejbs is a library in the web app.
This problem occurred because the guy forgot to add the ServiceIF.class reference in client-ejb.jar.
Execute the command:
jar cvf client-ejb.jar test/ServiceIF.class test/ClientIF.class test/ClientBean.class META-INF/glassfish-ejb-jar.xml
get the new .jar and it will work.
In case you are using a deployment descriptor, then the EJB name should be the same in both the descriptor file.
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>com.ejb.test.HelloHome</home>
<remote>com.ejb.test.HelloObject</remote>
<ejb-class>com.ejb.test.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
**<ejb-name>Hello</ejb-name>**
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
**<ejb-name>Hello</ejb-name>**
<jndi-name>jndi/Hello</jndi-name>
</ejb>
</enterprise-beans>
</glassfish-ejb-jar>

java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl while starting the weblogic

As part of our application we are using apache's xerces jaxp parser. When we deploy the application on weblogic 9.2, we are getting the following error.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
As per our analysis, weblogic is trying to to load its own DocumentBuilderFactoryImpl which is present in weblogic.jar instead of apache's xerces.
We tried the following to force the weblogic to load DocumentBuilderFactoryImpl from xerces
i) we have added the following tag into weblogic.xml
<prefer-web-inf-classes>true</prefer-web-inf-classes>
ii) we have put latest versions of xalan in jre/lib/endorced folder. this didn't resolve our problem.
ii) we have added entries in weblogic-application.xml
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.xerces.jaxp.*</package-name>
</prefer-application-packages>
</weblogic-application>
ii)Added the following entry in weblogic-application.xml
<xml>
<parser-factory>
<saxparser-factory>org.apache.xerces.jaxp.SAXParserFactoryImpl</saxparser-factory>
<document-builder-factory>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</document-builder-factory>
<transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
</parser-factory>
</xml>
iii) Added jaxp.properties to load DocumentBuilderFactoryImpl from xerces to the jre/lib and started the server.In this case, the weblogic didnt start.
iv) Then we started the server first and then copied the jaxp.properties file during the run time when server starts.But no success
None of the above worked for us.
Any help is highly appreciated.
You did so many things that I don't understand the exact status. My advice would be to strictly follow the Application Server Specific Configuration Guide for WebLogic that I've successfully used in the past with WLS 9.2.
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
</prefer-application-packages>
</weblogic-application>
You'll certainly have to add more packages under prefer-application-packages to setup Weblogic ClassLoader filtering but in the current state of the question, it's impossible to provide a precise answer.
Just in case, you can maybe try to blindly use the weblogic-application.xml from this thread:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<xml>
<parser-factory>
<saxparser-factory>
org.apache.xerces.jaxp.SAXParserFactoryImpl
</saxparser-factory>
<document-builder-factory>
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
</document-builder-factory>
<transformer-factory>
org.apache.xalan.processor.TransformerFactoryImpl
</transformer-factory>
</parser-factory>
</xml>
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.xalan.*</package-name>
</prefer-application-packages>
</weblogic-application>
But this is a shot in the dark.
You could try forcing the use of the specified document builder factory as a command line option:
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
This is assuming that you have the required Xerces builder factory class in your classpath.
In general, you shouldn't use a separate xerces.jar anymore, unless required by some legacy code. The Xerces parser classes come with the JRE, the package names just start with com.sun.org.apache instead of org.apache. You could try also
-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
and remove xerces.jar from your classpath altogether (this is what we did on WLS 10.3 and Java 1.6).
I managed to resolve the issue DocumentBuilderFactory not found with simple solution.
Try to copy xercesImpl.jar to the domain specific lib directory on weblogic MyDomain\servers\MyServer\lib.
In my case the problem was that i made a dependency on commons-digester which in turn used another version of xerces (that caused the conflict). So you can review your dependencies in case some other version of xerces was transitively included.