[JBoss Eclipse IDE (users)] - Re: JBossWS Plugin gen code problem
by mwr0707
Hello Ole,
I have the same environment as described above.
I have created and tested a stateless session bean.
I want to add a service endpoint to this session bean. I did the following:
1. Enable JBossWS nature
2. Right click on the SessionBean and choose: JBossWS->Publish as Web Service.
3. In the 'Publish as WebService' dialog, on the Basic tab, I choose Interface 'javax.ejb.SessionBean',
4. For 'Deploy as', I choose 'EJB'.
5. On the Advanced tab, for 'Package' I choose "MyBean.war'
6. I hit the 'Generate'
I receive the following wstools error in the console log:
anonymous wrote : Running JBossWS wstools for [DemoProject]
| directory: C:\Documents and Settings\Mark\workspace2\DemoProject
| command: cmd.exe /C C:\jboss-4.0.5.GA\bin\wstools.bat -cp build/classes -config C:\DOCUME~1\Mark\LOCALS~1\Temp\wstools-config8176.xml -dest C:\Documents and Settings\Mark\workspace2\DemoProject\ejbModule
| ========================================================================="
| .
| WSTools Environment
| .
| JBOSS_HOME: C:\jboss-4.0.5.GA\bin\\..
| .
| JAVA: C:\Program Files\Java\jdk1.5.0_06\bin\java
| .
| JAVA_OPTS:
| .
| ========================================================================="
| .
| Exception in thread "main" org.jboss.ws.WSException: A service endpoint interface should extend Remote
| at org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder.buildMetaData(ToolsUnifiedMetaDataBuilder.java:82)
| at org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder.(ToolsUnifiedMetaDataBuilder.java:69)
| at org.jboss.ws.tools.JavaToWSDL.generate(JavaToWSDL.java:298)
| at org.jboss.ws.tools.helpers.ToolsHelper.handleJavaToWSDLGeneration(ToolsHelper.java:122)
| at org.jboss.ws.tools.WSTools.process(WSTools.java:132)
| at org.jboss.ws.tools.WSTools.generate(WSTools.java:120)
| at org.jboss.ws.tools.WSTools.main(WSTools.java:61)
|
Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981650#3981650
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981650
19 years, 6 months
[EJB/JBoss] - Need help on exception:is java.io.FileNotFoundException:
by scout1lacno
Hi all,
Im new to EJB3 and JBOSS.
I wanna materialize a BLOB data from MS SQL to Attachments folder, all data from this folder are generated from the Blob data I acquired. Can someone tell me where to put the folder in my EJB application. Is it in my WAR file? Im clueless.
The error is below:
D:\jboss-4.0.4.GA\server\default\.\tmp\deploy\tmp58870CustomerRelationsManagement.ear-contents\CustomerRelationsManagement-war-exp.war\Attachments\14344\MyIDPic.jpg (The system cannot find the path specified)
My code is:
byte[] fileBytes;
|
|
| while (rs.next()==true){
|
|
| String idmessage = rs.getString("IDMessage");
| String filenameX = rs.getString("strName");
| fileBytes = rs.getBytes("imgAttachment");
| File IDMesx = new File("/Attachments"+"/" + idmessage ); // Maybe my mistake is here
|
| Long myIDMessage = Long.parseLong(idmessage);
|
| ServletContext context = getServletConfig().getServletContext();
| String path = context.getRealPath( "/" + IDMesx);
| File myFile = new File(path);
| myFile.mkdir();
|
| OutputStream targetFile=
| new FileOutputStream(
| myFile + "/" + filenameX );
| targetFile.write(fileBytes);
| targetFile.close();
|
| String URL = context.getServletContextName() + "/Attachments/" + IDMes + "/" + filenameX ;
| out.write("Transfer ok " + URL);
|
| }
Hope for a kind reply :)
Thankz :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981648#3981648
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981648
19 years, 6 months
[JBoss Seam] - Re: Scheduling in Seam?
by modoc
Ok. Here is the entire class in question. Let me know if you need any other files..
| package com.digitalsanctuary.seam;
|
| import java.util.Collections;
| import java.util.Date;
| import java.util.HashMap;
| import java.util.List;
| import java.util.ListIterator;
| import java.util.Map;
|
| import javax.ejb.Remove;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Asynchronous;
| import org.jboss.seam.annotations.Create;
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.Startup;
| import org.jboss.seam.annotations.Synchronized;
| import org.jboss.seam.annotations.timer.Expiration;
| import org.jboss.seam.annotations.timer.IntervalDuration;
| import org.jboss.seam.log.Log;
|
| import com.digitalsanctuary.mail.IMAPClient;
| import com.digitalsanctuary.mail.message.RenderableMessage;
|
| @Name("emailManager")
| @Scope(ScopeType.APPLICATION)
| @Synchronized
| @Startup
| public class EmailManager {
| private int mEmailIndex;
|
| @Logger
| private Log mLog;
|
| @In(value = "IMAPClient", create = true)
| private IMAPClient mIMAPClient;
|
| @Asynchronous
| public void processEmailsRecurring(@Expiration
| Date pDate, @IntervalDuration
| long pInterval) {
| mLog.info("proccessEmailsReccurring running...");
| processNewEmails(mIMAPClient.getNewMessages());
| }
|
| /**
| * Map of client SessionMailQueues keyed by email address.
| */
| private Map<String, SessionMailQueue> mClientMap;
|
| @Create
| public void doStartService() {
| mLog.info("Starting up...");
| mClientMap = new HashMap<String, SessionMailQueue>();
| mLog.info("Kicking off recurring email processor.");
| processEmailsRecurring(new Date(), 2);
| }
|
| /**
| * Removes the email and it's associated client sessionmailqueue if it exists in the map.
| *
| * @param pEmail
| * the e-mail address to remove from the map.
| */
| public void removeEmail(String pEmail) {
| mLog.info("Removing email from Map:#0", pEmail);
| this.mClientMap.remove(pEmail);
| }
|
| /**
| * Generate a new email address.
| *
| * @return the new e-mai address.
| */
| private String getNewEmailAddress() {
| // String newMail = "newMail" + this.mEmailIndex + "@digitalsanctuary.com";
| String newMail = "test(a)digitalsanctuary.com";
| mLog.info("Created new email:#0", newMail);
| mEmailIndex = mEmailIndex + 1;
| return newMail;
| }
|
| /**
| * This method sets up a new session. It generates a new e-mail address, adds the client's sessionMailQueue to the
| * Map keyed with the new e-mail address, and returns the new e-mail address.
| *
| * @param pMailQueue
| * the client's session scopes SessionMailQueue component.
| * @return the new e-mail address the client should use.
| */
| public String getNewEmail(SessionMailQueue pMailQueue) {
| String newMail = getNewEmailAddress();
| mLog.info("Adding mail queue to map for newMail: #0", newMail);
| mClientMap.put(newMail, pMailQueue);
| return newMail;
| }
|
| /**
| * This method takes in a List of RenderableMessages, iterates through them all, looking at all of the recipients on
| * each message, attempting to match those e-mail addresses to keys in the ClientMap Map. If it matches an entry in
| * the Map, it adds the RenderableMessage to the SessionMailQueue for that client.
| *
| * @param pEmails
| * the List of RenderableMessages to process.
| */
| public void processNewEmails(List<RenderableMessage> pEmails) {
| // Reverse the order so that the client side collections will always be correctly sorted by date, regardless of
| // how many e-mail arrive per batch.
| Collections.reverse(pEmails);
| // Loop through the new emails
| for (ListIterator<RenderableMessage> iter = pEmails.listIterator(); iter.hasNext();) {
| RenderableMessage currentEmail = iter.next();
| if (currentEmail != null) {
| // Loop through the recipients of the incoming e-mail
| for (String currentToAddress : currentEmail.getRecipientList()) {
| mLog.info("Checking e-mail address: #0", currentToAddress);
| SessionMailQueue clientQueue = mClientMap.get(currentToAddress);
| // If we find a client SessionMailQueue in the map...
| if (clientQueue != null) {
| mLog.info("Matched e-mail address: #0", currentToAddress);
| // Add the message to the client queue
| clientQueue.addMessage(currentEmail);
| }
| }
| }
| }
| }
|
| @Destroy
| @Remove
| public void destroy() {
| mLog.info("Stopping...");
| }
| }
|
I'm running JBoss 4.0.5, I used the JEMS installer and the ejb-3 profile. I'm using the seam 1.1 beta release.
21:12:38,256 INFO [Server] Starting JBoss (MX MicroKernel)...
| 21:12:38,257 INFO [Server] Release ID: JBoss [Zion] 4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)
Let me know if there's anything else you need, or anything else I should try.
Thanks.
Modoc
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981647#3981647
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981647
19 years, 6 months
[JBoss Portal] - Bug ? CMS Admin : config of TinyMCE / CSS Styles
by Antoine_h
It seems there is a bug in Tiny MCE configuration, about the styles used for the contents.
The AdminCMS configure TinyMCE with the CSS style sheet of the theme (the first one given in the descriptor).
But when doing this, it seems the WebApp context is forgotten in the url.
mine is :
content_css : "http://localhost:8080/themes/ShWaTheme/portal_style.css"
and should be :
content_css : "http://localhost:8080/MyLayoutWebApp/themes/ShWaTheme/portal_style.css"
The css file is set in the portal-themes.xml descriptor :
<link rel="stylesheet" id="main_css" href="/themes/ShWaTheme/portal_style.css" type="text/css" />
With this, the css file is correctly set in the header of the html page link.
I am using the jsp tag provided :
<%@ taglib uri="/WEB-INF/tld/portal-layout.tld" prefix="pLayout" %>
| .../...
| <!-- inject the theme; default to the Nphalanx theme if nothing is selected for the portal or the page -->
| <pLayout:theme themeName='SWGenTheme'/>
the link is correctly set for the pages, with the "MyLayoutWebApp" prefix added. So I gess it is the correct definition in the descriptor, and the WebApp context is forgotten in the CMSAdminPortlet.
Workaround : I added a line in the portal-themes.xml descriptor :
<link rel="stylesheet" id="main_css" href="/MyLayoutWebApp/themes/ShWaTheme/portal_style.css" type="text/css" />
(It is set as the first css defined, because CMSAdminPortlet uses the first css definition to configure TinyMCE with it).
this way, the tinyMCE gets it's style definition, and the whole page get the 2 definition of css in the header. The first one is wrong and the server return nothing, but that's ok with the browser : it ignore this.
Not that clean... but allow to go on for the time being.
Shall I post a Jira ?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981644#3981644
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981644
19 years, 6 months
[Persistence, JBoss/CMP, Hibernate, Database] - LazyInitializationException in strange circumstances
by fuzelogik
Before posting about this problem, I should say that I'm new to JBoss. I've been spending the last 5 months learning Java EE and developing a system using Glassfish, but I've recently made the switch to JBoss 4.0.5 (with EJB3 capability).
I've been having a number of problems cropping up during the migration, but this one's really got me confused. It seems that the LazyInitializationException crops up frequently (judging from the Google results and forum posts here) - however, it's normally in getter methods when people are using FetchType.LAZY.
In my case, I seem to be getting this exception in a setter method when I'm using FetchType.EAGER. Here is the offending code:
| // ...
|
| @OneToMany( fetch = FetchType.EAGER, cascade = { CascadeType.ALL } )
| public Set< Season > getSeasons() { return m_seasons; }
| public void setSeasons( Set< Season > seasons )
| {
| m_seasons = new TreeSet< Season >();
|
| if( seasons != null )
| m_seasons.addAll( seasons );
| }
|
| // ...
|
I'm using a TreeSet in this way because it allows me to preserve order when loading the entities back out of the database, as well as making use of the no-duplicates characteristic of sets. The actual line that causes the exception is the 'm_seasons.addAll( seasons );', as shown by this extract of the stack trace:
anonymous wrote :
| ...
|
| Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed
| at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
| at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
| at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
| at org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
| at java.util.TreeSet.addAll(TreeSet.java:245)
| at uk.co.aeroglade.vv.entity.Property.setSeasons(Property.java:77)
| ... 93 more
|
(the top-most exception, by the way, is "javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Exception occurred inside setter of uk.co.aeroglade.vv.entity.Property.seasons").
All of this code was working perfectly on Glassfish - so I'm suspecting it has something to do with the architecture of JBoss that I've overlooked:
This exception actually occurs inside a servlet which gets hold of a stateless EJB using JNDI lookup, since the @EJB annotation isn't supported by Tomcat 5.5. Once it has a reference to the EJB, it calls 'getAccounts', which returns an Account object. An Account object has a Property object, inside which has a collection of Season objects (as you can see above).
The unhappiness seems to root from the fact that I'm using the parameter passed to the setter.
I'll be honest: I'm completely confused and I'm not really sure where to dig for solutions to this. I'm determined to get this working though. Any guidance (explanations of why, references to articles/blog posts, etc.) would be greatly appreciated!
Regards,
Chris
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981642#3981642
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981642
19 years, 6 months