[JBoss Seam] - Howto prevent SEAM from mapping POJO ?
by w17chm4n
Hi ! I have another problem. As I need a drop-down menu in my application, and data from which it`s created isn`t in database, I`m trying to do sth like this (look @ questionTypeList):
| @Stateful
| @Scope(ScopeType.SESSION)
| @Name("QuestionController")
| public class QuestionControllerBean implements QuestionController {
|
| @Logger
| private Log log;
|
| @In(create = true)
| private QuestionManager questionManager;
|
| @In(create = true)
| private PictureManager pictureManager;
|
| @In(required = false)
| private QuestionCategory questionCategory;
|
| @In(required = false)
| private Question question;
|
| @DataModel("answerList")
| private List<Answer> answerList;
|
| @In(required = false)
| @DataModelSelection("answerList")
| private Answer answer;
|
| @DataModel("questionTypeList")
| private List<QuestionType> questionTypeList;
|
| @In(required = false)
| @DataModelSelection("questionTypeList")
| private QuestionType questionType;
|
| @Out(required = false)
| private Picture picture;
|
| private int fileSize;
| private byte [] data;
| private String fileName;
| private String contentType;
|
| public void addQuestion() {
| if(fileName == null) {
| question.setQuestionType(questionType.getQuestionType());
| question.setCategory(questionCategory);
| questionManager.addQuestion(question);
| } else {
| picture.setQuestion(question);
| question.setPicture(picture);
| question.setQuestionType(questionType.getQuestionType());
| question.setCategory(questionCategory);
| questionManager.addQuestion(question);
| pictureManager.addPicture(picture);
|
| }
| }
|
| public void removeQuestion() {
| }
|
| public void selectQuestion() {
| }
|
| public void addAnswer() {
| }
|
| public void removeAnswer() {
| }
|
| @Factory("questionTypeList")
| public void createQuestionTypeList() {
| questionTypeList = new ArrayList<QuestionType>();
| questionTypeList.add(new QuestionType(Commons.INPUT,"Input answer as text"));
| questionTypeList.add(new QuestionType(Commons.SELECT_ONE,"Select one answer"));
| questionTypeList.add(new QuestionType(Commons.SELECT_MANY,"Select many answers"));
| }
|
| public void addPicture() {
| picture = new Picture(data, fileName, new Date());
| picture.setQuestion(question);
| }
|
| public byte[] getData() {
| return data;
| }
|
| public void setData(byte[] data) {
| this.data = data;
| }
|
| public String getFileName() {
| return fileName;
| }
|
| public void setFileName(String fileName) {
| this.fileName = fileName;
| }
|
| public String getContentType() {
| return contentType;
| }
|
| public void setContentType(String contentType) {
| this.contentType = contentType;
| }
|
| public int getFileSize() {
| return fileSize;
| }
|
| public void setFileSize(int fileSize) {
| this.fileSize = fileSize;
| }
|
| @Remove @Destroy
| public void destroy() {}
|
| }
|
It uses a POJO
| public class QuestionType {
|
| private int QuestionType;
| private String label;
|
| public QuestionType() {
| }
|
| public QuestionType(int questionType, String label) {
| this.QuestionType = questionType;
| this.label = label;
| }
|
| public int getQuestionType() {
| return QuestionType;
| }
|
| public void setQuestionType(int QuestionType) {
| this.QuestionType = QuestionType;
| }
|
| public String getLabel() {
| return label;
| }
|
| public void setLabel(String label) {
| this.label = label;
| }
|
| }
|
and a simple class for static variables
| public class Commons {
|
| public static final int INPUT = 0;
| public static final int SELECT_ONE = 1;
| public static final int SELECT_MANY = 2;
|
| }
|
When I try to submit my form (addQuestion method) i get the following error:
| org.hibernate.MappingException: Unknown entity: java.lang.Object
|
As i think, the problem is that JBoss is trying to map POJO and the Commons class to the database, because these files r in the same jar as the normal seam components and entities.
So, is there a way to prevent seam from trying to map those two files?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100172#4100172
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100172
18Â years, 5Â months
[JBoss Seam] - Exception trying to run seam on glassfish.java.lang.NoClassD
by deepsix
Hi,
I have been trying to get a simple seam application up and running on glassfish. Whenever i try to deploy the application on glassfish, i get an error:
| App client jboss-seam.jar did not specify Main-Class in its manifest as described in the Java EE specification; no annotations in this app client will be processed
| deployed with moduleid = seam-facelets
| java.lang.NoClassDefFoundError: org/jboss/util/file/ArchiveBrowser$Filter
| at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:125)
| at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
| at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
| at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:898)
| at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184)
| at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126)
| at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:244)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:336)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:210)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:645)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:928)
|
I am at a loss as to what this means. Has some one got this exception before? Does this mean that i have missed out on some jar dependency some where or i have made some error in persistence.xml or elsewhere..
Any help would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100165#4100165
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100165
18Â years, 5Â months