[EJB 3.0] - Jboss can't find annotated entity classes
by tigrik
Hi guys, I'm new to EJB3 so maybe it's a real dumb question but I'm sitting 3 days with this error right now and slowly becoming crazy.
The problem is, JBoss 4.2 can't find my entity classes. As it starts the persistence I get an error (see bellow).
Here is my persistence.xml:
<persistence-unit name="database" transaction-type="RESOURCE_LOCAL">
<jta-data-source>java:/MySqlDS</jta-data-source>
</persistence-unit>
mysql-ds.xml is OK and JBoss reads it. It's called MySqlDS in JNDI.
So the problem is, when I do:
entityManagerFactory = Persistence.createEntityManagerFactory("database", new HashMap());
I get this error:
17:36:23,060 INFO [Version] Hibernate EntityManager 3.2.1.GA
17:36:23,083 INFO [Version] Hibernate Annotations 3.2.1.GA
17:36:23,108 INFO [Environment] Hibernate 3.2.4.sp1
17:36:23,117 INFO [Environment] hibernate.properties not found
17:36:23,119 INFO [Environment] Bytecode provider name : javassist
17:36:23,124 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
17:36:23,436 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
javax.persistence.PersistenceException: [PersistenceUnit: database] class or package not found
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1089)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:886)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:772)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at com.kukinbuk.utils.EntityManagerFilter.doFilter(EntityManagerFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: WEB-INF.classes.com.kukinbuk.hibernate.RecipePicture
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:112)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1005)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1077)
... 26 more
It happends with every single Class I annotate as @entity. The classes are deffinitely there in my WAR-Archive und same names... Here an example of such a class (generated by Eclipse 3.3 using latest Hibernate Tools)
package com.kukinbuk.hibernate;
// default package
// Generated 24.07.2007 19:50:34 by Hibernate Tools 3.1.0.beta5
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* RecipePicture generated by hbm2java
*/
@Entity
@Table(name = "recipe_picture", catalog = "kukinbuk", uniqueConstraints = {})
public class RecipePicture implements java.io.Serializable {
// Fields
private long id;
private Recipe recipe;
private String picture;
private String title;
// Constructors
/** default constructor */
public RecipePicture() {
}
/** minimal constructor */
public RecipePicture(long id) {
this.id = id;
}
/** full constructor */
public RecipePicture(long id, Recipe recipe, String picture, String title) {
this.id = id;
this.recipe = recipe;
this.picture = picture;
this.title = title;
}
// Property accessors
@Id
@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true)
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "RECIPE_ID", unique = false, nullable = true, insertable = true, updatable = true)
public Recipe getRecipe() {
return this.recipe;
}
public void setRecipe(Recipe recipe) {
this.recipe = recipe;
}
@Column(name = "PICTURE", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
public String getPicture() {
return this.picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
@Column(name = "TITLE", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067459#4067459
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067459
18Â years, 9Â months
[JBossWS] - WS-Security header encryption?
by andycooper
After experimenting, reading source code, and much hair-pulling, I still can't find any way to encrypt SOAP headers using JBossWS. In particular, the UsernameToken header remains unencrypted and doesn't seem to support nonce's.
Speaking of this, the documentation for the WS-Security implementation is "somewhat" lacking. Using BindingProvider.USERNAME_PROPERTY (as shown in your tests) doesn't work because its constant is different from Stub.USERNAME_PROPERTY, which is what WSSecurityDispatcher.java uses to determine whether or not to include the header. Similarly for PASSWORD_PROPERTY.
So, the question of the day is: how do you encrypt or secure a username/pasword combination sent via the WS-Security UsernameToken header that is included by means of something like
((BindingProvider)port).getRequestContext().put(Stub.USERNAME_PROPERTY, "foo);
((BindingProvider)port).getRequestContext().put(Stub.PASSWORD_PROPERTY, "foo);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067456#4067456
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067456
18Â years, 9Â months
[JBoss jBPM] - how can i show a graph of the instance that i specify ?
by yairfr
hi,
i am trying to show the graph of the current task in the process instance that i pass by the taskInstanceId parameter.
today i can see the general graph of the process , not of the
instance of the process .
the error in on :
gpdBytes = fileDefinition.getBytes("gpd.xml");
because the fileDefinition comes out null.
should i insert a file definition to the processdefinition.xml ?
and if so - how ?
| final long serialVersionUID = 1L;
| long taskInstanceId = -1;
| long tokenInstanceId = -1;
|
| byte[] gpdBytes = null;
| byte[] imageBytes = null;
| Token currentToken = null;
| ProcessDefinition processDefinition = null;
|
| String currentTokenColor = "red";
| String childTokenColor = "blue";
| String tokenNameColor = "blue";
|
| ProcessImageJbpm PIJ = new ProcessImageJbpm();
|
| String tempInsId = DBDate.nullstring(request
| .getParameter("TaskInstanceId"));
|
| if (tempInsId.equals(""))
| tempInsId = "0";
|
| long TaskInstanceId = Long.parseLong(tempInsId);
|
| try {
|
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
|
| TaskInstance taskInstance = jbpmContext.getTaskMgmtSession().loadTaskInstance(TaskInstanceId);
|
| currentToken = taskInstance.getToken();
|
| processDefinition = currentToken.getProcessInstance().getProcessDefinition();
|
| PIJ.setCurrentToken(currentToken);
|
|
| FileDefinition fileDefinition = processDefinition.getFileDefinition();
| if(fileDefinition!=null)
| {
| gpdBytes = fileDefinition.getBytes("gpd.xml");
| imageBytes = fileDefinition.getBytes("processimage.jpg");
|
| if (gpdBytes != null && imageBytes != null) {
| int borderWidth = 4;
| Element rootDiagramElement = DocumentHelper.parseText(
| new String(gpdBytes)).getRootElement();
| int[] boxConstraint;
| int[] imageDimension = PIJ
| .extractImageDimension(rootDiagramElement);
| String imageLink = "processimage?definitionId="
| + processDefinition.getId();
|
| if (tokenInstanceId > 0) {
|
| List allTokens = new ArrayList();
| allTokens = PIJ.walkTokens(currentToken, allTokens);
|
| out.println("<div style='position:relative; background-image:url("
| + imageLink
| + "); width: "
| + imageDimension[0]
| + "px; height: "
| + imageDimension[1] + "px;'>");
|
| for (int i = 0; i < allTokens.size(); i++) {
| Token token = (Token) allTokens.get(i);
|
| //check how many tokens are on teh same level (= having the same parent)
| int offset = i;
| if (i > 0) {
| while (offset > 0&& ((Token) allTokens.get(offset - 1)).getParent().equals(token.getParent())) {
| offset--;
| }
| }
| boxConstraint = PIJ.extractBoxConstraint(rootDiagramElement, token);
|
| //Adjust for borders
| boxConstraint[2] -= borderWidth * 2;
| boxConstraint[3] -= borderWidth * 2;
|
| out.println("<div style='position:absolute; left: "
| + boxConstraint[0] + "px; top: "
| + boxConstraint[1] + "px; ");
|
| if (i == (allTokens.size() - 1)) {
| out.println("border: " + currentTokenColor);
| } else {
| out.println("border: " + childTokenColor);
| }
|
| out.println(" " + borderWidth + "px groove; "
| + "width: " + boxConstraint[2]
| + "px; height: " + boxConstraint[3]
| + "px;'>");
|
| if (token.getName() != null) {
| out.println("<span style='color:"
| + tokenNameColor
| + ";font-style:italic;position:absolute;left:"
| + (boxConstraint[2] + 10)
| + "px;top:"
| + ((i - offset) * 20)
| + ";'>Â " + token.getName()
| + "</span>");
| }
|
| out.println("</div>");
| }
| out.println("</div>");
| } else {
| boxConstraint = PIJ.extractBoxConstraint(rootDiagramElement);
|
| out.println("<table border=0 cellspacing=0 cellpadding=0 width="
| + imageDimension[0]
| + " height="
| + imageDimension[1] + ">");
| out.println(" <tr>");
| out.println(" <td width=" + imageDimension[0]
| + " height=" + imageDimension[1]
| + " style=\"background-image:url(" + imageLink
| + ")\" valign=top>");
| out.println(" <table border=0 cellspacing=0 cellpadding=0>");
| out.println(" <tr>");
| out.println(" <td width="
| + (boxConstraint[0] - borderWidth)
| + " height="
| + (boxConstraint[1] - borderWidth)
| + " style=\"background-color:transparent;\"></td>");
| out.println(" </tr>");
| out.println(" <tr>");
| out.println(" <td style=\"background-color:transparent;\"></td>");
| out.println(" <td style=\"border-color:"
| + currentTokenColor
| + "; border-width:"
| + borderWidth
| + "px; border-style:groove; background-color:transparent;\" width="
| + boxConstraint[2]
| + " height="
| + (boxConstraint[3] + (2 * borderWidth))
| + ">Â </td>");
| out.println(" </tr>");
| out.println(" </table>");
| out.println(" </td>");
| out.println(" </tr>");
| out.println("</table>");
| }
| out.flush();
| }
| }
| }
| catch (IOException e) {
| e.printStackTrace();
| //throw new JspException("table couldn't be displayed", e);
| }
| catch (DocumentException e)
| {
| e.printStackTrace();
| }
| //throw new JspException("table couldn't be displayed", e);
| catch (Exception e) {
| e.printStackTrace();
| }
|
| taskInstanceId = -1;
| gpdBytes = null;
| imageBytes = null;
| currentToken = null;
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067455#4067455
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067455
18Â years, 9Â months
[JBoss Seam] - <s:decorate> - is id available within template?
by tynor
Argh. I've changed my edit.xhtml to layout my form elements as table rows since I have some forms which need to be multi-column and getting fixed -width CSS to work properly is hard. It all displays fine now until I trigger an ajax4jsf validation/rerender -- then I start seeing duplicated rows in my table(!). This is probably a bug in ajax4jsf, but i don't have the energy to track it down - i just want to work around by causing the rerender to not trigger problems.
If I add a named span inside my td and rerender that, it seems to work properly. However, I need to generate an id for that span based on the id passed to the s:decorate tag, but can't figure out how to do that.
I've tried accessing the id via #{id} and by setting for= on the s:decorate and accesing it via #{forId} - both evaluate to empty strings in my template. I've looked at the Seam tag source and the facelets tag source and don't understand how or if the attribute values are propagated to EL. Help please!
Seam 1.2.1-GA (what precise version of Facelets is bundled?)
Richfaces 3.0.1
Ajax4jsf 1.1.1
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067449#4067449
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067449
18Â years, 9Â months