Mantis - Resin
Viewing Issue Advanced Details
1538 major always 01-04-07 13:14 02-12-07 10:38
gzhu Dell  
ferg Debian  
normal 2.6.7-1-686-smp  
closed 3.1.0  
fixed  
none    
none 3.1.1  
0001538: Fail to generate MyCMP__Amber.java for EJB2 CMP
Code generation failed on all EJB2 CMPs. With resin log:

[12:45:24.144] com.caucho.config.ConfigException: com.caucho.java.JavaCompileException: /usr/resin-3.1.0/webapp/WEB-INF/work/ejb/_ejb/AddCreditInfo/AddCreditInfoCMP__Amber.java:33: '}' expected
[12:45:24.144] ^
[12:45:24.144] /usr/resin-3.1.0/webapp/WEB-INF/work/ejb/_ejb/Auction/AuctionCMP__Amber.java:33: '}' expected
[12:45:24.144] ^
[12:45:24.144] /usr/resin-3.1.0/webapp/WEB-INF/work/ejb/_ejb/CatalogSale/CatalogSaleCMP__Amber.java:33: '}' expected
[12:45:24.144] ^
[12:45:24.144] /usr/resin-3.1.0/webapp/WEB-INF/work/ejb/_ejb/Contact/ContactCMP__Amber.java:33: '}' expected

Just deploy any EJB 2 CMP.
And look for partially generated java files.
The generated MyCMP__Amber.java stops half way inside the method __caucho_setPrimaryKey(Object key)

Development environment

Notes
(0001705)
gzhu   
01-04-07 17:05   
More specific, the java for primary key is a class extended from another:

     public MyEjbCMPPK extends MyCommonPK {...};

And this is what ejb-jar.xml looks like:

<entity>
  <description><![CDATA[Some description]]></description>
  <ejb-name>MyEjbCmp</ejb-name>
  <local-home>my.class.path.MyEjbCMPHome</local-home>
  <local>my.class.path.MyEjbCMP</local>

  <ejb-class>my.class.path.MyEjbCMP</ejb-class>
  <persistence-type>Container</persistence-type>
  <prim-key-class>my.class.path.MyEjbCMPPK</prim-key-class>
  <cmp-version>2.x</cmp-version>
  .....
</entity>

And in com/caucho/amber/field/CompositeId.java:
(line 482):
  EmbeddableType embeddable
    = persistenceUnit.getEmbeddable(_keyClass.getName());

  // jpa/0u21 ArrayList<IdField> keys = getKeys();
  ArrayList<AmberField> keys = embeddable.getFields();
                               ^^^^^^^ Null Pointer Exception (embeddable=null)
--------------------------------

My temp fix ( http://backhoe.ironplanet.com/download/resin/fix1538/CompositeId.java [^] ) got me through this, but failed on servlet invocation with following error:

[16:35:24.960] javax.servlet.ServletException: java.lang.NullPointerException
[16:35:24.960] at com.caucho.server.dispatch.ExceptionFilterChain.<init>(ExceptionFilterChain.java:54)
[16:35:24.960] at com.caucho.server.webapp.WebApp.buildInvocation(WebApp.java:1907)
[16:35:24.960] at com.caucho.server.webapp.WebAppContainer.buildInvocation(WebAppContainer.java:727)
[16:35:24.960] at com.caucho.server.host.Host.buildInvocation(Host.java:476)
[16:35:24.960] at com.caucho.server.host.HostContainer.buildInvocation(HostContainer.java:331)
[16:35:24.960] at com.caucho.server.cluster.Server.buildInvocation(Server.java:795)
[16:35:24.960] at com.caucho.server.dispatch.DispatchServer.buildInvocation(DispatchServer.java:200)
[16:35:24.960] at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:258)
[16:35:24.960] at com.caucho.server.port.TcpConnection.run(TcpConnection.java:477)
[16:35:24.960] at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:591)
[16:35:24.960] at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:513)
[16:35:24.960] at java.lang.Thread.run(Thread.java:595)
[16:35:24.960] Caused by: java.lang.NullPointerException
[16:35:24.960] at com.caucho.server.dispatch.FilterMapping.isMatch(FilterMapping.java:169)
[16:35:24.960] at com.caucho.server.dispatch.FilterMapper.buildDispatchChain(FilterMapper.java:140)
[16:35:24.960] at com.caucho.server.webapp.WebApp.buildInvocation(WebApp.java:1876)
[16:35:24.960] ... 10 more