Hi Marina,
I was suggesting deploying the statically weaved jar as a way of
tracking down the issue. We seem to have discovered the problem is much
more fundamental than that, so hopefully it will not be necessary.
-Tom
Marina Vatkina wrote:
>Tom, Alexey,
>
>Why does anybody need to deploy a statically weaved jar?
>
>Alexey,
> Are you deploying a jar with only PU classes or is it a Java EE module that
>contains a PU in addition to the Java EE components (like an EJB or a Web
>component)?
>
>thanks,
>-marina
>
>Tom Ware wrote:
>
>
>>Hi Alexey,
>>
>> I am moving this discussion to the persistence mailing list because I
>>think some of the other folks on the list are more likely than me to be
>>able to help with the packaging issue you are seeing. Are you
>>subscribed to that list?
>>
>> When I ran your original jar through the static weaver, I saw the same
>>problem you were seeing. With my changes, I got the attached jar. As
>>you can see it is different. When I decompile City.class, I can see
>>constructs TopLink Essentials has added for static weaving. I run the
>>static weaver as follows on my windows machine:
>>
>>--
>>set
>>classpath=.;C:\cvsworkspace\publish\glassfish\lib\toplink-essentials.jar;%classpath%
>>
>>
>>java oracle.toplink.essentials.weaving.StaticWeave -loglevel FINEST
>>Issue1081.jar Issue1081Weaved.jar
>>--
>>
>> If you with logging turned on (-loglevel FINEST) how much logging do
>>you get?
>>
>>To The Sun folks,
>>
>>Alexey is getting an exception in autodeployment with a jar generated by
>>our static weaver. The exception is below. Do you have any idea why
>>this might be happening.
>>
>>-Tom
>>
>>
>>AKostylev wrote:
>>
>>
>>
>>>Hi, Tom.
>>>
>>>
>>>I've tried both ways that you'd described but the result is still the
>>>same.
>>>
>>>Generated by weaver classes have the same size and are still not working.
>>>
>>>It'll be great if you continue help me with this issue because I have
>>>no idea how to solve it.
>>>
>>>
>>>One more thing.
>>>
>>>As I said the size of weaved classes are the same, but the size of
>>>jar-archive is not the same!
>>>You can see it in those files that I sent to you.
>>>
>>>It is slightly bigger, so as I understand, weaver use some other
>>>method of packing.
>>>
>>>The problem is that Glassfish doesn't understand it!
>>>
>>>When I try to autodeploy that jar file (copy to domain1/autodeploy) I
>>>get an exception:
>>>
>>>
>>>8950-c0bb88c02f1e;|Could not expand entry META-INF\ into destination
>>>C:\Java\gla
>>>
>>>ssfish\domains\domain1\applications\j2ee-modules\Issue1081
>>>
>>>java.io.IOException: Error expanding archive
>>>C:\Java\glassfish\domains\domain1\a
>>>
>>>utodeploy\Issue1081.jar; please see the server log file for more
>>>information
>>>
>>> at
>>>com.sun.enterprise.deployment.backend.J2EEModuleExploder.explodeJar(J
>>>
>>>2EEModuleExploder.java:346)
>>>
>>> at
>>>com.sun.enterprise.deployment.backend.EjbModuleDeployer.preDeploy(Ejb
>>>
>>>ModuleDeployer.java:110)
>>>
>>> at
>>>com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(
>>>
>>>ModuleDeployer.java:155)
>>>
>>> at
>>>com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.
>>>
>>>java:171)
>>>
>>> at
>>>com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(De
>>>
>>>ploymentPhase.java:95)
>>>
>>> at
>>>com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhas
>>>
>>>es(PEDeploymentService.java:892)
>>>
>>> at
>>>com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDe
>>>
>>>ploymentService.java:263)
>>>
>>> at
>>>com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDe
>>>
>>>ploymentService.java:281)
>>>
>>> at
>>>com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(Applic
>>>
>>>ationsConfigMBean.java:536)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>>>
>>>java:39)
>>>
>>> at
>>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>>
>>>sorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>
>>> at
>>>com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelpe
>>>
>>>r.java:353)
>>>
>>> at
>>>com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelpe
>>>
>>>r.java:336)
>>>
>>> at
>>>com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBea
>>>
>>>n.java:448)
>>>
>>> at
>>>com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImp
>>>
>>>l.java:213)
>>>
>>> at
>>>com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
>>>
>>> at
>>>com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
>>>
>>>BeanServerInterceptor.java:815)
>>>
>>> at
>>>com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784
>>>
>>>)
>>>
>>> at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
>>>
>>> at
>>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>>
>>>sorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>
>>> at
>>>com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java
>>>
>>>:77)
>>>
>>> at $Proxy1.invoke(Unknown Source)
>>>
>>> at
>>>com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(Sun
>>>
>>>oneInterceptor.java:297)
>>>
>>> at
>>>com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymen
>>>
>>>tService(AutoDeployer.java:508)
>>>
>>> at
>>>com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployJavaEEArc
>>>
>>>hive(AutoDeployer.java:489)
>>>
>>> at
>>>com.sun.enterprise.deployment.autodeploy.AutoDeployer.deploy(AutoDepl
>>>
>>>oyer.java:436)
>>>
>>> at
>>>com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoD
>>>
>>>eployer.java:253)
>>>
>>> at
>>>com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$Aut
>>>
>>>oDeployTask.run(AutoDeployControllerImpl.java:361)
>>>
>>> at java.util.TimerThread.mainLoop(Timer.java:512)
>>>
>>> at java.util.TimerThread.run(Timer.java:462)
>>>
>>>Caused by: java.io.IOException
>>>
>>> at
>>>com.sun.enterprise.util.io.FileUtils.openFileOutputStream(FileUtils.j
>>>
>>>ava:646)
>>>
>>> at
>>>com.sun.enterprise.deployment.backend.J2EEModuleExploder.explodeJar(J
>>>
>>>2EEModuleExploder.java:318)
>>>
>>> ... 32 more
>>>
>>>Caused by: java.io.FileNotFoundException:
>>>C:\Java\glassfish\domains\domain1\appl
>>>
>>>ications\j2ee-modules\Issue1081\META-INF (Системе не удается найти
>>>указанный пут
>>>
>>>ь)
>>>
>>> at java.io.FileOutputStream.open(Native Method)
>>>
>>> at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
>>>
>>> at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
>>>
>>> at
>>>com.sun.enterprise.util.io.FileUtils$FileOutputStreamWork.run(FileUti
>>>
>>>ls.java:1427)
>>>
>>> at
>>>com.sun.enterprise.util.io.FileUtils.doWithRetry(FileUtils.java:678)
>>>
>>> at
>>>com.sun.enterprise.util.io.FileUtils.openFileOutputStream(FileUtils.j
>>>
>>>ava:642)
>>>
>>> ... 33 more
>>>
>>>|#]
>>>
>>>
>>>But with original jar autodeploy is working.
>>>
>>>
>>>Thank you, Tom.
>>>
>>>
>>>With best wishes, Alexey Kostylev.
>>>
>>>
>>>
>>>
>>>
>>>>Hi Alexey,
>>>>
>>>>
>>>
>>>
>>>
>>>> Thanks for sending your files I found a usability issue with the
>>>>
>>>>
>>>
>>>
>>>>static weaver. I have entered a bug into the Glassfish system and try
>>>>
>>>>
>>>
>>>
>>>>to get it addressed fairly soon.
>>>>
>>>>
>>>
>>>
>>>
>>>>https://glassfish.dev.java.net/issues/show_bug.cgi?id=2101
>>>>
>>>>
>>>
>>>
>>>> The reason you are seeing an issue is because you are using a
>>>>
>>>>
>>>
>>>
>>>>persistence unit configured to be deployed by a JPA container. A
>>>>
>>>>
>>>
>>>
>>>>configuration like that assumes that entity classes can be automatically
>>>>
>>>>
>>>
>>>
>>>>detected. The static weaver is currently not configured to
>>>>
>>>>
>>>
>>>
>>>>automatically detect the entity classes. It is configured to work with
>>>>
>>>>
>>>
>>>
>>>>someone who is deploying outside of a JPA container where classes cannot
>>>>
>>>>
>>>
>>>
>>>>be automatically detected.
>>>>
>>>>
>>>
>>>
>>>
>>>>There is a fairly simple workaround.
>>>>
>>>>
>>>
>>>
>>>
>>>>In your persistence.xml tell the JPA provider about the classes. There
>>>>
>>>>
>>>
>>>
>>>>are two ways you can do that:
>>>>
>>>>
>>>
>>>
>>>
>>>>1. Use the official JPA mechanism and list the classes with the <class>
>>>>
>>>>
>>>
>>>
>>>>tag in your persistence.xml before you static weave.
>>>>
>>>>
>>>
>>>
>>>
>>>><?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>>
>>>
>>>
>>>><persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>>>
>>>>
>>>
>>>
>>>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>
>>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>>xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>>>
>>>>
>>>
>>>
>>>>http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>>>>
>>>>
>>><http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd>
>>>version="1.0">
>>>
>>>
>>>
>>>> <persistence-unit name="CRM" transaction-type="JTA">
>>>>
>>>>
>>>
>>>
>>>> <jta-data-source>jdbc/issue1081</jta-data-source>
>>>>
>>>>
>>>
>>>
>>>> <class>issue1081.City</class>
>>>>
>>>>
>>>
>>>
>>>> <class>issue1081.Region</class>
>>>>
>>>>
>>>
>>>
>>>> <properties>
>>>>
>>>>
>>>
>>>
>>>> <property name="hibernate.dialect"
>>>>
>>>>
>>>
>>>
>>>>value="org.hibernate.dialect.OracleDialect"/>
>>>>
>>>>
>>>
>>>
>>>> </properties>
>>>>
>>>>
>>>
>>>
>>>> </persistence-unit>
>>>>
>>>>
>>>
>>>
>>>></persistence>
>>>>
>>>>
>>>
>>>
>>>
>>>>2. Use a custom feature we have implemented and explicitly set the
>>>>
>>>>
>>>
>>>
>>>>persistence unit's <exclude-unlisted-classes> to false in your
>>>>
>>>>
>>>
>>>
>>>>persitence.xml before you static weave
>>>>
>>>>
>>>
>>>
>>>
>>>><?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>>
>>>
>>>
>>>><persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>>>
>>>>
>>>
>>>
>>>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>
>>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>>xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>>>
>>>>
>>>
>>>
>>>>http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>>>>
>>>>
>>><http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd>
>>>version="1.0">
>>>
>>>
>>>
>>>> <persistence-unit name="CRM" transaction-type="JTA">
>>>>
>>>>
>>>
>>>
>>>> <jta-data-source>jdbc/issue1081</jta-data-source>
>>>>
>>>>
>>>
>>>
>>>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>>>
>>>>
>>>
>>>
>>>> <properties>
>>>>
>>>>
>>>
>>>
>>>> <property name="hibernate.dialect"
>>>>
>>>>
>>>
>>>
>>>>value="org.hibernate.dialect.OracleDialect"/>
>>>>
>>>>
>>>
>>>
>>>> </properties>
>>>>
>>>>
>>>
>>>
>>>> </persistence-unit>
>>>>
>>>>
>>>
>>>
>>>></persistence>
>>>>
>>>>
>>>
>>>
>>>
>>>>Hopefully this helps,
>>>>
>>>>
>>>
>>>
>>>>Tom
>>>>
>>>>
>>>
>>>
>>>
>>>>AKostylev wrote:
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>>>Hello, Tom.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>That's a pity but it is not working.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>>>So here are results:
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>>>The classes in generated weaved library are fully identical (by size)
>>>>>
>>>>>
>>>
>>>
>>>>>to original ones(why?).
>>>>>
>>>>>
>>>
>>>
>>>
>>>>>So including it both on server and client does nothing.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>>>I attach testcases that I have.
>>>>>
>>>>>
>>>
>>>
>>>
>>>>>So I ask you to check them and help me understand what is wrong.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>>>I'm using Glassfish V2 b32.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>>>Thank you.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>>>Best regards, Alexey Kostylev.
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>Hi Alexey,
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>
>>>>>>I would expect static weaving to work in your case. I am surprised it
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>>>>is not working for you.
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>
>>>>>>Is it possible to try including the statically weaved classes both on
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>>>>your client and on the server?
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>
>>>>>>-Tom
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>
>>>>>>AKostylev wrote:
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>Hello, Tom.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>I've tried to use static weaving.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>Weaving process was without any exceptions, it had generated a new
>>>>>>>
>>>>>>>
>>>jar
>>>
>>>
>>>
>>>>>>>library (I can send it to you but it is about 300kb).
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>I added this generated Jar to classpath of my client instead of the
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>>>>>original jar.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>But!
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>I still got the same exception:
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>java.io.IOException: Mismatched serialization UIDs : Source (Rep.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>IDRMI:ru.amfitel.m3000.businesslayer.crm.impl.AbonentValueImpl:8E76405E57BA17A5:FD3D67035A19FE83)
>>>
>>>
>>>
>>>
>>>>>>>= FD3D67035A19FE83 whereas Target (Rep. ID
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>RMI:ru.amfitel.m3000.businesslayer.crm.impl.AbonentValueImpl:F8E490E518B382B1:9A44D4AC8682F140)
>>>
>>>
>>>
>>>
>>>>>>>= 9A44D4AC8682F140
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>So let me describe my environment one more time:
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>I use Persistent Entities on the side of GLassfish.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>I use JUnit TestCases as client outside of container.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>Client accesses entities through Session Bean as facade pattern.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>So when I try to get entity with lazy relationship through session
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>>>>>bean I get such an exception.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>So should static weaving help me? If yes why I get the same error?
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>Thank you a lot, Tom.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>Hi Alexey,
>>>>>>>>
>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>This issue is not currently scheduled.
>>>>>>>>
>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>I have, however, updated the bug report with a set of steps you
>>>>>>>>
>>>>>>>>
>>>should
>>>
>>>
>>>
>>>
>>>>>>>>be able to use to get around this issue. Hopefully they will help.
>>>>>>>>
>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>-Tom
>>>>>>>>
>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>AKostylev wrote:
>>>>>>>>
>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>>Hello, Tware and Marina.
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>>Could you please tell when work will start on issue 1081
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>>>( https://glassfish.dev.java.net/issues/show_bug.cgi?id=1081)?
>>>>>>>>>
>>>>>>>>>
>>><https://glassfish.dev.java.net/issues/show_bug.cgi?id=1081%29?>
>>>
>>>
>>>
>>>>><https://glassfish.dev.java.net/issues/show_bug.cgi?id=1081%29?>
>>>>>
>>>>>
>>>
>>>
>>>
>>>>>>>< https://glassfish.dev.java.net/issues/show_bug.cgi?id=1081%29? >
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>>>>>>>< https://glassfish.dev.java.net/issues/show_bug.cgi?id=1081%29? >
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>>It is very important for me.
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>>Thank you.
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>>Best regards, Alexey Kostylev.
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>>>< mailto:akostylev_at_kazan.amfitel.ru >
>>>>>>>>>
>>>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>>>>Best regards, Alexey Kostylev.
>>>>>>>
>>>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>С уважением, Алексей Костылев.
>>>
>>>---------------------------------
>>>
>>>Костылев Алексей Константинович
>>>
>>>Руководитель направления Java-разработки
>>>
>>>Амфител
>>>
>>>
>>>http://www.amfitel.ru
>>>
>>>akostylev_at_kazan.amfitel.ru <mailto:akostylev_at_kazan.amfitel.ru>
>>>
>>>
>>>