Jibx : Internal error - cannot modify class from jar - jibx

I have two Projects : Project A and Project B
Project A have a Class Items, Which also have collection of same class Items.
Class Items {
private List list;
}
I have included Project A in Project B class path .
Now Project B contains Jibx binding Configuartion, Now When I tried to bind Class Items in binding.xml of my project B.
<collection item-type="projectA.Items" field="items" usage="optional" create-type="java.util.ArrayList"/>
</mapping>
this may be due to an error in your binding or classpath, or to an error in the JiBX code *
[bind] java.lang.IllegalStateException: Internal error - cannot modify class from project A jar.

JiBX has great multi-project support.
Check out documentation here for JiBX modular support.
We have a simple multi-project example here in our github repository.
Good Luck!
Don Corley
JiBX Contributor

Related

Can the ConfigurationAPI in Liferay DXP be used for Plugin sdk portlet?

I have followed given 2 tutorials to use COnfigurationAPI in a Liferay dxp plugins SDK portlet built using Ant/Ivy.
COnfiguration API 1
COnfiguration API 2.
Below is the configuration class used:
package com.preferences.interfaces;
import com.liferay.portal.configuration.metatype.annotations.ExtendedObjectClassDefinition;
import aQute.bnd.annotation.metatype.Meta;
#ExtendedObjectClassDefinition(
category = "preferences",
scope = ExtendedObjectClassDefinition.Scope.GROUP
)
#Meta.OCD(
id = "com.preferences.interfaces.UnsupportedBrowserGroupServiceConfiguration",
name = "UnsupportedBrowser.group.service.configuration.name"
)
public interface UnsupportedBrowserGroupServiceConfiguration {
#Meta.AD(deflt = "", required = false)
public String displayStyle();
#Meta.AD(deflt = "0", required = false)
public long displayStyleGroupId(long defaultDisplayStyleGroupId);
}
Post following the steps,I am getting the below error:
ERROR [CM Configuration Updater (ManagedService Update: pid=[com.preferences.interfaces.UnsupportedBrowserGroupServiceConfiguration])][org_apache_felix_configadmin:97] [org.osgi.service.cm.ManagedService, id=7082, bundle=297//com.liferay.portal.configuration.settings-2.0.15.jar?lpkgPath=C:\dev\Liferay\osgi\marketplace\Liferay Foundation.lpkg]: Unexpected problem updating configuration com.preferences.interfaces.UnsupportedBrowserGroupServiceConfiguration {org.osgi.service.cm.ConfigurationAdmin}={service.vendor=Apache Software Foundation, service.pid=org.apache.felix.cm.ConfigurationAdmin, service.description=Configuration Admin Service Specification 1.2 Implementation, service.id=56, service.bundleid=643, service.scope=bundle}
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
So,does this process need a osgi module as mandatory or can we do it using plusings sdk portlet built using ant as well?
Without disecting the error message Caused by: java.lang.IllegalArgumentException: wrong number of arguments:
The way you build your plugin (Ant, Maven, Gradle, manually) doesn't make a difference, as long as you build a plugin that will be understood by the runtime. aQute.bnd.annotation.metatype.Meta points firmly into the OSGi world, and makes it almost certain that you'll need an OSGi module. You can build this with Ant, of course. Even in Ant you can embed tools like bnd, or you can write the proper Manifest.mf to include in your module manually (just kidding - you don't want to do it manually, but it would work).
Recommendation: Instead of moving everything over: Try to reproduce this with a minimal example in gradle or better Liferay Workspace (which is gradle based), just to get all the automatic wiring in. Check if it makes a difference and compare the generated output from your Ant build process with the workspace output. Pay specific attention to the Manifest.
In order to build the proper Manifest, you want to use bnd - if the Manifest turns out to be your issue: Find a way to embrace bnd - if that's by saying goodby to Ant, or by tweaking your build script remains your decision.

'Application' doesn't exist in System.Windows namespace (in library project)

I'm working on .net standard 2.0 library project for my solution.
It have to include this method:
public Task ShutdownAsync()
{
Application.Current.Shutdown();
}
Problem is it gives me an error:
The name 'Application' does not exist in the current context
It also doesn't exist in System.Windows.
As answers to similar questions suggests I tried to add reference to PresentationFramework. But it isn't on the list.
Looks like it have something to do with the fact I'm doing it in a library project targeted at .net standard 2.0.
Is here any way to add proper reference to this project?
.Net standard 2.0 was the problem.
This class is platform-specific so I should target .Net Platform instead.

Why Spring does not show compilation error with AbstractHttpMessageConverter if JACKSON is not present in classpath

Spring document says that the Jackson 2 API should be present in the classpath for MappingJackson2HttpMessageConverter to work.
In the source code of MappingJackson2HttpMessageConverter, Spring is importing the classes from jackson API.
31 --> import com.fasterxml.jackson.core.JsonEncoding;
32 --> import com.fasterxml.jackson.core.JsonGenerator;
33 --> import com.fasterxml.jackson.databind.JavaType;
34 --> import com.fasterxml.jackson.databind.ObjectMapper;
Now my question is if JACKSON is not present in the classpath then the above code in MappingJackson2HttpMessageConverter should throw an compile time error. But why does not this class has any compilation error.
First, Spring is using reflection to determine if the Jackson library is on the classpath. You can see that in action in WebMvcConfigurationSupport:
private static final boolean jackson2Present =
ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper",
WebMvcConfigurationSupport.class.getClassLoader()) &&
ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator",
WebMvcConfigurationSupport.class.getClassLoader());
Now WebMvcConfigurationSupport itself also has the following: import com.fasterxml.jackson.databind.ObjectMapper;.
But two things come into play here:
those classes are needed at compile time for Spring Framework, not your application; just like all libraries supported by Spring, they're optional dependencies in Spring's build
those classes, even if declared as imports in a class, are only loaded by the JVM when they're used/read.
The same constraints apply to Spring 4.x for its JDK8 support, while still working on JDK6+. See this blog post for more details.

MvvmCross. It is not possible to add a custom dll reference to MvvmCross.Core library project

I'm trying to add a DLL to my MvvmCross.core library project. However the included namespaces cannot be resolved for some reason, when I'm trying to refer the namespaces from one of the ViewModels. In object viewer I can see the included namespaces.
When I refer the same DLL from MvvmCross.Droid project I do not see the problem.
Unfortunate I do not have the source code so I need to refer it as a DLL.
I have tried this both on VS2013 and Xamarin Studio
Is your MvvmCross.core project a portable class library? If it is you won't be able to reference it.
What you can do is create another platform specific project, MyThing.Droid, and reference the .DLL. In the MvvmCross.core project, create an interface, IMyThingService. In MyThing.Droid create, MyThingService that implements IMyThingService and does the stuff you want. Now you can get a reference to IMyThingService and call DoStuff() from the MvvmCross.core project.
You can also use the plugin model provided by MvvmCross to accomplish this.
public class MyThingService : IMyThingService
{
public void DoStuff()
{
}
}
public interface IMyThingService
{
void DoStuff();
}

netbeans: API Versioning tab, public packages org.demo.textfilter not automatically imported

following the tutorial at
http://platform.netbeans.org/tutorials/nbm-quick-start.html#lookup
"Right-click the "TextFilter" module, choose Properties, and use the "API Versioning" tab so specify that the package containing the interface should be available throughout the application: " (org.demo.textfilter is set to public)
the problem is, this public package is not automatically imported by another class in another module with dependency on the TextFilter module. Whenever the dependencies are added, shouldn't the dependent classes/modules automatically import the dependencies ?
Your question is a bit hard to interpret, so I will tell you what I think you are asking and then provide an answer....
I assume that you have a couple netbeans module projects: TextFilter and MyModule.
Initially, MyModule depends on TextFilter.
There is a third module, let's call it Filter... that has a public, exported class org.filter.BaseClass.
You have made TextFilter dependent on Filter, so you can use the org.filter.BaseClass in the TextFilter module.
You are now attempting to use org.filter.BaseClass in MyModule and that is not working.
Module dependency defines the visibility of classes. That visibility does not span modules.
If you want MyModule to be able to use org.filter.BaseClass, you need to explicitly define the dependency between the module Filter and MyModule.