You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by tgp <to...@sopra.com> on 2015/10/28 13:16:42 UTC
Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Hi everybody,
I’m doing a migration of a webapp which uses EJB 2.1 and CMP from Weblogic
to Tomee 1.7.2.
After rewriting the ejb-jar.xml and doing the right mapping with the
database in the orm.xml the server works quite well on everything regarding
SELECTS and so on, but when I try to create a Bean to be inserted in the
database I get the OutOf Memory - Java Heap error.
Everything, until now, has gone more or less alright but now I’m in one
point I’m blocked and I’m not sure on how to continue.
I’ve done debug on the OpenEJB sources and I’ve found the cause is in the
bean which is being created, in the ejbPostCreate, when it tries to assign a
variable which is another bean.
/**
* The container invokes this method immediately after it calls ejbCreate.
*/
public void ejbPostCreate(...)
throws javax.ejb.CreateException {
this.setArticle(article); //The out of memory error is right here
...
}
>From the log I can get the SELECT query that’s is run in the database for
assigning that bean and it returns ~700.000 rows so, my guess is that the
server tries to create all of those objects and that’s why I get that
OutOfMemoryError (it takes a while until I get the error).
If I comment that line and all the set inside of ejbPostCreate it works, but
latter I get quite a lot of NullPointerExceptions because the variables
haven't been initialized.
I’ve set the memory limit to 512Mb and also I’ve also tried to set all the
relations with fetch=LAZY but without success.
Any ideas on what can be the problem? Is the approach of doing the
this.setArticle(...) inside the ejbPostCreate correct or it's deprecated?
Thank you very much for any help or advice you could give me.
Tomás
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Interesting thread (discussion, findings, etc...). Thanks to all.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by tgp <to...@sopra.com>.
Thanks for your comment, after that I've come to read about it in the Java
Persistence Wikibook I've found the cause of the problem.
https://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Getters_and_Setters
Last two paragraphs:
/
Some expect the JPA provider to have magic that automatically maintains
relationships. This was actually part of the EJB CMP 2 specification.
However the issue is if the objects are detached or serialized to another
VM, or new objects are related before being managed, or the object model is
used outside the scope of JPA, then the magic is gone, and the application
is left figuring things out, so in general it may be better to add the code
to the object model. However some JPA providers do have support for
automatically maintaining relationships.
In some cases it is undesirable to instantiate a large collection when
adding a child object. One solution is to not map the bi-directional
relationship, and instead query for it as required. Also some JPA providers
optimize their lazy collection objects to handle this case, so you can still
add to the collection without instantiating it.
/
It seems to me that in the original application (EJB CMP2) the relationships
were bi-directional, and because of that this "magic" of maintaining the two
sides of the relationship was done automatically.
So now that I use OpenEJB with JPA I have to do this "magic" manually and
delete all bi-directional relationships which are likelly to get really big.
Thanks for your comments.
Tomás
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676652.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by hwaastad <he...@waastad.org>.
Hi,
usually, when there is a one to very many relation its a good thing to use
uni directional relations.
Else, you most certainly will face OOM one day :-)
br hw
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676651.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by tgp <to...@sopra.com>.
Hi again,
I've more or less found a solution to the problem, which has been just
removing the inverse one-to-many relation from the Article entity in the
orm.xml.
-------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
Now it works, but the problem is, I don't know why, I have to set the
primary keys manually.
What before was like this:
Now is like this:
Maybe should I map it like a collection instead many-to-one and one-to-many
in orm.xml??
What about setting the Access to field or property? Sorry about my noob
questions but I'm kind of a begginer with OpenEJB + JPA.
Thanks,
Tomás
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676650.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by tgp <to...@sopra.com>.
>From the SQL Developer, after doing the same query that is shown in the log,
about ~720.000 rows.
In the older application (done in Weblogic 8.1) doing this in the
ejbPostCreate didn't charge the rows, but in OpenEJB, from what I've seen,
it tries to charge them even they are LAZY.
My toughts are that maybe, because I do the this.setArticle(articleLocal)
inside the ejbPostCreate, I'm forcing OpenEJB to charge the whole collection
of articles... but, unluckly, still haven't found any workaround.
Thanks again,
Tomás
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676649.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by Romain Manni-Bucau <rm...@gmail.com>.
what is the size of the collection you try to retrieve?
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>
2015-10-29 9:54 GMT+01:00 tgp <to...@sopra.com>:
> Hi again,
>
> Yesterday I tried to create the simple Maven application without success
> (the application is too big), so, at this point, I think all I can do is to
> show you this I’ve found debugging... I think the most probable cause is
> some bad configuration I’ve done.
>
> The problem occurs in
> org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy, in the
> load method, in this block of code:
>
> // load values
> Result res = union.execute(store, fetch);
> try {
> int seq = -1;
> while (res.next()) {
> if (ct != null && field.getOrderColumn() != null)
> seq = res.getInt(field.getOrderColumn());
> setMappedBy(sm.getObjectId(), sm, coll, res);
> add(store, coll, loadElement(sm, store, fetch, res,
> resJoins[res.indexOf()]));
> }
> if (ct != null && field.getOrderColumn() != null)
> ct.setNextSequence(seq + 1);
> } finally {
> res.close();
> }
>
> It nevers exits the while and thats why I finally get the Java Heap –
> OutOfMemoryError.
>
> And this is the callstack:
>
> Daemon Thread [http-bio-8080-exec-10] (Suspended (breakpoint at line 580 in
> StoreCollectionFieldStrategy))
> owns: SocketWrapper<E> (id=831)
>
>
> RelationCollectionInverseKeyFieldStrategy(StoreCollectionFieldStrategy).load(OpenJPAStateManager,
> JDBCStore, JDBCFetchConfiguration) line: 580
> FieldMapping.load(OpenJPAStateManager, JDBCStore,
> JDBCFetchConfiguration)
> line: 936
> JDBCStoreManager.load(OpenJPAStateManager, BitSet,
> FetchConfiguration, int,
> Object) line: 680
> ROPStoreManager(DelegatingStoreManager).load(OpenJPAStateManager,
> BitSet,
> FetchConfiguration, int, Object) line: 117
> ROPStoreManager.load(OpenJPAStateManager, BitSet,
> FetchConfiguration, int,
> Object) line: 78
> StateManagerImpl.loadFields(BitSet, FetchConfiguration, int,
> Object) line:
> 3145
> StateManagerImpl.loadField(int, int, boolean, boolean) line: 3225
> StateManagerImpl.beforeAccessField(int) line: 1690
> StateManagerImpl.accessingField(int) line: 1624
> ArticleSCHEMA.pcGetservices(ArticleSCHEMA) line: not available
> ArticleSCHEMA.OpenEJB_addCmr(String, Object) line: not available
> SingleValuedCmr<Bean,Proxy>.set(Bean, Proxy) line: 78
> ServiceSCHEMA.setArticle(ArticleLocal) line: not available
> ServiceSCHEMA(ServiceBean).ejbPostCreate(String, String, Date,
> StatutLocal,
> ArticleLocal, ContactLocal, ClientLocal, String, String, String,
> CodePostalLocal, String, PrestataireLocal, UtilisateurLocal, String,
> BigDecimal, String, String, CentreLocal, Integer, Integer) line: 450
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
> not
> available [native method]
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
> Method.invoke(Object, Object...) line: 597
> CmpContainer.createEJBObject(Method, Object[], ThreadContext,
> InterfaceType) line: 635
> CmpContainer.invoke(Object, InterfaceType, Class, Method,
> Object[], Object)
> line: 267
> EntityEjbHomeHandler(EjbHomeProxyHandler).create(Class, Method,
> Object[],
> Object) line: 384
> EntityEjbHomeHandler(EjbHomeProxyHandler)._invoke(Object, Class,
> Method,
> Object[]) line: 199
> EntityEjbHomeHandler(BaseEjbProxyHandler).invoke(Object, Method,
> Object[])
> line: 322
> $Proxy173.create(String, String, Date, StatutLocal, ArticleLocal,
> ContactLocal, ClientLocal, String, String, String, CodePostalLocal, String,
> PrestataireLocal, UtilisateurLocal, String, BigDecimal, String, String,
> CentreLocal, Integer, Integer) line: not available
>
> SouscriptionSession(SouscriptionBean).prendreRdvOuDiffere(ServiceVO,
> UtilisateurVO) line: 771
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
> not
> available [native method]
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
> Method.invoke(Object, Object...) line: 597
>
>
> ReflectionInvocationContext$BeanInvocation(ReflectionInvocationContext$Invocation).invoke()
> line: 192
> ReflectionInvocationContext.proceed() line: 173
> StatsInterceptor.record(InvocationContext, Method) line: 181
> StatsInterceptor.invoke(InvocationContext) line: 100
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
> not
> available [native method]
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
> Method.invoke(Object, Object...) line: 597
>
>
> ReflectionInvocationContext$InterceptorInvocation(ReflectionInvocationContext$Invocation).invoke()
> line: 192
> ReflectionInvocationContext.proceed() line: 173
> InterceptorStack.invoke(Object...) line: 85
> StatelessContainer._invoke(Method, Method, Object[], Instance,
> ThreadContext, InterfaceType) line: 227
> StatelessContainer.invoke(Object, InterfaceType, Class, Method,
> Object[],
> Object) line: 194
>
>
> StatelessEjbObjectHandler(EjbObjectProxyHandler).synchronizedBusinessMethod(Class<?>,
> Method, Object[]) line: 308
>
> StatelessEjbObjectHandler(EjbObjectProxyHandler).businessMethod(Class<?>,
> Method, Object[], Object) line: 303
> StatelessEjbObjectHandler(EjbObjectProxyHandler)._invoke(Object,
> Class,
> Method, Object[]) line: 92
> StatelessEjbObjectHandler(BaseEjbProxyHandler).invoke(Object,
> Method,
> Object[]) line: 322
> $Proxy243.prendreRdvOuDiffere(ServiceVO, UtilisateurVO) line: not
> available
> SouscriptionDelegate.prendreRdvOuDiffere(ServiceVO, UtilisateurVO)
> line:
> 247
> CreationDiagGrDFAction.creation(ActionMapping, ActionForm,
> HttpServletRequest, HttpServletResponse) line: 109
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
> not
> available [native method]
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
> Method.invoke(Object, Object...) line: 597
>
> CreationDiagGrDFAction(DispatchAction).dispatchMethod(ActionMapping,
> ActionForm, HttpServletRequest, HttpServletResponse, String) line: 266
> CreationDiagGrDFAction(BaseAction).execute(ActionMapping,
> ActionForm,
> HttpServletRequest, HttpServletResponse) line: 75
> ExecuteAction.execute(ActionContext, Action, ActionConfig,
> ActionForm)
> line: 53
> ExecuteAction(AbstractExecuteAction).execute(ActionContext) line:
> 64
> ExecuteAction(ActionCommandBase).execute(Context) line: 48
> ChainBase.execute(Context) line: 190
> LookupCommand.execute(Context) line: 304
> ChainBase.execute(Context) line: 190
> ComposableRequestProcessor.process(HttpServletRequest,
> HttpServletResponse)
> line: 280
> ActionServlet.process(HttpServletRequest, HttpServletResponse)
> line: 1858
> ActionServlet.doPost(HttpServletRequest, HttpServletResponse)
> line: 459
> ActionServlet(HttpServlet).service(HttpServletRequest,
> HttpServletResponse)
> line: 650
> ActionServlet(HttpServlet).service(ServletRequest,
> ServletResponse) line:
> 731
> ApplicationFilterChain.internalDoFilter(ServletRequest,
> ServletResponse)
> line: 303
> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
> line: 208
> LoginFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
> line:
> 149
> ApplicationFilterChain.internalDoFilter(ServletRequest,
> ServletResponse)
> line: 241
> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
> line: 208
> StandardWrapperValve.invoke(Request, Response) line: 220
> StandardContextValve.invoke(Request, Response) line: 122
> OpenEJBValve.invoke(Request, Response) line: 44
> NonLoginAuthenticator(AuthenticatorBase).invoke(Request, Response)
> line:
> 505
> StandardHostValve.invoke(Request, Response) line: 170
> ErrorReportValve.invoke(Request, Response) line: 103
> AccessLogValve.invoke(Request, Response) line: 957
> StandardEngineValve.invoke(Request, Response) line: 116
> CoyoteAdapter.service(Request, Response) line: 423
>
> Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line:
> 1079
>
>
> Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>,
> SocketStatus) line: 620
> JIoEndpoint$SocketProcessor.run() line: 318
> ThreadPoolExecutor$Worker.runTask(Runnable) line: 895
> ThreadPoolExecutor$Worker.run() line: 918
> TaskThread$WrappingRunnable.run() line: 61
> TaskThread(Thread).run() line: 662
>
> Thanks for everything,
>
> Tomás
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676647.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by tgp <to...@sopra.com>.
Hi again,
Yesterday I tried to create the simple Maven application without success
(the application is too big), so, at this point, I think all I can do is to
show you this I’ve found debugging... I think the most probable cause is
some bad configuration I’ve done.
The problem occurs in
org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy, in the
load method, in this block of code:
// load values
Result res = union.execute(store, fetch);
try {
int seq = -1;
while (res.next()) {
if (ct != null && field.getOrderColumn() != null)
seq = res.getInt(field.getOrderColumn());
setMappedBy(sm.getObjectId(), sm, coll, res);
add(store, coll, loadElement(sm, store, fetch, res,
resJoins[res.indexOf()]));
}
if (ct != null && field.getOrderColumn() != null)
ct.setNextSequence(seq + 1);
} finally {
res.close();
}
It nevers exits the while and thats why I finally get the Java Heap –
OutOfMemoryError.
And this is the callstack:
Daemon Thread [http-bio-8080-exec-10] (Suspended (breakpoint at line 580 in
StoreCollectionFieldStrategy))
owns: SocketWrapper<E> (id=831)
RelationCollectionInverseKeyFieldStrategy(StoreCollectionFieldStrategy).load(OpenJPAStateManager,
JDBCStore, JDBCFetchConfiguration) line: 580
FieldMapping.load(OpenJPAStateManager, JDBCStore, JDBCFetchConfiguration)
line: 936
JDBCStoreManager.load(OpenJPAStateManager, BitSet, FetchConfiguration, int,
Object) line: 680
ROPStoreManager(DelegatingStoreManager).load(OpenJPAStateManager, BitSet,
FetchConfiguration, int, Object) line: 117
ROPStoreManager.load(OpenJPAStateManager, BitSet, FetchConfiguration, int,
Object) line: 78
StateManagerImpl.loadFields(BitSet, FetchConfiguration, int, Object) line:
3145
StateManagerImpl.loadField(int, int, boolean, boolean) line: 3225
StateManagerImpl.beforeAccessField(int) line: 1690
StateManagerImpl.accessingField(int) line: 1624
ArticleSCHEMA.pcGetservices(ArticleSCHEMA) line: not available
ArticleSCHEMA.OpenEJB_addCmr(String, Object) line: not available
SingleValuedCmr<Bean,Proxy>.set(Bean, Proxy) line: 78
ServiceSCHEMA.setArticle(ArticleLocal) line: not available
ServiceSCHEMA(ServiceBean).ejbPostCreate(String, String, Date, StatutLocal,
ArticleLocal, ContactLocal, ClientLocal, String, String, String,
CodePostalLocal, String, PrestataireLocal, UtilisateurLocal, String,
BigDecimal, String, String, CentreLocal, Integer, Integer) line: 450
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CmpContainer.createEJBObject(Method, Object[], ThreadContext,
InterfaceType) line: 635
CmpContainer.invoke(Object, InterfaceType, Class, Method, Object[], Object)
line: 267
EntityEjbHomeHandler(EjbHomeProxyHandler).create(Class, Method, Object[],
Object) line: 384
EntityEjbHomeHandler(EjbHomeProxyHandler)._invoke(Object, Class, Method,
Object[]) line: 199
EntityEjbHomeHandler(BaseEjbProxyHandler).invoke(Object, Method, Object[])
line: 322
$Proxy173.create(String, String, Date, StatutLocal, ArticleLocal,
ContactLocal, ClientLocal, String, String, String, CodePostalLocal, String,
PrestataireLocal, UtilisateurLocal, String, BigDecimal, String, String,
CentreLocal, Integer, Integer) line: not available
SouscriptionSession(SouscriptionBean).prendreRdvOuDiffere(ServiceVO,
UtilisateurVO) line: 771
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ReflectionInvocationContext$BeanInvocation(ReflectionInvocationContext$Invocation).invoke()
line: 192
ReflectionInvocationContext.proceed() line: 173
StatsInterceptor.record(InvocationContext, Method) line: 181
StatsInterceptor.invoke(InvocationContext) line: 100
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ReflectionInvocationContext$InterceptorInvocation(ReflectionInvocationContext$Invocation).invoke()
line: 192
ReflectionInvocationContext.proceed() line: 173
InterceptorStack.invoke(Object...) line: 85
StatelessContainer._invoke(Method, Method, Object[], Instance,
ThreadContext, InterfaceType) line: 227
StatelessContainer.invoke(Object, InterfaceType, Class, Method, Object[],
Object) line: 194
StatelessEjbObjectHandler(EjbObjectProxyHandler).synchronizedBusinessMethod(Class<?>,
Method, Object[]) line: 308
StatelessEjbObjectHandler(EjbObjectProxyHandler).businessMethod(Class<?>,
Method, Object[], Object) line: 303
StatelessEjbObjectHandler(EjbObjectProxyHandler)._invoke(Object, Class,
Method, Object[]) line: 92
StatelessEjbObjectHandler(BaseEjbProxyHandler).invoke(Object, Method,
Object[]) line: 322
$Proxy243.prendreRdvOuDiffere(ServiceVO, UtilisateurVO) line: not available
SouscriptionDelegate.prendreRdvOuDiffere(ServiceVO, UtilisateurVO) line:
247
CreationDiagGrDFAction.creation(ActionMapping, ActionForm,
HttpServletRequest, HttpServletResponse) line: 109
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CreationDiagGrDFAction(DispatchAction).dispatchMethod(ActionMapping,
ActionForm, HttpServletRequest, HttpServletResponse, String) line: 266
CreationDiagGrDFAction(BaseAction).execute(ActionMapping, ActionForm,
HttpServletRequest, HttpServletResponse) line: 75
ExecuteAction.execute(ActionContext, Action, ActionConfig, ActionForm)
line: 53
ExecuteAction(AbstractExecuteAction).execute(ActionContext) line: 64
ExecuteAction(ActionCommandBase).execute(Context) line: 48
ChainBase.execute(Context) line: 190
LookupCommand.execute(Context) line: 304
ChainBase.execute(Context) line: 190
ComposableRequestProcessor.process(HttpServletRequest, HttpServletResponse)
line: 280
ActionServlet.process(HttpServletRequest, HttpServletResponse) line: 1858
ActionServlet.doPost(HttpServletRequest, HttpServletResponse) line: 459
ActionServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse)
line: 650
ActionServlet(HttpServlet).service(ServletRequest, ServletResponse) line:
731
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
line: 303
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
LoginFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line:
149
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
StandardWrapperValve.invoke(Request, Response) line: 220
StandardContextValve.invoke(Request, Response) line: 122
OpenEJBValve.invoke(Request, Response) line: 44
NonLoginAuthenticator(AuthenticatorBase).invoke(Request, Response) line:
505
StandardHostValve.invoke(Request, Response) line: 170
ErrorReportValve.invoke(Request, Response) line: 103
AccessLogValve.invoke(Request, Response) line: 957
StandardEngineValve.invoke(Request, Response) line: 116
CoyoteAdapter.service(Request, Response) line: 423
Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line:
1079
Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>,
SocketStatus) line: 620
JIoEndpoint$SocketProcessor.run() line: 318
ThreadPoolExecutor$Worker.runTask(Runnable) line: 895
ThreadPoolExecutor$Worker.run() line: 918
TaskThread$WrappingRunnable.run() line: 61
TaskThread(Thread).run() line: 662
Thanks for everything,
Tomás
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676647.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by tgp <to...@sopra.com>.
Hi,
Thanks for the quick reply!
The webapp is quite big, but I'm going to try to make a small maven project
with the classes involved to place it in github.
The only thing i'm not sure at this moment is the query to the DB, but I'll
find a solution.
Thanks again,
Tomás
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642p4676644.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Problem with Tomee on ejbPostCreate method - OutOfMemoryError
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
are you able to extract it in a small maven project you can share on
github?
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>
2015-10-28 13:16 GMT+01:00 tgp <to...@sopra.com>:
> Hi everybody,
>
> I’m doing a migration of a webapp which uses EJB 2.1 and CMP from Weblogic
> to Tomee 1.7.2.
>
> After rewriting the ejb-jar.xml and doing the right mapping with the
> database in the orm.xml the server works quite well on everything regarding
> SELECTS and so on, but when I try to create a Bean to be inserted in the
> database I get the OutOf Memory - Java Heap error.
>
> Everything, until now, has gone more or less alright but now I’m in one
> point I’m blocked and I’m not sure on how to continue.
>
> I’ve done debug on the OpenEJB sources and I’ve found the cause is in the
> bean which is being created, in the ejbPostCreate, when it tries to assign
> a
> variable which is another bean.
>
> /**
> * The container invokes this method immediately after it calls
> ejbCreate.
> */
> public void ejbPostCreate(...)
> throws javax.ejb.CreateException {
>
> this.setArticle(article); //The out of memory error is
> right here
>
> ...
> }
>
> From the log I can get the SELECT query that’s is run in the database for
> assigning that bean and it returns ~700.000 rows so, my guess is that the
> server tries to create all of those objects and that’s why I get that
> OutOfMemoryError (it takes a while until I get the error).
>
> If I comment that line and all the set inside of ejbPostCreate it works,
> but
> latter I get quite a lot of NullPointerExceptions because the variables
> haven't been initialized.
>
> I’ve set the memory limit to 512Mb and also I’ve also tried to set all the
> relations with fetch=LAZY but without success.
>
> Any ideas on what can be the problem? Is the approach of doing the
> this.setArticle(...) inside the ejbPostCreate correct or it's deprecated?
>
> Thank you very much for any help or advice you could give me.
>
> Tomás
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Problem-with-Tomee-on-ejbPostCreate-method-OutOfMemoryError-tp4676642.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>