Comments (8)
I think this issue is related to #18
That one was put on hold since we didn't really have any good solutions yet. Feel free to post if you have any ideas.
from modelmapper.
Ok. I think I've solved it exporting these packages in my manifest, but now I have another problem when I add a new mapping (modelMapper.addMappings()).
In this case, I get the following exception:
Caused by: java.lang.IllegalArgumentException: class com.young.mknotif.dto.Notification$$EnhancerByModelMapper$$7f7540f3 is not an enhanced class
at org.modelmapper.internal.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:621)
at org.modelmapper.internal.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:612)
at org.modelmapper.internal.cglib.proxy.Enhancer.registerCallbacks(Enhancer.java:581)
at org.modelmapper.internal.ProxyFactory.proxyFor(ProxyFactory.java:87)
at org.modelmapper.internal.MappingBuilderImpl.getSource(MappingBuilderImpl.java:166)
at org.modelmapper.PropertyMap.configure(PropertyMap.java:267)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_30]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_30]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_30]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_30]
at org.modelmapper.internal.MappingBuilderImpl.build(MappingBuilderImpl.java:123)
... 33 more
Have you an idea how to solve it?
from modelmapper.
What does the mapping code look like?
from modelmapper.
This is my map:
public class NotificationUnconsumedMappingBuilder extends PropertyMap<Notification, NotificationUnconsumed> {
@Override
protected void configure() {
map(source.getFact().getFactContexts()).setContextList(null);
map().setCreated(source.getFact().getCreated());
map().setMessage(source.getFact().getMessage());
map().setRecipient(source.getRecipient().getUri());
map().setType(source.getFact().getFactType().getUri());
}
}
And I add property map to the model mapper:
mapperManager.addMappings(new NotificationUnconsumedMappingBuilder());
from modelmapper.
The mapping code looks fine. Was there any more to the stacktrace?
from modelmapper.
I've solved the problem, but I've had to modify the pom file for regenerate the MANIFEST file. I've removed the shade plugin and I've only used the bundle plugin without any special configuration:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
</plugin>
This configuration does not copy cglib packages neither ignores it. See the result:
Manifest-Version: 1.0
Bnd-LastModified: 1355310050839
Build-Jdk: 1.6.0_30
Built-By: xavi
Bundle-ManifestVersion: 2
Bundle-Name: ModelMapper
Bundle-SymbolicName: org.modelmapper.modelmapper
Bundle-Version: 0.5.3
Created-By: Apache Maven Bundle Plugin
Export-Package: org.modelmapper;uses:="org.modelmapper.spi,org.modelmapp
er.config,org.modelmapper.builder";version="0.5.3",org.modelmapper.buil
der;uses:="org.modelmapper";version="0.5.3",org.modelmapper.config;uses
:="org.modelmapper.spi,org.modelmapper";version="0.5.3",org.modelmapper
.convention;uses:="org.modelmapper.spi";version="0.5.3",org.modelmapper
.spi;uses:="org.modelmapper";version="0.5.3"
Import-Package: javax.xml.datatype,net.sf.cglib.core,net.sf.cglib.proxy,
org.modelmapper.builder,org.modelmapper.config,org.modelmapper.conventi
on
Tool: Bnd-1.50.0
I guess is not the best solution, but it works in OSGi
from modelmapper.
I just merged #18 which should resolve this problem. Try the latest build and see how it looks.
from modelmapper.
Hi,
I had similar problem with ReflectUtils and Spring Source dm Server 2.0.5
Thanks to the approach described by xfolch, I recompiled the latest version of model mapper according to his description and added external dependency on net.sf.cglib.* packages to bundle where mapper is used and to bundle that contains model classes.
This helped me to solve my problem.
Thanks a lot jhalterman for the great mapping tool!
And thank you xfolch for a good tip on how to solve OSGi issue!
from modelmapper.
Related Issues (20)
- ModelMapper cannot map all fields when mapping from proxy class over interface HOT 1
- ModelMapper mapping is updating table primary key instead of foreign key. HOT 1
- Error mapping, then reboot, works for a while
- How to skip not loaded Lazy fields?
- Test fails after upgrading from 3.1.0 to 3.1.1
- Java 21 support HOT 18
- Support of Java Module System
- Custom mapping in nested objects HOT 4
- Skip field of generic class HOT 1
- Mapping Source object to Destination object
- Mapping nested generic object with generic HOT 1
- Use specific converter for one field
- Model Mapper does not map values correctly (Intermittent - once in a few tries)
- Model Mapper Low performance
- Jackson Module: @JsonTypeInfo support for automatically handling inheritance HOT 1
- ModelMapper fails to map nested entity user field HOT 1
- When condition does not work for null-field
- How to ignore mapping errors HOT 1
- ModelMapper not working with nested generics
- modelmapper Hot deployment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modelmapper.