You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Arnav-A <ar...@gmail.com> on 2010/08/12 18:40:55 UTC

PCEnhancement

Hi
  I am using RSA 7.5.4 as my IDE, and WebSphere Application Server 7.0 for
my Application development. 
  I have a web project and a JPA project having Manager classes, Entity
classes and my Web project has a reference to JPA project. 
  I am doing testing in my localhost environment.
  
  I modify the java code, clean my projects, remove ear file from the Server
instance, add ear file to the server instance, run my jsp on the server to
fetch data from the database and it works fine. 
  If I modify the java code, clean my projects, run my jsp on the server to
fetch data from the database i.e. no remove and add of the ear file to
server instance, 
  it gives me exception stating that class com.*.Batch has not been
enhanced. 
  Now, If I remove & add the ear file to the server and  it works fine.
  
  I don't want to remove and add ear file everytime I modify my code. I have
seen couple of post regarding enhancing the entity classes i.e. using
build.xml or javaagent. 
  
  I tried to add javaagent to generic JVM arguement i.e.
-javaagent:C:\com.ibm.ws.jpa.jar and run the appilcation again and it gave
me exception stating that javax.persistence.spi.PersistenceProvider class
could not be found.
  
  I am not sure what should I do for entity class enhancement so that I
don't need to remove and add EAR file for every code modification. 
  
  I don't want to use build.xml since it will also be needed to be run
everytime I modify my project.

Please advise
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/PCEnhancement-tp5416877p5416877.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Re: PCEnhancement

Posted by Michael Dick <mi...@gmail.com>.
You can use javap to determine whether the entity have been enhanced. If the
entity class implements PersistenceCapable the enhancer has done its stuff.

An example from our build
$ javap org.apache.openjpa.meta.Person
Compiled from "Person.java"
public class org.apache.openjpa.meta.Person extends java.lang.Object
implements java.io.Serializable,*
org.apache.openjpa.enhance.PersistenceCapable*{
. . .

Based on Kevin's email I'd say that the app should be restarted
automatically though - but maybe this will help you make progress in the
mean time.

-mike

On Fri, Aug 13, 2010 at 11:45 AM, Arnav-A <ar...@gmail.com> wrote:

>
> Thanks a lot for the respnse.
>
> Let me answer all the questions
>
> 1. Do you have a PMR open yet?
> => No. I have not created any PMR for this problem.
>
> 2. Have you tried stopping and restarting the application?
> => Yes. In that case, it works fine. Either I restart the application after
> cleanup OR remove and add application to server, it works fine.
>
> 3. So, does your environment have the automatic publish action turned on or
> off?
> => Yes. I have automatic publish action turned on.
>
> In the mean time, I was looking at the option for build time entity
> enhancement mentioned in the link
>
> http://openjpa.apache.org/enhancement-with-eclipse.html?wwparam=1281713678
>
> As per the article details, I created my enhance.xml that contaiins
> following code.
>
> <project name="MFDataModelJPA">
>
>  <target name="enhance">
>  <taskdef name="openjpac"
> classname="org.apache.openjpa.ant.PCEnhancerTask">
>        <classpath>
>                <fileset
>
> dir="C:\Workspace\MaskFinanceOnlineSystemIntegrated\MFDataModelJPA\jpa_lib">
>                        <include name="com.ibm.ws.jpa.jar"/>
>                </fileset>
>        </classpath>
>  </taskdef>
>  <openjpac>
>        <classpath>
>                <fileset
> dir="C:\Workspace\MaskFinanceOnlineSystemIntegrated\MFDataModelJPA\src">
>                        <include name="com.ibm.ws.jpa.jar"/>
>                </fileset>
>        </classpath>
>  </openjpac>
>  </target>
> </project>
>
> In the configuration, I copied com.ibm.ws.jpa.jar to my jpa_lib folder and
> it has PCEnhancerTask Class.
> "src" is the folder name inside which I have all the entity classes in
> appropriate packages.
>
> I set the enhance.xml in the builder and clean the JPA project. It says
> "Build Successful", but not sure if the clasees have been enhanced.
>
> Is there a way we can find out if the classes has been enhanced? If we find
> that entities are for sure being enhanced, it might be the server that is
> not taking these enhanced classes for deployment.
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/PCEnhancement-tp5416877p5420700.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>

Re: PCEnhancement

Posted by Arnav-A <ar...@gmail.com>.
Thanks a lot for the respnse.

Let me answer all the questions

1. Do you have a PMR open yet?
=> No. I have not created any PMR for this problem.

2. Have you tried stopping and restarting the application?
=> Yes. In that case, it works fine. Either I restart the application after
cleanup OR remove and add application to server, it works fine.

3. So, does your environment have the automatic publish action turned on or
off?
=> Yes. I have automatic publish action turned on. 

In the mean time, I was looking at the option for build time entity
enhancement mentioned in the link 

http://openjpa.apache.org/enhancement-with-eclipse.html?wwparam=1281713678

As per the article details, I created my enhance.xml that contaiins
following code.

<project name="MFDataModelJPA">
 
 <target name="enhance">
  <taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask">
  	<classpath>
  		<fileset
dir="C:\Workspace\MaskFinanceOnlineSystemIntegrated\MFDataModelJPA\jpa_lib">
  			<include name="com.ibm.ws.jpa.jar"/>
  		</fileset>
  	</classpath>	
  </taskdef>	
  <openjpac>
  	<classpath>
  	  	<fileset
dir="C:\Workspace\MaskFinanceOnlineSystemIntegrated\MFDataModelJPA\src">
  	  		<include name="com.ibm.ws.jpa.jar"/>
  	  	</fileset>
  	</classpath>	 
  </openjpac>
 </target>
</project>

In the configuration, I copied com.ibm.ws.jpa.jar to my jpa_lib folder and
it has PCEnhancerTask Class. 
"src" is the folder name inside which I have all the entity classes in
appropriate packages.

I set the enhance.xml in the builder and clean the JPA project. It says
"Build Successful", but not sure if the clasees have been enhanced.

Is there a way we can find out if the classes has been enhanced? If we find
that entities are for sure being enhanced, it might be the server that is
not taking these enhanced classes for deployment.

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/PCEnhancement-tp5416877p5420700.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Re: PCEnhancement

Posted by Kevin Sutter <kw...@gmail.com>.
I also just found this out by talking with the tooling guys...

*When the project is being cleaned, an application delta publish should
occur since the class files has been changed.  During the delta publish, we
[IDE] simply send the list of changed files to the WAS server and we are
relying on the WAS server to decide what to react to.  Typically, the WAS
server will trigger an application restart as part of the application update
if the class file has been changed, we do not explicitly restart the
application for the user.*

*Therefore, as long as the user has automatic publishing turned on, a
publish, and thus an application update via the app management JMX MBean,
should be triggered.  The WAS server should restart the application
automatically for the user.  If the user happens to have automatic publish
turned off, then they need to explicitly do a publish before the changes can
take place.*

So, does your environment have the automatic publish action turned on or
off?

Kevin

On Thu, Aug 12, 2010 at 4:35 PM, Michael Dick <mi...@gmail.com>wrote:

> Have you tried stopping and restarting the application? My guess is that
> when you clean the project RSA updates the application in place, and
> restarting the application will at least work around) the problem.
>
> If that does work for you it'll help narrow down on the root cause for the
> support team. If RSA is starting and stopping the application the
> enhancement should happen (I just gave it a quick try).
>
> Hope this helps,
> -mike
>
> On Thu, Aug 12, 2010 at 3:17 PM, Kevin Sutter <kw...@gmail.com> wrote:
>
> > Hi Amay-A,
> > This sounds more like a problem with the Container's plugin with the JPA
> > provider rather than an OpenJPA problem, per se.  That is, the App Server
> > is
> > not recognizing that changes have been made to these Entity classes and,
> > thus, skipping the transform step that allows for enhancement.  Or,
> there's
> > a problem with the re-deployment processing and the old Entity classes
> are
> > not getting cleared from the classloader environment.  In any case, this
> > sounds like something you should follow up with the WebSphere support
> team.
> > Do you have a PMR open yet?  I can let the WebSphere support team know
> that
> > something's coming to give them a heads up.
> >
> > Kevin
> >
> > On Thu, Aug 12, 2010 at 11:40 AM, Arnav-A <ar...@gmail.com> wrote:
> >
> > >
> > > Hi
> > >  I am using RSA 7.5.4 as my IDE, and WebSphere Application Server 7.0
> for
> > > my Application development.
> > >  I have a web project and a JPA project having Manager classes, Entity
> > > classes and my Web project has a reference to JPA project.
> > >  I am doing testing in my localhost environment.
> > >
> > >  I modify the java code, clean my projects, remove ear file from the
> > Server
> > > instance, add ear file to the server instance, run my jsp on the server
> > to
> > > fetch data from the database and it works fine.
> > >  If I modify the java code, clean my projects, run my jsp on the server
> > to
> > > fetch data from the database i.e. no remove and add of the ear file to
> > > server instance,
> > >  it gives me exception stating that class com.*.Batch has not been
> > > enhanced.
> > >  Now, If I remove & add the ear file to the server and  it works fine.
> > >
> > >  I don't want to remove and add ear file everytime I modify my code. I
> > have
> > > seen couple of post regarding enhancing the entity classes i.e. using
> > > build.xml or javaagent.
> > >
> > >  I tried to add javaagent to generic JVM arguement i.e.
> > > -javaagent:C:\com.ibm.ws.jpa.jar and run the appilcation again and it
> > gave
> > > me exception stating that javax.persistence.spi.PersistenceProvider
> class
> > > could not be found.
> > >
> > >  I am not sure what should I do for entity class enhancement so that I
> > > don't need to remove and add EAR file for every code modification.
> > >
> > >  I don't want to use build.xml since it will also be needed to be run
> > > everytime I modify my project.
> > >
> > > Please advise
> > > --
> > > View this message in context:
> > >
> http://openjpa.208410.n2.nabble.com/PCEnhancement-tp5416877p5416877.html
> > > Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> > >
> >
>

Re: PCEnhancement

Posted by Michael Dick <mi...@gmail.com>.
Have you tried stopping and restarting the application? My guess is that
when you clean the project RSA updates the application in place, and
restarting the application will at least work around) the problem.

If that does work for you it'll help narrow down on the root cause for the
support team. If RSA is starting and stopping the application the
enhancement should happen (I just gave it a quick try).

Hope this helps,
-mike

On Thu, Aug 12, 2010 at 3:17 PM, Kevin Sutter <kw...@gmail.com> wrote:

> Hi Amay-A,
> This sounds more like a problem with the Container's plugin with the JPA
> provider rather than an OpenJPA problem, per se.  That is, the App Server
> is
> not recognizing that changes have been made to these Entity classes and,
> thus, skipping the transform step that allows for enhancement.  Or, there's
> a problem with the re-deployment processing and the old Entity classes are
> not getting cleared from the classloader environment.  In any case, this
> sounds like something you should follow up with the WebSphere support team.
> Do you have a PMR open yet?  I can let the WebSphere support team know that
> something's coming to give them a heads up.
>
> Kevin
>
> On Thu, Aug 12, 2010 at 11:40 AM, Arnav-A <ar...@gmail.com> wrote:
>
> >
> > Hi
> >  I am using RSA 7.5.4 as my IDE, and WebSphere Application Server 7.0 for
> > my Application development.
> >  I have a web project and a JPA project having Manager classes, Entity
> > classes and my Web project has a reference to JPA project.
> >  I am doing testing in my localhost environment.
> >
> >  I modify the java code, clean my projects, remove ear file from the
> Server
> > instance, add ear file to the server instance, run my jsp on the server
> to
> > fetch data from the database and it works fine.
> >  If I modify the java code, clean my projects, run my jsp on the server
> to
> > fetch data from the database i.e. no remove and add of the ear file to
> > server instance,
> >  it gives me exception stating that class com.*.Batch has not been
> > enhanced.
> >  Now, If I remove & add the ear file to the server and  it works fine.
> >
> >  I don't want to remove and add ear file everytime I modify my code. I
> have
> > seen couple of post regarding enhancing the entity classes i.e. using
> > build.xml or javaagent.
> >
> >  I tried to add javaagent to generic JVM arguement i.e.
> > -javaagent:C:\com.ibm.ws.jpa.jar and run the appilcation again and it
> gave
> > me exception stating that javax.persistence.spi.PersistenceProvider class
> > could not be found.
> >
> >  I am not sure what should I do for entity class enhancement so that I
> > don't need to remove and add EAR file for every code modification.
> >
> >  I don't want to use build.xml since it will also be needed to be run
> > everytime I modify my project.
> >
> > Please advise
> > --
> > View this message in context:
> > http://openjpa.208410.n2.nabble.com/PCEnhancement-tp5416877p5416877.html
> > Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> >
>

Re: PCEnhancement

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Amay-A,
This sounds more like a problem with the Container's plugin with the JPA
provider rather than an OpenJPA problem, per se.  That is, the App Server is
not recognizing that changes have been made to these Entity classes and,
thus, skipping the transform step that allows for enhancement.  Or, there's
a problem with the re-deployment processing and the old Entity classes are
not getting cleared from the classloader environment.  In any case, this
sounds like something you should follow up with the WebSphere support team.
Do you have a PMR open yet?  I can let the WebSphere support team know that
something's coming to give them a heads up.

Kevin

On Thu, Aug 12, 2010 at 11:40 AM, Arnav-A <ar...@gmail.com> wrote:

>
> Hi
>  I am using RSA 7.5.4 as my IDE, and WebSphere Application Server 7.0 for
> my Application development.
>  I have a web project and a JPA project having Manager classes, Entity
> classes and my Web project has a reference to JPA project.
>  I am doing testing in my localhost environment.
>
>  I modify the java code, clean my projects, remove ear file from the Server
> instance, add ear file to the server instance, run my jsp on the server to
> fetch data from the database and it works fine.
>  If I modify the java code, clean my projects, run my jsp on the server to
> fetch data from the database i.e. no remove and add of the ear file to
> server instance,
>  it gives me exception stating that class com.*.Batch has not been
> enhanced.
>  Now, If I remove & add the ear file to the server and  it works fine.
>
>  I don't want to remove and add ear file everytime I modify my code. I have
> seen couple of post regarding enhancing the entity classes i.e. using
> build.xml or javaagent.
>
>  I tried to add javaagent to generic JVM arguement i.e.
> -javaagent:C:\com.ibm.ws.jpa.jar and run the appilcation again and it gave
> me exception stating that javax.persistence.spi.PersistenceProvider class
> could not be found.
>
>  I am not sure what should I do for entity class enhancement so that I
> don't need to remove and add EAR file for every code modification.
>
>  I don't want to use build.xml since it will also be needed to be run
> everytime I modify my project.
>
> Please advise
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/PCEnhancement-tp5416877p5416877.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>