Generated Service with Axis outside Liferay, can't use it inside plugins - web-services

Using Liferay 6.2 CE GA6 here.
In my current project I am forced to use a SOAP-RPC webservice generated outside liferay. I have the WSDL file and the procedure I used to get the client was:
Downloaded Axis 1.4 (same that Liferay 6.2 CE GA6 uses, I think)
Used WSDL2Java to generate Java classes that use the remote service.
Did a local test with those classes - everything fine.
Included those classes in a EXT plugin and deployed that plugin to
Liferay.
Created Arquilian test and run that test FROM ECLIPSE - Everything
works.
And now, thinking I got this covered, I created a new Service Plugin, created a test method:
public Boolean canICallMyService(){
MyWsCaller wsClient = new MyWsCaller();
return true;
}
And bam, exception:
09:33:21,394 ERROR
[http-bio-8080-exec-18][JSONWebServiceServiceAction:87] Unresolved
compilation problems: _ The import javax.xml.rpc cannot be
resolved_ The method X() from the type XServiceXmlCCServiceLocator
refers to the missing type ServiceException_ ServiceException cannot
be resolved to a type_ [Sanitized]
I know this must be related with me using Axis libs and Liferay using Axis libs as well, but I can't figure out how to overcome this classpath error. The import in question is jaxrpc.jar, that is included in Liferay's lib (webapps\ROOT\WEB-INF\lib). I have included in ALSO in my EXT plugin's lib directory. If I remove it from the EXT's lib, then the Arquilian test also fails with same error.
I have tried to put the required libs in the lib/ext in tomcat, this just makes Liferay give up on life at start with multiple Axis cast errors on all portlets.
Anyone has any idea what is the correct procedure and how can I replicate it?
I just want to use a Axis 1.4 generated webservice within a Portlet.
My current solution, that I consider kind of lame, is to deploy the webservice as a servlet in the same container and just run calls to localhost/service?q=parametersThatINeed. Works, and no Axis libs conflits.. but not really ideal.

Related

Why does cjs file extension on babel.config break module-resolver?

I have created a minimal reproducable example with a detailed README here.
In my expo app, I was having trouble using the babel module-resolver to use path aliases. My Metro bundling would fail when I used path aliases.
I learned that when I changed my babel.config file extension from .cjs to .js, the problem was resolved.
However, I do not understand why that would have any effect on whether the module-resolver plugin would work.
As described on babel's documentation, "Babel can be configured using any file extension natively supported by Node.js", with cjs specifically enumerated. And as I understand it, Expo by default creates a CommonJS babel.config file as it uses module.exports.
I have never created a GitHub issue, but perhaps this question is better suited as a babel-plugin-module-resolver issue, or I need to narrow down this issue further to determine whether Expo, or other babel plugins are relevant.
In short:
I tried creating a new expo app with npx create-expo-app to see if something about my project was effecting this issue. I then added a path alias to a test component and imported the component with the path alias. I ran expo which resulted in a bundle success. I then renamed babel.config.cjs and ran expo again with --clear, which resulted in a bundle failure "Unable to resolve [path alias]..."
I expected the cjs file extension to have no effect on whether the module-resolver caused an error.
What resulted was the module-resolver being fixed once I renamed babel.config.cjs to babel.config.js

Pentaho DI / Kettle / Spoon Configuration with External Jars

I am deveoloping a custom plugin for Pentaho DI / Kettle 4.4 and use custom Validation and XSLT jars as part of it.
Those jars are referenced in plugin.xml along with the plugin's jar itself and deployed in the same location as the plugin's jar.
When I try to load this plugin in Spoon GUI, I can see and run the plugin fine till I reach the reference to the external jars and after that I get ClassNotFOund Exception.
I have tried following so far but has not worked :
Add the expernal Jars to libext folder and expect those to be picked up automatically. - Failed. Jars not loaded.
Add -cp command line option to Spoon.bat and specify the Jar files - Did not work.
Turned on -verbose option and search everywhere in the output but the Jars are ignored.
Deployed the Jars next to the plugin's Jar file in the plugin's folder. - Jars are not recognized.
From Within the plugin, if I dynamically load (using Reflection and URL Class Loader) I am able to force the loading of the Jars and it works that way but I would like a simpler classpath fix.
Any class that I reference in the Jar through XSL externsion (XALAN-J Java Extension) is still not recognized / loaded and XSL terminates at the beginning of Extension call.
Searched Google and this site for something similar but did not find specific answers on why SPoon behaves so differently and avoids external code and content.
A similar issue is reported here though its too old and has not shown final conclusive fix. I tried all that it said. http://forums.pentaho.com/archive/index.php/t-77190.html
Requesting someone to help me identify whats missing. Thanks in advance,
Thanks to this seemingly obscure website and it fixed all pain.
http://www.arulraj.net/2014/09/how-to-access-external-java-libraries-with-in-pentaho.html
Basically, go to the launcher folder and edit the launcher.properties file to include any path, library etc. and it fixes all the issues I reported above. Wish Kettle documentatation had answers like this.

Tests won't run: "The executable for the test bundle at '../DerivedData/../*.xctest' could not be found"

I have a Xcode 5.1 project (projA) which included a private framework (frameworkB) via Cocoapods. Everything was working, building and testing and even the weather was nice. But, because the frameworkB is being developed in parallel with the projA, I decided to include the project of the frameworkB (proj B) in projA, again via Cocoapods but as a reference with :path ='path/to/projB'
In the result the projB compiles and builds and runs on device, the tests target also compiles and builds but doesn't run, the simulator start and this message is displayed:
2014-04-14 11:08:34.990 xctest[98973:303] The executable for the test bundle at
/Users/myNameHere/Library/Developer/Xcode/DerivedData/projB-manyLettersHere/Build
/Products/Debug-iphonesimulator/projB.xctest could not be found.
Program ended with exit code: 1
Also the weather is not so nice anymore.
Google didn't help. Other stackoverflow question are more about transition from Sentest cu XCTest.
Any hint that will put me on the right path will be greatly appreciated.
The cause and solution to this problem is (as usual) very simple:
The framework that was being built contained a bundle, which was required, but (of course) was not generated by the Pod project, even if in the podspec i specified the spec.resources pram. The solution was to create a spec.resource_bundle with the required name and resource files.
Why it would throw this error and not a compile-time or runtime error i still don't know :|
(the projB.xctest was present at the path in error)

Log4net cannot find configuration file when run from Visual Studio/Microsoft Test Framework

We are writing unit tests for our business layer running under .NET 4.0. The business layer is a straightforward C# class library that usually runs within SOAP and REST web services. Our application uses log4net within a separate wrapper assembly for logging. The C# code in the logging assembly has an assembly info directive that tells log4net the name of the configuration file, a la-
[assembly: log4net.Config.XmlConfigurator(ConfigFile="AcmeLogging.config", Watch=true)]
Initializing the log4net through the wrapper works fine in the web services. When we initialize it from with our unit test assembly it does not appear to see the configuration file. The configuratino file is configured through properties to be copied to the execution directory, and we do see it in the bin\debug directory. A quick console test program using the logging assembly running from within that same folder works fine. The curious thing is that the behavior problems are intermittent, and pop up on different developers' machines at different times and cannot be cured in any deterministic way.
Stepping through the wrapper assembly code, the log4netLogManager.GetLogger() call appears to return correctly, but the list of appenders returned by log.Logger.Repository.GetAppenders() is empty. Since this incorrect behavior is the same whether the file is in the Bin\Debug folder or not, we believe that it is not seeing the file.
Any clues as to what we're missing about running log4net in the Microsoft Test Framework would be greatly appreciated.
Unit tests are unique in the fact that if you need configuration files in your unit tests you need to include them as deployment items. Here is an example of how I do this within my test class:
[TestClass]
[DeploymentItem("hibernate.cfg.xml")]
public class AsyncForwardingAppenderTest
{
}
In addition to the Deployment attribute you need to Enable Deployment in your test settings. To do this go to Test->Edit Test Settings->. Then click on Deployment area on right. Click the checkbox Enable Deployment.
After doing this and running your test your config file should be located in your test results folder. TestResults\username_machine date stamp\Out. If your config file is not located in this folder it will not work. This is what the DeploymentItem attribute does. It sticks the file in this Out folder.
If you don't want to include the DeploymentItem attribute on every test class what I did was to create a base test class that all of the tests that use log4net inherit from and mark it with the DeploymentItem attribute.

Compile unit tests in Adobe CQ5 CRXDE that reference Felix OSGI bundle JUnit code

I want to write some unit tests that run within Adobe CQ 5.4. I am doing what is described in this article for testing within CQ:
http://jtoee.com/2011/09/799/
However, after I create the unit test class in my Java code, it won't compile within CRXDE because it can't resolve the org.junit namespaces. I installed and activated the JUnit bundle in Felix as described (Apache Sling JUnit Core), but I am guessing there is something else I need to do in order for this active Felix bundle to be found in CRXDE. The Felix bundle in the CQ5 instance I am connected to shows these exported packages:
junit.framework,version=4.8.2
org.apache.sling.junit,version=1.0.7.SNAPSHOT
org.apache.sling.junit.annotations,version=1.0.7.SNAPSHOT
org.junit,version=4.8.2
org.junit.matchers,version=4.8.2
org.junit.rules,version=4.8.2
org.junit.runner,version=4.8.2
org.junit.runner.manipulation,version=4.8.2
org.junit.runner.notification,version=4.8.2
org.junit.runners,version=4.8.2
org.junit.runners.model,version=4.8.2
In this sample unit test code below, the last three import statements "cannot be resolved."
import org.apache.sling.api.resource.*;
import org.junit.*;
import org.junit.runner.*;
import org.apache.sling.junit.annotations.*;
#RunWith(SlingAnnotationsTestRunner.class)
public class MyUnitTest {
public ResourceResolver getResourceResolver() {
try {
return getResourceResolverFactory().
getAdministrativeResourceResolver(null);
} catch (LoginException e) {
fail(e.toString());
}
return null;
}
}
It is my novice understanding that the OSGI bundle installed in Felix should be accessible for me to reference in my Java classes using CRXDE, but it isn't happening for the JUnit bundle I installed. Why not? What do I need to do to get CRXDE to find the OSGI bundle reference and compile within CRXDE?
What you're doing looks correct at first sight.
Did you try restarting CQ after installing the required bundles? In theory that should not be required but I'm wondering if the bundle compiler is picking up the newly available packages correctly.
I have uploaded a content package with a similar simple example at http://dl.dropbox.com/u/715349/cq5-examples/junit-tests-1.0.zip (md5 2915123ad581aa225bd531247ea02878), after installing this package on a fresh CQ 5.4 instance the example test is correctly executed via http://localhost:4502/system/sling/junit/
You might want to try my sample and compare with yours.
Short Answer
The problem is not with CQ, the problem is with CRXDE. CRXDE automatically downloads and caches required jar files on your local machine so they don't have to be retrieved constantly from CQ.
If you switch to the 'Package Explore' navigation and then expand the project '{SERVER}{PORT}{HASH}' you should see a folder called Referenced Libraries. Right click and select Build Path >> Configure Build Path. From there you can add any dependencies you want into the project.
Long Answer
CRXDE is not a good tool for creating bundles. It is much better to create bundles through a full fledged IDE such as Eclipse and utilize Apache Maven as a build tool. Apache Maven can automatically manage your dependencies, run tests on your code and separate test vs. runtime dependencies.
That way you can avoid having to load dependencies that you don't really need such a jUnit into your OSGi console and you have more control over how your bundle is built and deployed.
Day has a really nice guide to getting you set up with building CQ projects with Eclipse.
http://dev.day.com/docs/v5_2/html-resources/cq5_guide_developer/ch04s02.html